Class: PolygonTool

PolygonTool

Google maps drawing polygon tool class. Provides methods to draw over the Map instance

The polygon drawing tool class, which allows to draw polygons over the gmapdraw map instance.

Constructor

new PolygonTool()

Source:

Extends

  • geodrawer.Tool

Methods

clear()

Clears all polygons

Source:
Returns:
void

clickHandler(evt)

Handles the click event over the map when the tool is the drawing one

Parameters:
Name Type Description
evt google.maps.MouseEvent
Source:
Returns:
void

exportData() → {Array}

Returns all the drawn polygons data

Source:
Returns:
data An array of arrays of objects representing the polygons' vertex coordinates
Type
Array
Example
// exported data, two polygons, the first with 3 vertexes, the second with 4 vertexes.
   [[{lat: 45, lng:7}, {lat:46, lng:7}, {lat: 42, lng: 11}],
    [{lat: 42, lng: 11}, {lat: 41, lng: 10.8}, {lat: 44, lng: 8}, {lat: 33, lng: 12}]]

extendBounds(boundsopt)

Extends the map bounds to fit the polygons

Parameters:
Name Type Attributes Description
bounds google.maps.LatLngBounds <optional>
the LatLngBounds object
Source:

importData(data)

Imports the data as polygons

Parameters:
Name Type Description
data Array An array of arrays of objects representing the polygons' vertex coordinates
Source:

prepareTool()

Prepares the tool

Source:
Returns:
void

tipsText() → {String}

Returns the tool help tip text

Source:
Returns:
The tips text
Type
String