Class: PolylineTool

PolylineTool

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

The polyline drawing tool class, which allows to draw polylines over the gmapdraw map instance.

Constructor

new PolylineTool(map, ctrl, options)

Constructs a polyline tool
Parameters:
Name Type Description
map Map The map instance which handles the tool
ctrl String | Object The selector or jQuery element which controls the tool when clicking over it, set to null to have the default controller
options Object A class options object
Properties
Name Type Attributes Default Description
maxItemsAllowed Number <optional>
1 The maximum number of shapes the tool may draw.
Source:

Extends

  • geodrawer.Tool

Methods

clear()

Clears all polylines

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 polylines data

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

extendBounds(boundsopt)

Extends the map bounds to fit the polylines

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

importData(data)

Imports the data as polylines

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

prepareTool()

Prepares the tool

Source:
Returns:
void

tipsText() → {String}

Returns the tool help tip text

Source:
Returns:
The tips text
Type
String