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

Usa canal en lugar de método para comunicar a Map

parent 05315eaa
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -69,6 +69,15 @@ define([
					REMOVE_LAYER: 'removeLayer'
				},

				actions: {
					// Map actions
					LAYER_REMOVED: 'layerRemoved',
					ADD_LAYER: 'addLayer',
					REMOVE_LAYER: 'removeLayer',
					FIT_BOUNDS: 'fitBounds',
					REORDER_LAYERS: 'reorderLayers'
				},

				_itemsSelected: {},
				localTarget: 'localAtlas',
				target: redmicConfig.services.atlasLayer,
@@ -169,12 +178,12 @@ define([

		_defineSubscriptions: function() {

			if (!this.getMapChannel) {
			if (!this.mapChannel) {
				console.error('Map channel not defined for atlas "%s"', this.getChannel());
			}

			this.subscriptionsConfig.push({
				channel : this.getMapChannel('LAYER_REMOVED'),
				channel : this._buildChannel(this.mapChannel, 'LAYER_REMOVED'),
				callback: '_subLayerRemoved'
			},{
				channel : this.catalogView.getChildChannel('browser', 'BUTTON_EVENT'),
@@ -186,10 +195,10 @@ define([

			this.publicationsConfig.push({
				event: 'ADD_LAYER',
				channel: this.getMapChannel('ADD_LAYER')
				channel: this._buildChannel(this.mapChannel, 'ADD_LAYER')
			},{
				event: 'REMOVE_LAYER',
				channel: this.getMapChannel('REMOVE_LAYER')
				channel: this._buildChannel(this.mapChannel, 'REMOVE_LAYER')
			});
		},

+1 −1
Original line number Diff line number Diff line
@@ -264,7 +264,7 @@ define([

			const layerId = this._createLayerId(atlasItem),
				layerLabel = this._createLayerLabel(atlasItem),
				mapChannel = this.getMapChannel?.() ?? null,
				mapChannel = this.mapChannel,
				innerLayerDefinition = this._getLayerDefinitionByProtocol(atlasItem);

			return {
+2 −2
Original line number Diff line number Diff line
@@ -199,7 +199,7 @@ define([
				});
			}

			this._publish(this.getMapChannel('REORDER_LAYERS'), {
			this._publish(this._buildChannel(this.mapChannel, 'REORDER_LAYERS'), {
				layerId: this._createLayerId(item.atlasItem),
				index: response.indexList,
				movedDown: movedDown
@@ -295,7 +295,7 @@ define([
				southWest = this._getLatLng(coordinates[0]),
				northEast = this._getLatLng(coordinates[2]);

 			this._publish(this.getMapChannel('FIT_BOUNDS'), {
 			this._publish(this._buildChannel(this.mapChannel, 'FIT_BOUNDS'), {
				bounds: L.latLngBounds(southWest, northEast)
			});
		},
+1 −4
Original line number Diff line number Diff line
@@ -64,12 +64,9 @@ define([

			this.inherited(arguments);

			if (!this.getMapChannel) {
			if (!this.mapChannel) {
				console.error('Map channel not defined for QueryOnMap "%s"', this.getChannel());
			}

			// TODO cuando venga así desde fuera (string en lugar de función), quitar y usar directamente
			this.mapChannel = this.getMapChannel?.();
		},

		_defineSubscriptions: function() {
+7 −7
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ define([
			const inheritedComponents = this.inherited(arguments);

			const mapInstance = inheritedComponents.map,
				getMapChannel = lang.hitch(mapInstance, mapInstance.getChannel);
				mapChannel = mapInstance?.getChannel();

			let tabsDisplayer = inheritedComponents.tabsDisplayer;

@@ -55,9 +55,9 @@ define([
			const tabsDisplayerChannel = tabsDisplayer.getChannel(),
				addTabChannel = tabsDisplayer.getChannel('ADD_TAB');

			const atlas = this._createDesignAtlasComponent(getMapChannel, addTabChannel);
			const atlas = this._createDesignAtlasComponent(mapChannel, addTabChannel);

			const queryOnMap = this._createDesignQueryOnMapComponent(getMapChannel, tabsDisplayerChannel);
			const queryOnMap = this._createDesignQueryOnMapComponent(mapChannel, tabsDisplayerChannel);

			return lang.mixin(inheritedComponents, {atlas, queryOnMap});
		},
@@ -67,19 +67,19 @@ define([
			return new TabsDisplayer(this.tabsDisplayerConfig);
		},

		_createDesignAtlasComponent: function(getMapChannel, addTabChannel) {
		_createDesignAtlasComponent: function(mapChannel, addTabChannel) {

			this.mergeComponentAttribute('atlasConfig', {
				getMapChannel, addTabChannel
				mapChannel, addTabChannel
			});

			return new Atlas(this.atlasConfig);
		},

		_createDesignQueryOnMapComponent: function(getMapChannel, tabsDisplayerChannel) {
		_createDesignQueryOnMapComponent: function(mapChannel, tabsDisplayerChannel) {

			this.mergeComponentAttribute('queryOnMapConfig', {
				getMapChannel, tabsDisplayerChannel
				mapChannel, tabsDisplayerChannel
			});

			return new QueryOnMap(this.queryOnMapConfig);
Loading