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

Permite la selección de elevación en capas

parent ecb371e6
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ define([
	, 'src/component/base/_Show'
	, 'src/component/base/_ShowInTooltip'
	, 'src/component/base/_Store'
	, 'src/component/atlas/_AtlasElevationManagement'
	, 'src/component/atlas/_AtlasLayersManagement'
	, 'src/component/atlas/_AtlasLegendManagement'
	, 'src/component/atlas/_AtlasThemesManagement'
@@ -33,6 +34,7 @@ define([
	, _Show
	, _ShowInTooltip
	, _Store
	, _AtlasElevationManagement
	, _AtlasLayersManagement
	, _AtlasLegendManagement
	, _AtlasThemesManagement
@@ -45,7 +47,8 @@ define([
) {

	return declare([
		_Module, _Show, _Store, _Selection, _AtlasLayersManagement, _AtlasLegendManagement, _AtlasThemesManagement
		_Module, _Show, _Store, _Selection, _AtlasElevationManagement, _AtlasLayersManagement, _AtlasLegendManagement,
		_AtlasThemesManagement
	], {
		//	summary:
		//		Módulo de Atlas, con un catálogo de capas para añadir al mapa y un listado de gestión de las añadidas.
+116 −0
Original line number Diff line number Diff line
define([
	'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'dojo/dom-class'
	, 'src/component/layout/TagList'
], function(
	declare
	, lang
	, domClass
	, TagList
) {

	return declare(null, {
		//	summary:
		//		Gestión de dimensión de elevación de capas para el módulo Atlas.

		constructor: function(args) {

			this.config = {
				_elevationTagsContainerClass: 'tagListBottomContentContainer',
				_elevationTagListByLayerId: {},
				_elevationShownByLayerId: {}
			};

			lang.mixin(this, this.config, args);
		},

		_removeElevationOfRemovedLayer: function(layerId) {

			this._hideLayerElevationTagList(layerId);
		},

		_showLayerElevation: function(browserButtonObj) {

			var container = browserButtonObj.node,
				elevationContainer = container.children[1],
				item = browserButtonObj.item.originalItem,
				layerId = this._createLayerId(item),
				elevationTagListInstance = this._getLayerElevationTagList(layerId, item),
				elevationShown = this._elevationShownByLayerId[layerId] || false;

			if (!elevationShown) {
				this._showLayerElevationTagList(elevationTagListInstance, elevationContainer);
				this._elevationShownByLayerId[layerId] = true;
			} else {
				this._hideLayerElevationTagList(layerId);
				this._elevationShownByLayerId[layerId] = false;
			}
		},

		_getLayerElevationTagList: function(layerId, item) {

			if (this._elevationTagListByLayerId[layerId]) {
				return this._elevationTagListByLayerId[layerId];
			}

			var elevationDefinition = item.elevationDimension;

			var instance = new TagList({
				parentChannel: this.getChannel(),
				tagsString: elevationDefinition.value,
				getTagLabel: lang.partial(function(unit, tagValue) {

					return tagValue + ' ' + unit;
				}, elevationDefinition.unitSymbol)
			});

			this._subscribe(instance.getChannel('TAG_CLICKED'), lang.hitch(this, this._onElevationTagClicked, layerId));

			this._elevationTagListByLayerId[layerId] = instance;

			return instance;
		},

		_showLayerElevationTagList: function(elevationInstance, elevationContainer) {

			domClass.add(elevationContainer, this._elevationTagsContainerClass);

			this._once(elevationInstance.getChannel('HIDDEN'), lang.hitch(this, function(container) {

				domClass.remove(container, this._elevationTagsContainerClass);
			}, elevationContainer));

			this._publish(elevationInstance.getChannel('SHOW'), {
				node: elevationContainer
			});
		},

		_hideLayerElevationTagList: function(layerId) {

			var elevationTagListInstance = this._elevationTagListByLayerId[layerId];

			if (!elevationTagListInstance) {
				return;
			}

			this._publish(elevationTagListInstance.getChannel('HIDE'));
		},

		_onElevationTagClicked: function(layerId, res) {

			var layerInstance = this._layerInstances[layerId];

			if (!layerInstance) {
				return;
			}

			this._publish(layerInstance.getChannel('SET_LAYER_DIMENSION'), {
				elevation: {
					value: res.value,
					label: res.label
				}
			});
		}
	});
});
+13 −0
Original line number Diff line number Diff line
@@ -74,6 +74,12 @@ define([
								btnId: 'details',
								title: this.i18n.navigateToLayerInfo,
								href: redmicConfig.viewPaths.ogcServiceDetails
							},{
								icon: 'fa-arrows-v',
								btnId: 'elevation',
								title: 'showElevation',
								condition: function(item) { return !!item.originalItem.elevationDimension; },
								returnItem: true
							},{
								icon: 'fa-map-o',
								btnId: 'legend',
@@ -140,6 +146,8 @@ define([
				this._onThemesBrowserAddLayerButtonClick(objReceived);
			} else if (btnId === 'remove') {
				this._onThemesBrowserRemoveLayerButtonClick(item);
			} else if (btnId === 'elevation') {
				this._onThemesBrowserElevationButtonClick(objReceived);
			} else if (btnId === 'legend') {
				this._onThemesBrowserLegendButtonClick(objReceived);
			} else if (btnId === 'fitBounds') {
@@ -186,6 +194,11 @@ define([
			this._emitEvt('DESELECT', [path]);
		},

		_onThemesBrowserElevationButtonClick: function(obj) {

			this._showLayerElevation(obj);
		},

		_onThemesBrowserLegendButtonClick: function(obj) {

			this._showLayerLegend(obj);