Loading public/javascript/app/designs/details/main/ActivityLayerMap.js 0 → 100644 +118 −0 Original line number Diff line number Diff line define([ "app/base/views/extensions/_ListenActivityDataAndAccessByActivityCategory" , "app/designs/base/_Main" , "app/designs/details/Controller" , "app/designs/details/Layout" , "app/designs/details/_AddTitle" , "app/designs/details/_TitleSelection" , "app/designs/mapWithSideContent/main/Geographic" , "dojo/_base/declare" , "dojo/_base/lang" , 'redmic/modules/map/layer/WmsLayerImpl' , 'templates/ActivityList' ], function( _ListenActivityDataAndAccessByActivityCategory , _Main , Controller , Layout , _AddTitle , _TitleSelection , Geographic , declare , lang , WmsLayerImpl , ActivityList ) { return declare([Layout, Controller, _Main, _AddTitle, _TitleSelection, _ListenActivityDataAndAccessByActivityCategory], { // summary: // Vista detalle de ActivityLayerMap. constructor: function(args) { this.config = { _titleRightButtonsList: [], noScroll: true, propsWidget: { omitTitleBar: true, resizable: false } }; lang.mixin(this, this.config, args); }, _setMainConfigurations: function() { this.widgetConfigs = this._merge([{ geographic: { width: 6, height: 6, type: Geographic, props: { title: this.i18n.map, target: this.targetChange, classWindowContent: "view", notTextSearch: true, browserConfig: { rowConfig: { buttonsConfig: { listButton: [{ icon: "fa-map-marker", title: "map centering", btnId: "mapCentering", returnItem: true }] } }, template: ActivityList } } } }, this.widgetConfigs || {}]); this.layerConfig = this._merge([{ idProperty: 'uuid', parentChannel: this.getChannel() }, this.layerConfig || {}]); }, _initialize: function() { if (!this.definitionLayer) { this.definitionLayer = [WmsLayerImpl]; } this._layerDefinition = declare(this.definitionLayer); }, _clearModules: function() { this._publish(this._widgets.geographic.getChannel("CLEAR")); this._publish(this._widgets.geographic.getChannel("REFRESH")); }, _refreshModules: function() { this._checkPathVariableId(); this._emitEvt('GET', { target: this.target, requesterId: this.ownChannel, id: this.pathVariableId }); this.targetChange = lang.replace(this.templateTargetChange, {id: this.pathVariableId}); this._publish(this._widgets.geographic.getChannel("UPDATE_TARGET"), { target: this.targetChange, refresh: true }); }, _itemAvailable: function(response) { } }); }); public/javascript/app/details/views/ActivityLayerMapBase.js +55 −11 Original line number Diff line number Diff line define([ 'app/designs/details/main/ActivityMap' 'app/designs/details/main/ActivityLayerMap' , 'app/redmicConfig' , 'dojo/_base/declare' , 'dojo/_base/lang' , 'dojo/aspect' , 'redmic/map/OpenLayers' , 'redmic/modules/map/layer/WmsLayerImpl' ], function( ActivityMap ActivityLayerMap , redmicConfig , declare , lang , aspect , OpenLayers , WmsLayerImpl ) { return declare(ActivityMap, { return declare(ActivityLayerMap, { // summary: // Loading @@ -22,10 +22,11 @@ define([ this.config = { target: redmicConfig.services.activity, templateTargetChange: '', templateTargetChange: 'activityLayers', layerTarget: redmicConfig.services.atlasLayer, activityCategory: ['ml'], definitionLayer: [WmsLayerImpl] definitionLayer: [WmsLayerImpl], _activityLayers: [] }; lang.mixin(this, this.config, args); Loading @@ -50,14 +51,57 @@ define([ }); }, _chkIsDataFromLayerActivities: function(res) { _chkIsDataFromLayerActivities: function(resWrapper) { return res.target === this.layerTarget; var target = resWrapper.target, query = resWrapper.req.query || {}, terms = query.terms || {}, activities = terms.activities; return target === this.layerTarget && activities && activities.indexOf(this.pathVariableId) !== -1; }, _onLayerActivitiesData: function(res) { _onLayerActivitiesData: function(resWrapper) { var data = resWrapper.res.data, layers = data.data || []; this._emitEvt('INJECT_DATA', { target: this.templateTargetChange, data: layers }); this._activityLayers = []; for (var i = 0; i < layers.length; i++) { this._createLayer(layers[i]); } }, _createLayer: function(layer) { // TODO me parece mala idea hacer esto, referencia directa a instancias que no se han creado aquí var widgetInstance = this._widgets.geographic; this.layerConfig = this._merge([{ mapChannel: widgetInstance.getChildChannel('map'), layer: OpenLayers.build({ type: 'wmts', url: layer.urlSource, props: { layers: [layer.name], format: 'image/png', transparent: true, tiled: true } }), selectorChannel: widgetInstance.getChannel() }, this.layerConfig || {}]); var layerInstance = new this._layerDefinition(this.layerConfig); this._activityLayers.push(layerInstance); console.log('llega atlas', res); this._publish(widgetInstance.getChildChannel('map', 'ADD_LAYER'), layerInstance); } }); }); Loading
public/javascript/app/designs/details/main/ActivityLayerMap.js 0 → 100644 +118 −0 Original line number Diff line number Diff line define([ "app/base/views/extensions/_ListenActivityDataAndAccessByActivityCategory" , "app/designs/base/_Main" , "app/designs/details/Controller" , "app/designs/details/Layout" , "app/designs/details/_AddTitle" , "app/designs/details/_TitleSelection" , "app/designs/mapWithSideContent/main/Geographic" , "dojo/_base/declare" , "dojo/_base/lang" , 'redmic/modules/map/layer/WmsLayerImpl' , 'templates/ActivityList' ], function( _ListenActivityDataAndAccessByActivityCategory , _Main , Controller , Layout , _AddTitle , _TitleSelection , Geographic , declare , lang , WmsLayerImpl , ActivityList ) { return declare([Layout, Controller, _Main, _AddTitle, _TitleSelection, _ListenActivityDataAndAccessByActivityCategory], { // summary: // Vista detalle de ActivityLayerMap. constructor: function(args) { this.config = { _titleRightButtonsList: [], noScroll: true, propsWidget: { omitTitleBar: true, resizable: false } }; lang.mixin(this, this.config, args); }, _setMainConfigurations: function() { this.widgetConfigs = this._merge([{ geographic: { width: 6, height: 6, type: Geographic, props: { title: this.i18n.map, target: this.targetChange, classWindowContent: "view", notTextSearch: true, browserConfig: { rowConfig: { buttonsConfig: { listButton: [{ icon: "fa-map-marker", title: "map centering", btnId: "mapCentering", returnItem: true }] } }, template: ActivityList } } } }, this.widgetConfigs || {}]); this.layerConfig = this._merge([{ idProperty: 'uuid', parentChannel: this.getChannel() }, this.layerConfig || {}]); }, _initialize: function() { if (!this.definitionLayer) { this.definitionLayer = [WmsLayerImpl]; } this._layerDefinition = declare(this.definitionLayer); }, _clearModules: function() { this._publish(this._widgets.geographic.getChannel("CLEAR")); this._publish(this._widgets.geographic.getChannel("REFRESH")); }, _refreshModules: function() { this._checkPathVariableId(); this._emitEvt('GET', { target: this.target, requesterId: this.ownChannel, id: this.pathVariableId }); this.targetChange = lang.replace(this.templateTargetChange, {id: this.pathVariableId}); this._publish(this._widgets.geographic.getChannel("UPDATE_TARGET"), { target: this.targetChange, refresh: true }); }, _itemAvailable: function(response) { } }); });
public/javascript/app/details/views/ActivityLayerMapBase.js +55 −11 Original line number Diff line number Diff line define([ 'app/designs/details/main/ActivityMap' 'app/designs/details/main/ActivityLayerMap' , 'app/redmicConfig' , 'dojo/_base/declare' , 'dojo/_base/lang' , 'dojo/aspect' , 'redmic/map/OpenLayers' , 'redmic/modules/map/layer/WmsLayerImpl' ], function( ActivityMap ActivityLayerMap , redmicConfig , declare , lang , aspect , OpenLayers , WmsLayerImpl ) { return declare(ActivityMap, { return declare(ActivityLayerMap, { // summary: // Loading @@ -22,10 +22,11 @@ define([ this.config = { target: redmicConfig.services.activity, templateTargetChange: '', templateTargetChange: 'activityLayers', layerTarget: redmicConfig.services.atlasLayer, activityCategory: ['ml'], definitionLayer: [WmsLayerImpl] definitionLayer: [WmsLayerImpl], _activityLayers: [] }; lang.mixin(this, this.config, args); Loading @@ -50,14 +51,57 @@ define([ }); }, _chkIsDataFromLayerActivities: function(res) { _chkIsDataFromLayerActivities: function(resWrapper) { return res.target === this.layerTarget; var target = resWrapper.target, query = resWrapper.req.query || {}, terms = query.terms || {}, activities = terms.activities; return target === this.layerTarget && activities && activities.indexOf(this.pathVariableId) !== -1; }, _onLayerActivitiesData: function(res) { _onLayerActivitiesData: function(resWrapper) { var data = resWrapper.res.data, layers = data.data || []; this._emitEvt('INJECT_DATA', { target: this.templateTargetChange, data: layers }); this._activityLayers = []; for (var i = 0; i < layers.length; i++) { this._createLayer(layers[i]); } }, _createLayer: function(layer) { // TODO me parece mala idea hacer esto, referencia directa a instancias que no se han creado aquí var widgetInstance = this._widgets.geographic; this.layerConfig = this._merge([{ mapChannel: widgetInstance.getChildChannel('map'), layer: OpenLayers.build({ type: 'wmts', url: layer.urlSource, props: { layers: [layer.name], format: 'image/png', transparent: true, tiled: true } }), selectorChannel: widgetInstance.getChannel() }, this.layerConfig || {}]); var layerInstance = new this._layerDefinition(this.layerConfig); this._activityLayers.push(layerInstance); console.log('llega atlas', res); this._publish(widgetInstance.getChildChannel('map', 'ADD_LAYER'), layerInstance); } }); });