/**
 * Controla y maneja los estilos de las calles.
 */
(function() {
	PorArriba.CalleStyle = function( ) {
		this.opacity = 0.3;
		this.drawingScope = 0.4;				//Porcentaje adicional para el area de dibujo
		this.deltaScopeToReDraw = 0.1;			//Porcentaje para fijar un margen li�mite para redibujar
		this.maxCallesSelected = 25; 			//Maximo numero de calles seleccionadas por el usuario
		this.maxArrowDrawed = 3;				//Maxima cantidad de flechas a dibujar.
		this.minLevelToDrawArrow = 16;			//Minimo nivel desde el cual se dibujan las flechas
		this.minZoomLevel = 12;					//Minimo nivel de zoom para el mapa.
		this.maxTimeWithoutDrawed = 60000;		//Maximo de tiempo que puede estar una calle en memoria sin ser dibujada (en milisegundos)
		this.timesToCheckTimeExpired = 15;		//La cantidad de veces que se debe llamar a redibujar calles antes de verificar que calles deben removerse del cache.
		this.minZoomToShowLabelBySegment = 15;	//Indica el minimo zoom para el cual se debe mostrar una etiqueta de calle por segmento
		
		// Los nombres de calles que no deben mostrarse.
		this.noShowNames = ["empalme", "rotonda"];

		/**
		 * Regresa el color de una linea de acuerdo a un zoom especificado
		 */
		this.getLineColor = function ( calleZoomLevel ) {
			switch(calleZoomLevel){
		 		case 11: return "#BB0000";
		 		case 12: return "#BB0000";
		 		case 13: return "#BB0000";
		 		case 14: return "#BB0000";
		 		case 15: return "#BB0000";
		 		case 16: return "#BB0000";
		 		case 17: return "#BB0000";
		 		case 18: return "#BB0000";
		 	}			
		}

		/**
		 * Regresa el color de texto para un zoom de calle especificado
		 */
		this.getTextColor = function ( calleZoomLevel ) {
			switch(calleZoomLevel){
		 		case 11: return "#333333";
		 		case 12: return "#333333";
		 		case 13: return "#333333";
		 		case 14: return "#333333";
		 		case 15: return "#333333";
		 		case 16: return "#333333";
		 		case 17: return "#333333";
		 		case 18: return "#333333";
		 	}			
		}

		/**
		 * Regresa el color de la etiqueta cuando el mouse pasa sobre la etiqueta de acuerdo a un zoom indicado
		 */
		this.getLabelColorMouseOver = function ( calleZoomLevel ) {
			switch(calleZoomLevel){
		 		case 11: return "#96d5ff";
		 		case 12: return "#96d5ff";
		 		case 13: return "#96d5ff";
		 		case 14: return "#96d5ff";
		 		case 15: return "#96d5ff";
		 		case 16: return "#96d5ff";
		 		case 17: return "#96d5ff";
		 		case 18: return "#96d5ff";
		 	}			
		}
		
		/**
		 * Regresa el color de la etiqueta de acuerdo a un zoom de calle indicado
		 */
		this.getLabelColor = function ( calleZoomLevel ) {
			switch(calleZoomLevel){
		 		case 11: return "#FED11E";
		 		case 12: return "#FED11E";
		 		case 13: return "#FED11E";
		 		case 14: return "#FED11E";
		 		case 15: return "#FED11E";
		 		case 16: return "#FED11E";
		 		case 17: return "#FED11E";
		 		case 18: return "#FED11E";
		 	}			
		}

		this.selectedCalleTextColor = "#333333";
		this.selectedLabelLineColor = "#96d5ff";
		this.selectedLabelColorMouseOver = "#96d5ff";
		
		this.recorridoColor = "#AADD5E";
		this.recorridoOpacity = 1;

		/**
		 * Regresa el ancho de una calle de acuerdo a un zoom específico
		 */
		this.getCalleWeight = function (zoom) {
			switch(zoom){
		 		case 11: return 1;
		 		case 12: return 1;
		 		case 13: return 1;
		 		case 14: return 1;
		 		case 15: return 4;
		 		case 16: return 6;
		 		case 17: return 7;
		 		case 18: return 7;
		 	}
		}
		
		/**
		 * Regresa el ancho para un recorrido de acuerdo a un zoom especifico
		 */
		this.getRecorridoWeight = function (zoom) {
			switch(zoom){
		 		case 11: return 3;
		 		case 12: return 3;
		 		case 13: return 3;
		 		case 14: return 3;
		 		case 15: return 4;
		 		case 16: return 6;
		 		case 17: return 7;
		 		case 18: return 7;
		 	}
		}
		
		/**
		 * La cantidad de puntos que deben haber entre una flecha y otra en los recorridos de micros. 
		 */
		this.showArrowOnRecorridoByPoints = function (zoom) {
			switch(zoom){
		 		case 11: return 12;
		 		case 12: return 12;
		 		case 13: return 10;
		 		case 14: return 6;
		 		case 15: return 1;
		 		case 16: return 1;
		 		case 17: return 1;
		 		case 18: return 1;
		 	}
		}

		/**
		 * Regresa un estilo para el nombre de una calle
		 */
		this.getNewLabelNombreStyle = function (zoomLevel, calleSelected){
			var lblStyle = new PorArriba.LabelStyle();
			
			if (calleSelected) {
		        lblStyle.color = this.getTextColor(zoomLevel);
		        lblStyle.backgroundColor = this.selectedLabelLineColor;
			} else  {
		        lblStyle.color = this.getTextColor(zoomLevel);
		        lblStyle.backgroundColor = this.getLabelColor(zoomLevel);
			}

			return lblStyle;
		}

		/**
		 * Regresa el estilo del label para una altura
		 */
		this.getNewLabelAlturaStyle = function (){
			var lblStyle = new PorArriba.LabelStyle();
			lblStyle.color = "#333333";
			lblStyle.backgroundColor = "#FFFFFF";
			lblStyle.fontFamily = "arial";
			lblStyle.fontSize = 9;
			lblStyle.verticalAlign = "middle";
			lblStyle.textAlign = "center";
			lblStyle.paddingRight = 1;
			lblStyle.paddingLeft = 1;
			lblStyle.paddingBottom = 0;
			
			return lblStyle;
		}
		
	}
})();

fileLoaded("CalleStyle.js");
