Commit 4022b015 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Merge branch 'feature-AtlasServiceUpgrade' into 'dev'

Feature atlas service upgrade

See merge request redmic-project/client/web!82
parents c388fc3d 5787e125
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -67,10 +67,11 @@ define([

		_afterShowView: function(request) {

			this._putMetaTags();
			var callback = this._putMetaTags || this._putDefaultMetaTags;
			lang.hitch(this, callback)();
		},

		_putMetaTags: function() {
		_putDefaultMetaTags: function() {
			//	summary:
			//		Manda a publicar la información necesaria para que se generen las meta-tags
			//		de la vista actual. Debe ejecutarse después del show de la vista, ya que este
+4 −2
Original line number Diff line number Diff line
@@ -55,9 +55,11 @@ define([
				pathSeparator: this.pathSeparator
			});

			this._subscribe(this.filter.getChannel('ADDED_TO_QUERY'), lang.hitch(this, function() {
			this._subscribe(this.filter.getChannel('ADDED_TO_QUERY'), lang.hitch(this, function(query) {

				if (query && Object.keys(query).indexOf('suggest') === -1) {
					this._emitEvt('REFRESH');
				}
			}));
		},

+8 −4
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ define([

			aspect.after(this, "_itemAvailable", lang.hitch(this, function(item, args) {

				if (this.target instanceof Array && this.target[0] !== args[0].target) {
				if (this.target instanceof Array && this.target[0] !== args[1].target) {
					return;
				}

@@ -233,10 +233,14 @@ define([

			var rows = config.height || 1,
				cols = config.width || 1,
				nodeParams = "[" + this._rowsParameterName + "=" + rows + "][" + this._colsParameterName + "=" + cols +
					"]",
				node = put("div." + this.hiddenClass + nodeParams);
				showInitially = config.showInitially || false,
				nodeParams = '[' + this._rowsParameterName + '=' + rows + '][' + this._colsParameterName + '=' + cols +
					']',
				node = put('div' + nodeParams);

			if (!showInitially) {
				put(node, '.' + this.hiddenClass);
			}
			this._nodes[key] = node;

			put(this.centerNode, node);
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ define([

		constructor: function(args) {

			aspect.after(this, "_dataInTitle", this._groupSelected);
			aspect.after(this, "_addDataInTitle", this._groupSelected);
			aspect.after(this, "_createTitle", this._createTitleSelection);
		},

+81 −45
Original line number Diff line number Diff line
@@ -53,8 +53,12 @@ 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.selectionTarget = redmicConfig.services.atlasLayerSelection;

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

			this.config = {
@@ -97,7 +101,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 +123,7 @@ define([
							props: {
								template: TemplateImage,
								"class": "imageContainer",
								target: this.target,
								target: this.atlasTarget,
								associatedIds: [this.ownChannel]
							}
						},*/
@@ -168,42 +172,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 +267,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
			});
		}
	});
Loading