Loading public/javascript/redmic/modules/map/LeafletImpl.js +2 −6 Original line number Diff line number Diff line define([ "dijit/registry" , "dojo/_base/declare" "dojo/_base/declare" , "dojo/_base/lang" , "dojo/_base/kernel" , "dojo/aspect" , "dojo/Deferred" , "dojo/dom-class" , "dojo/on" Loading @@ -21,11 +19,9 @@ define([ , 'L-navBar/Leaflet.NavBar' , 'leaflet-measure/leaflet-measure.min' ], function( registry , declare declare , lang , kernel , aspect , Deferred , domClass , on Loading public/javascript/redmic/modules/map/_ImportWkt.js +66 −0 Original line number Diff line number Diff line define([ 'dojo/_base/declare' , 'dojo/_base/lang' , 'dojo/aspect' , 'wicket/wicket-leaflet' ], function( declare , lang , aspect , wicket ) { Loading @@ -14,6 +18,51 @@ define([ constructor: function(args) { this.config = { importWktEvents: { ADD_WKT: 'addWkt' }, importWktActions: { ADD_WKT: 'addWkt', WKT_ADDED: 'wktAdded' } }; lang.mixin(this, this.config, args); aspect.before(this, '_mixEventsAndActions', lang.hitch(this, this._mixImportWktEventsAndActions)); aspect.before(this, '_defineSubscriptions', lang.hitch(this, this._defineImportWktSubscriptions)); aspect.before(this, '_definePublications', lang.hitch(this, this._defineImportWktPublications)); aspect.before(this, '_initialize', lang.hitch(this, this._initializeImportWkt)); }, _mixImportWktEventsAndActions: function() { lang.mixin(this.events, this.importWktEvents); lang.mixin(this.actions, this.importWktActions); delete this.importWktEvents; delete this.importWktActions; }, _defineImportWktSubscriptions: function() { this.subscriptionsConfig.push({ channel : this.getChannel('ADD_WKT'), callback: '_subAddWkt' }); }, _defineImportWktPublications: function() { this.publicationsConfig.push({ event: 'ADD_WKT', channel: this.getChannel('WKT_ADDED') }); }, _initializeImportWkt: function() { this._wicket = new wicket.Wkt(); }, Loading @@ -32,6 +81,23 @@ define([ this._readWkt(wkt); return this._wicket.toObject(); }, _subAddWkt: function(req) { var newLayer = this._getLeafletLayerFromWkt(req.wkt); if (!newLayer) { return; } newLayer.addTo(this.map); this.fitBounds(newLayer.getBounds()); this._emitEvt('ADD_WKT', { layer: newLayer }); } }); }); Loading
public/javascript/redmic/modules/map/LeafletImpl.js +2 −6 Original line number Diff line number Diff line define([ "dijit/registry" , "dojo/_base/declare" "dojo/_base/declare" , "dojo/_base/lang" , "dojo/_base/kernel" , "dojo/aspect" , "dojo/Deferred" , "dojo/dom-class" , "dojo/on" Loading @@ -21,11 +19,9 @@ define([ , 'L-navBar/Leaflet.NavBar' , 'leaflet-measure/leaflet-measure.min' ], function( registry , declare declare , lang , kernel , aspect , Deferred , domClass , on Loading
public/javascript/redmic/modules/map/_ImportWkt.js +66 −0 Original line number Diff line number Diff line define([ 'dojo/_base/declare' , 'dojo/_base/lang' , 'dojo/aspect' , 'wicket/wicket-leaflet' ], function( declare , lang , aspect , wicket ) { Loading @@ -14,6 +18,51 @@ define([ constructor: function(args) { this.config = { importWktEvents: { ADD_WKT: 'addWkt' }, importWktActions: { ADD_WKT: 'addWkt', WKT_ADDED: 'wktAdded' } }; lang.mixin(this, this.config, args); aspect.before(this, '_mixEventsAndActions', lang.hitch(this, this._mixImportWktEventsAndActions)); aspect.before(this, '_defineSubscriptions', lang.hitch(this, this._defineImportWktSubscriptions)); aspect.before(this, '_definePublications', lang.hitch(this, this._defineImportWktPublications)); aspect.before(this, '_initialize', lang.hitch(this, this._initializeImportWkt)); }, _mixImportWktEventsAndActions: function() { lang.mixin(this.events, this.importWktEvents); lang.mixin(this.actions, this.importWktActions); delete this.importWktEvents; delete this.importWktActions; }, _defineImportWktSubscriptions: function() { this.subscriptionsConfig.push({ channel : this.getChannel('ADD_WKT'), callback: '_subAddWkt' }); }, _defineImportWktPublications: function() { this.publicationsConfig.push({ event: 'ADD_WKT', channel: this.getChannel('WKT_ADDED') }); }, _initializeImportWkt: function() { this._wicket = new wicket.Wkt(); }, Loading @@ -32,6 +81,23 @@ define([ this._readWkt(wkt); return this._wicket.toObject(); }, _subAddWkt: function(req) { var newLayer = this._getLeafletLayerFromWkt(req.wkt); if (!newLayer) { return; } newLayer.addTo(this.map); this.fitBounds(newLayer.getBounds()); this._emitEvt('ADD_WKT', { layer: newLayer }); } }); });