The DrawingManager class manages the ability to draw and edit multiple shapes on the map. Shapes managed by this class are rendered on a separate drawing layer. User can use a mouse or a touch screen to draw on the map. When they are done, double clicking the map, pressing the escape button or any button on the toolbar will exit the current drawing mode. This class does not have a publicly accessible constructor and can only be accessed using the
showDrawingManager of the DrawingTools class.
The DrawingManager class has the following methods.
|add(data: IPrimitive or IPrimitive, index?: number)||Adds a shapes to the layer, at the specified index if specified.
• data – The shape(s) to be added to the layer.
• index – The index at which to insert the shape into the layer.
||Disposes the drawing manager instance.|
||Resets the drawing manager and clears all shapes in the drawing layer.|
||DrawingMode||Gets the current drawing mode of the drawing manager.|
||IPrimitive||Gets an array of shapes that are in the layer. This can be used to iterate over the individual shapes.|
|indexOf(primitive: IPrimitive, fromIndex?: number)||number||Returns the index of the shape in the drawing layer. Returns -1 if shape is not found.|
|remove(primitive: IPrimitive)||IPrimitive||Removes a shape from the layer and returns it.|
||IPrimitive||Removes a shape from the layer at the specified index.|
|setDrawingMode(mode: DrawingMode)||Sets the drawing mode of the drawing manager.|
|setOptions(options: DrawingManagerOptions)||Sets the drawing tool options.|
|setPrimitives(primitives: IPrimitive)||Replaces all shapes in the layer with the new array of shapes that have been provided.|
The DrawingManager class provides the following events.
||Occurs when the drawing manager has been disposed.|
||IPrimitive||Occurs after the shape has had a change. For example, finished dragging a vertex to a new location.|
||IPrimitive||Occurs when the shape is being actively manipulated. For example, this event will continuously fire when dragging a vertex of a shape.|
||IPrimitive||Occurs when the user has finished drawing or editing a shape.|
||IPrimitive||Occurs when a shape is erased.|
||DrawingMode||Occurs when the drawing mode has changed.|
||IPrimitive||Occurs when the user has started drawing or editing a shape.|