google.maps.drawing.DrawingManager class
Allows users to draw markers, polygons, polylines, rectangles, and circles on the map. The DrawingManager's drawing mode defines the type of overlay that will be created by the user. Adds a control to the map, allowing the user to switch drawing mode.
This class extends MVCObject.
drawing
Constructor
DrawingManager([options])
Parameters:
- options: DrawingManagerOptions optional
Creates a DrawingManager that allows users to draw overlays on the map, and switch between the type of overlay to be drawn with a drawing control.
Methods
getDrawingMode()
Parameters: None
Return Value: OverlayType optional
Returns the DrawingManager's drawing mode.
getMap()
Parameters: None
Return Value: Map
Returns the Map to which the DrawingManager is attached, which is the Map on which the overlays created will be placed.
setDrawingMode(drawingMode)
Parameters:
- drawingMode: OverlayType optional
Return Value: None
Changes the DrawingManager's drawing mode, which defines the type of overlay to be added on the map. Accepted values are 'marker', 'polygon', 'polyline', 'rectangle', 'circle', or null. A drawing mode of null means that the user can interact with the map as normal, and clicks do not draw anything.
setMap(map)
Parameters:
- map: Map
Return Value: None
Attaches the DrawingManager object to the specified Map.
setOptions(options)
Parameters:
- options: DrawingManagerOptions
Return Value: None
Sets the DrawingManager's options.
Events
function(circle)
Arguments:
- circle: Circle
This event is fired when the user has finished drawing a circle.
function(marker)
Arguments:
- marker: Marker
This event is fired when the user has finished drawing a marker.
function(event)
Arguments:
- event: OverlayCompleteEvent
This event is fired when the user has finished drawing an overlay of any type.
function(polygon)
Arguments:
- polygon: Polygon
This event is fired when the user has finished drawing a polygon.
function(polyline)
Arguments:
- polyline: Polyline
This event is fired when the user has finished drawing a polyline.
function(rectangle)
Arguments:
- rectangle: Rectangle
This event is fired when the user has finished drawing a rectangle.