Commit 13d70cd9 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Migra de diseño el widget de áreas geojson

parent 66004ca1
Loading
Loading
Loading
Loading
+21 −4
Original line number Diff line number Diff line
@@ -53,11 +53,20 @@ define([
				parentChannel,
				selectorChannel: parentChannel,
				idProperty: 'uuid',
				simpleSelection: true
			});

			if (this.mapLayerDefinition === 'cluster') {
				this.mergeComponentAttribute('mapLayerConfig', {
					categoryStyle: 'bubbles',
				simpleSelection: true,
					getMarkerCategory: lang.hitch(this, this._getMarkerCategory),
					getPopupContent: lang.hitch(this, this._getPopupContent)
				});
			} else if (this.mapLayerDefinition === 'geojson') {
				this.mergeComponentAttribute('mapLayerConfig', {
					onEachFeature: lang.hitch(this, this._bindPopupToFeature)
				});
			}

			this.mergeComponentAttribute('mapCenteringConfig', {
				parentChannel
@@ -148,6 +157,14 @@ define([
				i18n: this.i18n,
				feature: data.feature
			});
		},

		_bindPopupToFeature: function(feature, layer) {

			layer.bindPopup(this.mapLayerPopupTemplate?.({
				feature: feature,
				i18n: this.i18n
			}));
		}
	});
});
+4 −6
Original line number Diff line number Diff line
define([
	'app/base/views/extensions/_LocalSelectionView'
	, 'dojo/_base/declare'
	'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'dojo/query'
	, 'src/component/base/_Module'
@@ -15,8 +14,7 @@ define([
	, 'templates/ObservationStationPopup'
	, 'templates/ObservationStationList'
], function(
	_LocalSelectionView
	, declare
	declare
	, lang
	, query
	, _Module
@@ -32,8 +30,8 @@ define([
	, TemplateList
) {

	return declare([_Module, _Show, _Store, _LocalSelectionView, _MapDesignController, _MapDesignWithContentLayout,
		_AddAtlasComponent, _AddBrowserComponent, _AddMapLayerComponent], {
	return declare([_Module, _Show, _Store, _MapDesignController, _MapDesignWithContentLayout, _AddAtlasComponent,
		_AddBrowserComponent, _AddMapLayerComponent], {
		//	summary:
		//		Widget para mostrar un mapa de puntos donde se registran observaciones.

+4 −6
Original line number Diff line number Diff line
define([
	'app/base/views/extensions/_LocalSelectionView'
	, 'dojo/_base/declare'
	'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'dojo/query'
	, 'src/component/base/_Filter'
@@ -16,8 +15,7 @@ define([
	, 'templates/SurveyStationTimeseriesPopup'
	, 'templates/SurveyStationList'
], function(
	_LocalSelectionView
	, declare
	declare
	, lang
	, query
	, _Filter
@@ -34,8 +32,8 @@ define([
	, TemplateList
) {

	return declare([_Module, _Show, _Store, _Filter, _LocalSelectionView, _MapDesignController,
		_MapDesignWithContentLayout, _AddAtlasComponent, _AddBrowserComponent, _AddMapLayerComponent], {
	return declare([_Module, _Show, _Store, _Filter, _MapDesignController, _MapDesignWithContentLayout,
		_AddAtlasComponent, _AddBrowserComponent, _AddMapLayerComponent], {
		//	summary:
		//		Widget para mostrar un mapa de estaciones que producen series de datos temporales.

+106 −55
Original line number Diff line number Diff line
define([
	"app/designs/details/main/ActivityMap"
	'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'src/component/base/_Filter'
	, 'src/component/base/_Module'
	, 'src/component/base/_Show'
	, 'src/component/base/_Store'
	, 'src/design/map/_AddAtlasComponent'
	, 'src/design/map/_AddBrowserComponent'
	, 'src/design/map/_AddMapLayerComponent'
	, 'src/design/map/_MapDesignController'
	, 'src/design/map/_MapDesignWithContentLayout'
	, 'src/redmicConfig'
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, "dojo/aspect"
	, "src/component/map/layer/GeoJsonLayerImpl"
	, "templates/AreaPopup"
	, "templates/AreaList"
	, 'templates/AreaPopup'
	, 'templates/AreaList'
], function(
	ActivityMap
	, redmicConfig
	, declare
	declare
	, lang
	, aspect
	, GeoJsonLayerImpl
	, _Filter
	, _Module
	, _Show
	, _Store
	, _AddAtlasComponent
	, _AddBrowserComponent
	, _AddMapLayerComponent
	, _MapDesignController
	, _MapDesignWithContentLayout
	, redmicConfig
	, TemplatePopup
	, TemplateList
) {
	return declare(ActivityMap, {

	return declare([_Module, _Show, _Store, _Filter, _MapDesignController, _MapDesignWithContentLayout,
		_AddAtlasComponent, _AddBrowserComponent, _AddMapLayerComponent], {
		//	summary:
		//
		//		Widget para mostrar en un mapa las geometrías asociadas a una actividad.

		constructor: function(args) {

			this.config = {
				target: redmicConfig.services.activity,
				templateTargetChange: lang.replace(redmicConfig.services.areasByActivity, {activityid: '{id}'}),
				templatePopup: TemplatePopup,
				_activeRadius: false,
				activityCategory: ["ar"],
				definitionLayer: [GeoJsonLayerImpl]
			const defaultConfig = {
				_dataTarget: redmicConfig.services.areasByActivity,
				mapLayerDefinition: 'geojson',
				mapLayerPopupTemplate: TemplatePopup
			};

			lang.mixin(this, this.config, args);
			lang.mixin(this, this._merge([this, defaultConfig, args]));
		},

		_setOwnCallbacksForEvents: function() {

			aspect.before(this, "_afterSetConfigurations", lang.hitch(this, this._setBaseConfigurations));
			this.inherited(arguments);

			this._onEvt('ME_OR_ANCESTOR_SHOWN', lang.hitch(this, this._onMeOrAncestorShown));
		},

		_setBaseConfigurations: function() {

			this.widgetConfigs = this._merge([{
				geographic: {
					props: {
						browserConfig: {
							template: TemplateList,
							rowConfig: {
								buttonsConfig: {
									listButton: [{
										icon: "fa-map-marker",
										title: 'mapCentering',
										btnId: "mapCentering",
										returnItem: true
									}]
								}
							}
						}
					}
				}
			}, this.widgetConfigs || {}]);
		_setConfigurations: function() {

			this.inherited(arguments);

			this.mergeComponentAttribute('browserConfig', {
				template: TemplateList
			});
		},

		_beforeInitialize: function() {

			this.inherited(arguments);

			const queryChannel = this.queryChannel;

			this.mergeComponentAttribute('browserConfig', {
				queryChannel
			});

			this.layerConfig = this._merge([{
				onEachFeature: lang.hitch(this, this._onEachFeature)
			}, this.layerConfig || {}]);
			this.mergeComponentAttribute('searchConfig', {
				queryChannel
			});
		},

		_onMeOrAncestorShown: function() {

			const replacedTarget = this._getTargetWithVariableReplaced();

			this._updateComponentTargetValues(replacedTarget);
			this._requestDataFromReplacedTarget(replacedTarget);
		},

		_getTargetWithVariableReplaced: function() {

			const replaceObj = {
				activityid: this.pathVariableId
			};

			return lang.replace(this._dataTarget, replaceObj);
		},

		_onEachFeature: function(feature, layer) {
		_updateComponentTargetValues: function(replacedTarget) {

			layer.bindPopup(this.templatePopup({
				feature: feature,
				i18n: this.i18n
			}));
			const browserInstance = this.getComponentInstance('browser'),
				searchInstance = this.getComponentInstance('search'),
				mapLayerInstance = this.getComponentInstance('mapLayer');

			this._publish(mapLayerInstance.getChannel('CHANGE_TARGET'), {
				target: replacedTarget
			});

			this._publish(browserInstance.getChannel('UPDATE_TARGET'), {
				target: replacedTarget,
				refresh: true
			});

			this._publish(searchInstance.getChannel('UPDATE_TARGET'), {
				target: replacedTarget,
				refresh: true
			});
		},

		_requestDataFromReplacedTarget: function(replacedTarget) {

			this._publish(this.getChannel('UPDATE_TARGET'), {
				target: replacedTarget,
				refresh: true
			});
		}
	});
});