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
|
- 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 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 |
L.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
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 |
LatLngBounds |
<optional> |
the LatLngBounds object |
- Source:
getToolName() → {String}
Returns the tool name
- Overrides:
- 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.
- Overrides:
- Source:
Returns:
instance
- Type
- Tool
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