google-maps-documentation

DrawingManager class

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.

Library

drawing

Constructor
DrawingManager
DrawingManager([options])
Parameters: 
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
getDrawingMode()
Parameters:  None
Return Value:  OverlayType optional
Returns the DrawingManager's drawing mode.
getMap
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
setDrawingMode(drawingMode)
Parameters: 
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
setMap(map)
Parameters: 
Return Value:  None
Attaches the DrawingManager object to the specified Map.
setOptions
setOptions(options)
Parameters: 
Return Value:  None
Sets the DrawingManager's options.
Events
circlecomplete
function(circle)
Arguments: 
This event is fired when the user has finished drawing a circle.
markercomplete
function(marker)
Arguments: 
This event is fired when the user has finished drawing a marker.
overlaycomplete
function(event)
Arguments: 
This event is fired when the user has finished drawing an overlay of any type.
polygoncomplete
function(polygon)
Arguments: 
This event is fired when the user has finished drawing a polygon.
polylinecomplete
function(polyline)
Arguments: 
This event is fired when the user has finished drawing a polyline.
rectanglecomplete
function(rectangle)
Arguments: 
This event is fired when the user has finished drawing a rectangle.