Class: Tool

(abstract) Tool(map, ctrl, toolName)

Drawing tool class.

This class is the superclass for all tools, extended by all specific tools.

DO NOT INSTANTIATE THIS CLASS DIRECLTY, use its children instead.

Constructor

(abstract) new Tool(map, ctrl, toolName)

Constructs a Tool object

Parameters:
Name Type Description
map Map The Map instance which handles the tool
ctrl String | Element The selector or the element itself which controls the tool when clicking over it, set to null to have the default controller
toolName String The drawing tool name
Source:

Methods

activate() → {Tool}

Activates the tool

Source:
Returns:
instance
Type
Tool

addItem(item)

Adds an item to the items

Parameters:
Name Type Description
item Object a map shape
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
Source:
Returns:
instance
Type
Tool

getToolName() → {String}

Returns the tool name

Source:
Returns:
The tool name
Type
String

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

setDrawing() → {Tool}

Sets the current drawing tool

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

setSelected()

Sets the css selected class

Source:
Returns:
void

setUnselected() → {Tool}

Removes the css selected class

Source:
Returns:
instance
Type
Tool