Class: CircleTool

CircleTool

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

The circle drawing tool class, which allows to draw circles over the gmapdraw map instance.

Constructor

new CircleTool(map, ctrl, options)

Constrcuts a circle tool
Parameters:
Name Type Description
map Map The map instance which handles the tool
ctrl String | Object The selector or the 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 circles

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

distance(point1, point2) → {Number}

Returns the distance between 2 google.maps.LatLng points

Parameters:
Name Type Description
point1 google.maps.LatLng The first point
point2 google.maps.LatLng The second point
Source:
Returns:
The distance in meters
Type
Number

exportData() → {Array}

Returns all the drawn circles data

Source:
Returns:
data An array objects representing the circle's properties
Type
Array
Example
// exported data
   [{lat: 45, lng: 7, radius: 40000}, {lat: 35, lng: 15, radius: 650000}]

extendBounds(boundsopt)

Extends the map bounds to fit the circles

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

importData(data)

Imports all data as circles

Parameters:
Name Type Description
data Array An array objects representing the circle's properties
Source:

prepareTool()

Prepares the tool

Source:
Returns:
void

tipsText() → {String}

Returns the tool help tip text

Source:
Returns:
The tips text
Type
String