Class: PointTool

PointTool

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

Constructor

new PointTool(map, ctrl, options)

Constructs a point 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
max_items_allowed Number <optional>
1 The maximum number of shapes the tool may draw
Source:

Extends

Methods

activate() → {Tool}

Activates the tool

Inherited From:
Source:
Returns:
instance
Type
Tool

addItem(item)

Adds an item to the items

Parameters:
Name Type Description
item Object a google map shape
Inherited From:
Source:
Returns:
void

clear()

Clears all drawed points

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

deactivate(removeCtrlopt) → {Tool}

Removes the tool

Parameters:
Name Type Attributes Default Description
removeCtrl Boolean <optional>
false Whether or not to remove the tool control if the default one
Inherited From:
Source:
Returns:
instance
Type
Tool

exportData() → {Array}

Returns all the drawed points data

Source:
Returns:
data An array of objects representing the drawed points coordinates
Type
Array
Example
// exported data
   [{lat: 45, lng: 7}, {lat: 33, lng: 15}, {lat: 42, lng: 5}]

extendBounds(boundsopt)

Extends the map bounds to fit the points

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

getToolName() → {String}

Returns the tool name

Inherited From:
Source:
Returns:
The tool name
Type
String

importData(data)

Imports the data as points

Parameters:
Name Type Description
data Array An array of objects representing the points coordinates
Source:
Example
// format of data to be imported
   [{lat: 45, lng: 7}, {lat: 33, lng: 15}, {lat: 42, lng: 5}]

prepareTool() → {Tool}

Prepares the current drawing tool

Empty because at the moment has to do nothing, but it's a place where some things can be done in the future, I suppose.
Inherited From:
Source:
Returns:
instance
Type
Tool

setDrawing() → {Tool}

Sets the current drawing tool

Inherited From:
Source:
Returns:
instance
Type
Tool

setMaxItemsAllowed(max)

Sets the maximum number of items that the tool may draw

Parameters:
Name Type Description
max The maximum number of drawable items
Inherited From:
Source:
Returns:
void

setNextShape(enable)

Sets the value of the next shape property (a new click starts a new shape if true)

Parameters:
Name Type Description
enable Whether or not next click has to start a new shape
Inherited From:
Source:
Returns:
void

setSelected()

Sets the css selected class

Inherited From:
Source:
Returns:
void

setUnselected() → {Tool}

Removes the css selected class

Inherited From:
Source:
Returns:
instance
Type
Tool

tipsText() → {String}

Returns the tool help tip text

Source:
Returns:
The tips text
Type
String