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

Refactoriza recursos de capa de tracking

parent 1b243159
Loading
Loading
Loading
Loading
+7 −21
Original line number Diff line number Diff line
define([
	'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'dojo/aspect'
	, 'dojo/Deferred'
	, 'dojo/dom-class'
	, 'dojo/mouse'
@@ -14,7 +13,6 @@ define([
], function(
	declare
	, lang
	, aspect
	, Deferred
	, domClass
	, mouse
@@ -41,14 +39,10 @@ define([
		//	drawFullTrack: Boolean
		//		Flag para dibujar directamente toda la capa.

		constructor: function() {

			aspect.before(this, '_mixEventsAndActions', lang.hitch(this, this._mixTrackingLayerEventsAndActions));
			aspect.after(this, '_defineSubscriptions', lang.hitch(this, this._defineTrackingLayerSubscriptions));
		},

		postMixInProperties: function() {

			this.inherited(arguments);

			const defaultConfig = {
				svgClass: 'trackingSvg',
				svgHoverClass: 'onHover',
@@ -66,7 +60,7 @@ define([

				ownChannel: 'trackingLayer',

				trackingLayerEvents: {
				events: {
					GO_TO_POSITION: 'goToPosition',
					REDRAW: 'redraw',
					ADJUST_POSITION: 'adjustPosition',
@@ -74,7 +68,8 @@ define([
					HIDE_DIRECTION_MARKERS: 'hideDirectionMarkers',
					GET_CLICKED_POINTS_IDS: 'getClickedPointsIds'
				},
				trackingLayerActions: {

				actions: {
					DRAW_ALL: 'drawAll',
					GO_TO_POSITION: 'goToPosition',
					SHOW_DIRECTION_MARKERS: 'showDirectionMarkers',
@@ -84,20 +79,11 @@ define([
			};

			this._mergeOwnAttributes(defaultConfig);

			this.inherited(arguments);
		},

		_mixTrackingLayerEventsAndActions: function() {

			lang.mixin(this.events, this.trackingLayerEvents);
			lang.mixin(this.actions, this.trackingLayerActions);
		_defineSubscriptions: function() {

			delete this.trackingLayerEvents;
			delete this.trackingLayerActions;
		},

		_defineTrackingLayerSubscriptions: function() {
			this.inherited(arguments);

			var options = {
				predicate: lang.hitch(this, this._chkLayerAdded)
+0 −9
Original line number Diff line number Diff line
@@ -96,15 +96,6 @@ define([
			this.inherited(arguments);
		},

		_mixEventsAndActions: function() {

			lang.mixin(this.events, this.trackingBaseEvents);
			lang.mixin(this.actions, this.trackingBaseActions);

			delete this.trackingBaseEvents;
			delete this.trackingBaseActions;
		},

		_defineSubscriptions: function() {

			var options = {
+2 −2
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@ define([

		postMixInProperties: function() {

			this.inherited(arguments);

			const defaultConfig = {
				actions: {
					ZOOM_START: 'zoomStart',
@@ -28,8 +30,6 @@ define([
			};

			this._mergeOwnAttributes(defaultConfig);

			this.inherited(arguments);
		},

		postCreate: function() {
+26 −23
Original line number Diff line number Diff line
define([
	"dojo/_base/declare"
	, "dojo/_base/lang"
	, "dojo/aspect"
	, "./_PublishInfoItfc"
], function(
	declare
	, lang
	, aspect
	, _PublishInfoItfc
) {

	return declare(_PublishInfoItfc, {
		//	summary:
		//		Extensión de MapLayer para consumir y publicar información de la capa.

		postMixInProperties: function() {

		queryable: true,
		layerId: "layerId",

		publishInfoEvents: {
			const defaultConfig = {
				events: {
					LAYER_INFO: "layerInfo",
					LAYER_QUERYING: "layerQuerying"
				},

		publishInfoActions: {
				actions: {
					MAP_CLICKED: "mapClicked",
					LAYER_INFO: "layerInfo",
					LAYER_INFO_FORWARDED: "layerInfoForwarded",
@@ -30,12 +28,13 @@ define([
					LAYER_QUERYING_FORWARDED: "layerQueryingForwarded"
				},

				queryable: true,
				layerId: "layerId"
			};

		constructor: function(args) {
			this._mergeOwnAttributes(defaultConfig);

			aspect.after(this, "_mixEventsAndActions", lang.hitch(this, this._mixPublishInfoEventsAndActions));
			aspect.after(this, "_defineSubscriptions", lang.hitch(this, this._definePublishInfoSubscriptions));
			aspect.after(this, "_definePublications", lang.hitch(this, this._definePublishInfoPublications));
			this.inherited(arguments);
		},

		_mixPublishInfoEventsAndActions: function () {
@@ -46,7 +45,9 @@ define([
			delete this.publishInfoActions;
		},

		_definePublishInfoSubscriptions: function () {
		_defineSubscriptions: function() {

			this.inherited(arguments);

			this.subscriptionsConfig.push({
				channel: this._buildChannel(this.mapChannel, this.actions.MAP_CLICKED),
@@ -71,7 +72,9 @@ define([
			this._deleteDuplicatedChannels(this.subscriptionsConfig);
		},

		_definePublishInfoPublications: function () {
		_definePublications: function() {

			this.inherited(arguments);

			this.publicationsConfig.push({
				event: 'LAYER_INFO',