Commit 507933af authored by CarlosGC1989's avatar CarlosGC1989
Browse files

Refactoriza centrado de capa en el mapa

Refactoriza el centrado de la capa, ya que antes se hacía con un
único punto, ahora utiliza los bounds si es posible.

Fix #10.
parent b8d6cde8
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -42,6 +42,19 @@ define([

		_setConfigurations: function() {

			this.browserConfig = this._merge([{
				rowConfig: {
					buttonsConfig: {
						listButton: [{
							icon: "fa-map-marker",
							title: "map centering",
							btnId: "mapCentering",
							returnItem: true
						}]
					}
				}
			}, this.browserConfig || {}]);

			this.geoJsonLayerConfig = this._merge([{
				parentChannel: this.getChannel(),
				selectorChannel: this.getChannel(),
@@ -66,6 +79,23 @@ define([

			var geoJsonLayerDefinition = declare([GeoJsonLayerImpl, _Selectable, _SelectOnClick]);
			this.geoJsonLayer = new geoJsonLayerDefinition(this.geoJsonLayerConfig);

			this._mapCenteringGatewayAddChannels();
		},

		_mapCenteringGatewayAddChannels: function(layer) {

			this._publish(this.mapCenteringGateway.getChannel("ADD_CHANNELS_DEFINITION"), {
				channelsDefinition: [{
					input: this.browser.getChannel("BUTTON_EVENT"),
					output: this.geoJsonLayer.getChannel("SET_CENTER"),
					subMethod: "setCenter"
				},{
					input: this.browser.getChannel("BUTTON_EVENT"),
					output: this.geoJsonLayer.getChannel("ANIMATE_MARKER"),
					subMethod: "animateMarker"
				}]
			});
		},

		_beforeShowMapWithSideContent: function() {
+11 −7
Original line number Diff line number Diff line
@@ -162,11 +162,19 @@ define([

			this.geoJsonLayer = new geoJsonLayerDefinition(this.geoJsonLayerConfig);

			this.mapCenteringGateway = new MapCenteringGatewayImpl({
				parentChannel: this.getChannel(),
			this.dataDisplayer = new DataDisplayer({
				parentChannel: this.getChannel()
			});

			this._mapCenteringGatewayAddChannels();
		},

		_mapCenteringGatewayAddChannels: function(layer) {

			this._publish(this.mapCenteringGateway.getChannel("ADD_CHANNELS_DEFINITION"), {
				channelsDefinition: [{
					input: this.browser.getChannel("BUTTON_EVENT"),
					output: this.map.getChannel("SET_CENTER"),
					output: this.geoJsonLayer.getChannel("SET_CENTER"),
					subMethod: "setCenter"
				},{
					input: this.browser.getChannel("BUTTON_EVENT"),
@@ -174,10 +182,6 @@ define([
					subMethod: "animateMarker"
				}]
			});

			this.dataDisplayer = new DataDisplayer({
				parentChannel: this.getChannel()
			});
		},

		_defineGeographicBasePublications: function () {
+8 −3
Original line number Diff line number Diff line
@@ -117,11 +117,16 @@ define([

				this._publish(this._widgets.geographic.getChildChannel("map", "ADD_LAYER"), this.layerInstance);

				var widgetInstance = this._widgets.geographic;

				this._publish(
					this._widgets.geographic.getChildChannel("mapCenteringGateway", "ADD_CHANNELS_DEFINITION"),
					{
					widgetInstance.getChildChannel("mapCenteringGateway", "ADD_CHANNELS_DEFINITION"), {
						channelsDefinition: [{
							input: this._widgets.geographic.getChildChannel("browser", "BUTTON_EVENT"),
							input: widgetInstance.getChildChannel("browser", "BUTTON_EVENT"),
							output: this.layerInstance.getChannel("SET_CENTER"),
							subMethod: "setCenter"
						},{
							input: widgetInstance.getChildChannel("browser", "BUTTON_EVENT"),
							output: this.layerInstance.getChannel("ANIMATE_MARKER"),
							subMethod: "animateMarker"
						}]
+6 −6
Original line number Diff line number Diff line
@@ -114,13 +114,13 @@ define([
			this.browserConfig.queryChannel = this.queryChannel;
			this.browser = new declare(exts)(this.browserConfig);

			this._mapCenteringGateway();
		},

		_mapCenteringGateway: function() {

			this.mapCenteringGateway = new MapCenteringGatewayImpl({
				parentChannel: this.getChannel(),
				channelsDefinition: [{
					input: this.browser.getChannel("BUTTON_EVENT"),
					output: this.map.getChannel("SET_CENTER"),
					subMethod: "setCenter"
				}]
				parentChannel: this.getChannel()
			});
		},

+1 −1
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ define([
				parentChannel: this.getChannel(),
				channelsDefinition: [{
					input: this.browser.getChannel("BUTTON_EVENT"),
					output: this.map.getChannel("SET_CENTER"),
					output: this.geoJsonLayer.getChannel("SET_CENTER"),
					subMethod: "setCenter"
				},{
					input: this.browser.getChannel("BUTTON_EVENT"),
Loading