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

Resuelve datos de actividades en detalle de capas

Permite ver el origen de dicha capa (servicio OGC) y navegar hasta las
actividades relacionadas.
parent fa6d2d13
Loading
Loading
Loading
Loading
+80 −45
Original line number Diff line number Diff line
@@ -53,8 +53,11 @@ define([

		constructor: function(args) {

			this.target = redmicConfig.services.atlasLayer;
			this.activityTarget = "activitiesLayer";
			this.atlasTarget = redmicConfig.services.atlasLayer;
			this.activityTarget = redmicConfig.services.activity;
			this.target = [this.atlasTarget, this.activityTarget];

			this.activityLocalTarget = "activitiesLayer";
			this.infoLayerTarget = 'infoLayerTarget';

			this.config = {
@@ -97,7 +100,7 @@ define([
							title: this.i18n.dataSource,
							type: declare([ListImpl, _Framework, _ButtonsInRow]),
							props: {
								target: this.activityTarget,
								target: this.activityLocalTarget,
								template: TemplateActivities,
								bars: [{
									instance: Total
@@ -119,7 +122,7 @@ define([
							props: {
								template: TemplateImage,
								"class": "imageContainer",
								target: this.target,
								target: this.atlasTarget,
								associatedIds: [this.ownChannel]
							}
						},*/
@@ -168,42 +171,82 @@ define([
			this._checkPathVariableId();

			this._emitEvt('GET', {
				target: this.target,
				target: this.atlasTarget,
				requesterId: this.ownChannel,
				id: this.pathVariableId
			});
		},

		_itemAvailable: function(response) {
		_itemAvailable: function(response, resObj) {

			var target = resObj.target,
				data = response.data;

			if (target === this.activityTarget) {
				this._handleActivityItemAvailable(data);
			} else {
				this._handleAtlasItemAvailable(data);
			}
		},

			var data = response.data;
		_handleAtlasItemAvailable: function(data) {

			this._emitEvt('INJECT_ITEM', {
				data: data,
				target: this.infoLayerTarget
			});

			this._createMapBoundingLayer(data);
			this._retrieveLayerActivities(data);
			this._createMapLayer(data);
		},

		_createMapBoundingLayer: function(data) {

			if (data && data.geometry && data.geometry.coordinates) {
				this._addPolygon(data.geometry);
			}
		},

			var activities = data.activities;
		_addPolygon: function(geometry) {

			if (activities && activities.length) {
				for (var i = 0; i < activities.length; i++) {
			this.layerPolygon = L.geoJson(geometry, {
				style: {
					color: 'red',
					fillOpacity: 0
				}
			});

					var activity = activities[i];
			this._publishMapBox("ADD_LAYER", {
				layer: this.layerPolygon,
				layerId: "boundingBox",
				layerLabel: this.i18n.boundingBox,
				optional: true
			});
		},

					activity.rank = RedmicUtilities.getActivityRankByPath(activity.path);
		_retrieveLayerActivities: function(data) {

					this._emitEvt('INJECT_ITEM', {
						data: activity,
						target: this.activityTarget
					});
			var activities = data.activities;

			if (!activities || !activities.length) {
				return;
			}

			for (var i = 0; i < activities.length; i++) {
				var activity = activities[i];
				this._publish(this._buildChannel(this.storeChannel, this.actions.GET), {
					target: this.activityTarget,
					id: activity[this.idProperty]
				});
			}
		},

			if (data.urlSource && data.name) {
		_createMapLayer: function(data) {

			if (!data.urlSource || !data.name) {
				return;
			}

			this.layer = new WmsLayerImpl({
				parentChannel: this.getChannel(),
@@ -223,23 +266,15 @@ define([
			this._publishMapBox("ADD_LAYER", {
				layer: this.layer
			});
			}
		},

		_addPolygon: function(geometry) {
		_handleActivityItemAvailable: function(activity) {

			this.layerPolygon = L.geoJson(geometry, {
				style: {
					color: 'red',
					fillOpacity: 0
				}
			});
			activity.rank = RedmicUtilities.getActivityRankByPath(activity.path);

			this._publishMapBox("ADD_LAYER", {
				layer: this.layerPolygon,
				layerId: "boundingBox",
				layerLabel: this.i18n.boundingBox,
				optional: true
			this._emitEvt('INJECT_ITEM', {
				data: activity,
				target: this.activityLocalTarget
			});
		}
	});
+0 −2
Original line number Diff line number Diff line
@@ -13,8 +13,6 @@ define([

		_setConfigurations: function() {

			this.target = redmicConfig.services.atlasLayer;

			this.viewPathsWidgets = {
				activities: "/catalog/{rank}-info/{id}"
			};
+0 −2
Original line number Diff line number Diff line
@@ -19,8 +19,6 @@ define([
				title: this.i18n.edit
			}];

			this.target = redmicConfig.services.atlasLayer;

			this.viewPathsWidgets = {
				activities: "/admin/{rank}-info/{id}"
			};