Last active
August 29, 2015 14:02
-
-
Save DavidSpriggs/0df4ea2e4b007d74f7ac to your computer and use it in GitHub Desktop.
Adding two widgets to one title pane
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drawmeasure: { | |
include: true, | |
id: 'drawandmeasurement', | |
widgetType: 'titlePane', | |
widgetClass: 'gis/dijit/DrawAndMeasurement', | |
title: 'Darw and Measurement', | |
open: false, | |
position: 4, | |
options: { | |
map: true, | |
mapClickMode: true, | |
defaultAreaUnit: units.SQUARE_MILES, | |
defaultLengthUnit: units.MILES | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define([ | |
'dojo/_base/declare', | |
'dijit/_WidgetBase', | |
'esri/dijit/Measurement', | |
'gis/dijit/Draw', | |
'dojo/aspect', | |
'dojo/_base/lang', | |
'dojo/dom-construct', | |
'dijit/TitlePane' | |
], function(declare, _WidgetBase, Measurement, Draw, aspect, lang, domConstruct, TitlePane) { | |
return declare([_WidgetBase], { | |
declaredClass: 'gis.digit.DrawAndMeasurement', | |
postCreate: function() { | |
this.inherited(arguments); | |
this.mTp = new TitlePane({ | |
title: 'Measurement', | |
open: false | |
}).placeAt(this.domNode); | |
this.mTp.startup(); | |
this.measure = new Measurement({ | |
map: this.map, | |
defaultAreaUnit: this.defaultAreaUnit, | |
defaultLengthUnit: this.defaultLengthUnit | |
}, domConstruct.create('div')).placeAt(this.mTp.containerNode); | |
this.measure.startup(); | |
aspect.before(this.measure, 'measureArea', lang.hitch(this, 'setMapClickMode', 'measure')); | |
aspect.before(this.measure, 'measureDistance', lang.hitch(this, 'setMapClickMode', 'measure')); | |
aspect.before(this.measure, 'measureLocation', lang.hitch(this, 'setMapClickMode', 'measure')); | |
aspect.after(this.measure, 'closeTool', lang.hitch(this, 'setMapClickMode', this.mapClickMode.defaultMode)); | |
this.dTp = new TitlePane({ | |
title: 'Draw', | |
open: false | |
}).placeAt(this.domNode); | |
this.dTp.startup(); | |
// add draw | |
this.draw = new Draw({ | |
map: this.map, | |
mapClickMode: this.mapClickMode | |
}, domConstruct.create('div')).placeAt(this.dTp.containerNode); | |
}, | |
setMapClickMode: function(mode) { | |
this.mapClickMode.current = mode; | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment