Draw Tool Add-on

Draw tool allows us to draw on a map.

Draw

new Draw(options: Object)
Parameters
options (Object)
Name Type Description
options.keybindings boolean (default: true) Whether or not to enable keyboard interactions for drawing.
options.touchEnabled boolean (default: true) Whether or not to enable touch interactions for drawing.
options.boxSelect boolean (default: true) Whether or not to enable box selection of features with shift + click + drag. If false , shift + click + drag zooms into an area.
options.clickBuffer number (default: 2) Number of pixels around any feature or vertex (in every direction) that will respond to a click.
options.touchBuffer number (default: 25) Number of pixels around any feature of vertex (in every direction) that will respond to a touch.
options.controls Object Hide or show individual controls. Each property's name is a control, and value is a boolean indicating whether the control is on or off. Available control names are point , line_string , polygon , trash , combine_features and uncombine_features . By default, all controls are on. To change that default, use displayControlsDefault .
options.displayControlsDefault boolean (default: true) The default value for controls . For example, if you would like all controls to be off by default, and specify an allowed list with controls , use displayControlsDefault : false .
options.styles Array<Object> An array of map style objects. By default, the addon provides a map style for you.
options.modes Object Override the default modes with your own. Draw.modes can be used to see the default values.
options.defaultMode modes (default: Draw.modes.SIMPLE_SELECT) The initial/starting mode of the addon.
options.userProperties boolean (default: false) Whether or not the properties of a feature will also be available for styling and prefixed with user_ , e.g., ['==', 'user_custom_label', 'Example']
Example
  
    const drawControl = new TrimbleMapsControl.Draw({
   defaultMode: TrimbleMapsControl.Draw.modes.DRAW_POLYGON,
   userProperties: true
});
map.addControl(drawControl);
    
  
Static Members
▸ modes
Instance Members
▸ getFeatureIdsAt(point)
▸ getSelectedIds()
▸ getSelected()
▸ getSelectedPoints()
▸ set(featureCollection)
▸ add(geojson)
▸ get(id)
▸ getAll()
▸ delete(featureIds)
▸ deleteAll()
▸ changeMode(mode, modeOptions)
▸ getMode()
▸ trash()
▸ combineFeatures()
▸ uncombineFeatures()
▸ setFeatureProperty(featureId, property, value)
Events
▸ draw.create
▸ draw.delete
▸ draw.combine
▸ draw.uncombine
▸ draw.update
▸ draw.selectionchange
▸ draw.modechange
▸ draw.render
▸ draw.actionable