Class: CircleTool

CircleTool(map, ctrl, options)

Open Street Map 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

Methods

activate() → {Tool}

Activates the tool

Overrides:
Source:
Returns:
instance
Type
Tool

addItem(item)

Adds an item to the items

Parameters:
Name Type Description
item Object a map shape
Overrides:
Source:
Returns:
void

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 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
Overrides:
Source:
Returns:
instance
Type
Tool

distance(point1, point2) → {Number}

Returns the distance between 2 LatLng points

Parameters:
Name Type Description
point1 LatLng The first point
point2 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 LatLngBounds <optional>
the LatLngBounds object
Source:

getToolName() → {String}

Returns the tool name

Overrides:
Source:
Returns:
The tool name
Type
String

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

Overrides:
Source:
Returns:
void

setDrawing() → {Tool}

Sets the current drawing tool

Overrides:
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
Overrides:
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
Overrides:
Source:
Returns:
void

setSelected()

Sets the css selected class

Overrides:
Source:
Returns:
void

setUnselected() → {Tool}

Removes the css selected class

Overrides:
Source:
Returns:
instance
Type
Tool

tipsText() → {String}

Returns the tool help tip text

Source:
Returns:
The tips text
Type
String