Commit e7ff0b58 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Alterna entre leyenda y elevación si coinciden

Evita que el usuario muestre al mismo tiempo la leyenda y los valores de
elevación de una misma capa alternándolos, para no distorsionar el
contenido.
parent acd46b5e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ define([
			lang.mixin(this, this.config, args);

			aspect.before(this, '_deactivateLayer', lang.hitch(this, this._atlasDimensionsDeactivateLayer));
			aspect.before(this, '_cleanRowSecondaryContainer', lang.hitch(this,
				this._atlasDimensionsCleanRowSecondaryContainer));
		},

		_getAtlasLayerDimensions: function(atlasItem) {
@@ -72,6 +74,7 @@ define([
				elevationShown = this._elevationShownByLayerId[layerId] || false;

			if (!elevationShown) {
				this._cleanRowSecondaryContainer(layerId, elevationContainer);
				this._showLayerElevationTagList(elevationTagListInstance, elevationContainer);
				this._elevationShownByLayerId[layerId] = true;
			} else {
@@ -163,6 +166,13 @@ define([
			}

			this._hideLayerElevationTagList(mapLayerId);
		},

		_atlasDimensionsCleanRowSecondaryContainer: function(mapLayerId) {

			if (this._elevationShownByLayerId[mapLayerId]) {
				this._hideLayerElevationTagList(mapLayerId);
			}
		}
	});
});
+0 −5
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ define([
				layerIdSeparator: '_',
				themeSeparator: '-',
				_layerInstances: {}, // capas de las que hemos creado instancia (no se borran, se reciclan)
				_activeLayers: {}, // indicador sobre si la capa está activada en el mapa o no
				defaultLayerItemState: true
			};

@@ -377,8 +376,6 @@ define([
				atlasItem: atlasLayerItem.atlasItem,
				order: order
			});

			this._activeLayers[mapLayerId] = true;
		},

		_deactivateLayer: function(/*Object*/ atlasLayerItem, order) {
@@ -396,8 +393,6 @@ define([
					order: order,
					keepInstance: true
				});

				this._activeLayers[mapLayerId] = false;
			}
		}
	});
+26 −5
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@ define([
			lang.mixin(this, this.config, args);

			aspect.before(this, '_deactivateLayer', lang.hitch(this, this._atlasLegendDeactivateLayer));
			aspect.before(this, '_cleanRowSecondaryContainer', lang.hitch(this,
				this._atlasLegendCleanRowSecondaryContainer));
		},

		_removeLegendOfRemovedLayer: function(layerId) {
@@ -63,7 +65,7 @@ define([
			}
		},

		_showLayerLegend: function(browserButtonObj) {
		_toggleShowLayerLegend: function(browserButtonObj) {

			var atlasLayerItem = browserButtonObj.item,
				layerId = atlasLayerItem.mapLayerId;
@@ -94,12 +96,24 @@ define([
			}

			if (!legendShown) {
				this._showLayerLegend(layerId, legendContainer, legend);
			} else {
				this._hideLayerLegend(layerId);
			}
		},

		_showLayerLegend: function(layerId, legendContainer, legend) {

			this._cleanRowSecondaryContainer(layerId, legendContainer);

			put(legendContainer, legend);
			this._legendShownByLayerId[layerId] = true;
			} else {
				put('!', legend);
		},

		_hideLayerLegend: function(layerId) {

			put('!', this._legendByLayerId[layerId]);
			this._legendShownByLayerId[layerId] = false;
			}
		},

		_atlasLegendDeactivateLayer: function(atlasLayerItem) {
@@ -111,6 +125,13 @@ define([
			var mapLayerId = atlasLayerItem.mapLayerId;

			this._legendShownByLayerId[mapLayerId] = false;
		},

		_atlasLegendCleanRowSecondaryContainer: function(layerId) {

			if (this._legendShownByLayerId[layerId]) {
				this._hideLayerLegend(layerId);
			}
		}
	});
});
+12 −2
Original line number Diff line number Diff line
@@ -30,7 +30,9 @@ define([
				pathSeparator: '.',
				parentProperty: 'parent',
				addThemesBrowserFirst: false,
				omitThemesBrowser: false
				omitThemesBrowser: false,

				_activeLayers: {}, // indicador sobre si la capa está activada en el mapa o no
			};

			lang.mixin(this, this.config, args);
@@ -179,13 +181,16 @@ define([
		_onThemesBrowserAddLayerButtonClick: function(obj) {

			var atlasLayerItem = obj.item,
				mapLayerId = atlasLayerItem.mapLayerId,
				state = obj.state,
				order = obj.total - obj.indexList;

			if (!state) {
				this._deactivateLayer(atlasLayerItem, order);
				this._activeLayers[mapLayerId] = false;
			} else {
				this._activateLayer(atlasLayerItem, order);
				this._activeLayers[mapLayerId] = true;
			}
		},

@@ -204,7 +209,7 @@ define([

		_onThemesBrowserLegendButtonClick: function(obj) {

			this._showLayerLegend(obj);
			this._toggleShowLayerLegend(obj);
		},

		_onThemesBrowserFitBoundsButtonClick: function(item) {
@@ -243,6 +248,11 @@ define([
		_themesBrowserReportClearSelection: function() {

			this._publish(this._themesBrowser.getChildChannel('browser', 'CLEAR'));
		},

		_cleanRowSecondaryContainer: function(layerId, container) {

			// TODO se usa para conectar con aspect desde las otras extensiones
		}
	});
});