AreaTool Class
Computes the area and perimeter length of a selected area. When the user draws a polygon, the area and length will be displayed in the bottom right corner.
Imports RAMP Modules:
Item Index
Methods
Properties
Events
Methods
activate
()
private
Inherited from
BaseTool
but overwritten in
src\js\RAMP\Tools\areaTool.js:117
Activates the Tool. This method is passed to the initToggle
method and is triggered by the BaseTool logic.
clearMap
()
private
Defined in
src\js\RAMP\Tools\areaTool.js:140
Clears the map. This method is passed to the initToggle
method as the defaultAction
to be triggered by the BaseTool logic when the float-default-button
is clicked.
computeAreaAndLength
-
evtObj
Defined in
src\js\RAMP\Tools\areaTool.js:51
Compute the area and length of a specified polygon.
Parameters:
-
evtObj
Objectan object representing the event.
deactivate
()
private
Inherited from
BaseTool
but overwritten in
src\js\RAMP\Tools\areaTool.js:129
Deactivates the Tool. This method is passed to the initToggle
method and is triggered by the BaseTool logic.
displayOutput
()
private
Inherited from
BaseTool
but overwritten in
src\js\RAMP\Tools\areaTool.js:153
Displays the tool's output by calling BaseTool's displayOutput
function.
displayTemplateOutput
-
templateData
-
[templateName]
Inherited from
BaseTool:
src\js\RAMP\Tools\baseTool.js:308
Generates output to be injected into the tool's float given a template's name and data object.
Parameters:
Returns:
this tool
initToggle
-
selector
-
d
-
[options]
Inherited from
BaseTool:
src\js\RAMP\Tools\baseTool.js:176
Initializes the tool and sets up popup to handle activating/deactivating of the tool. Tools should call this function on init
,
unless they employ a different workflow and then need to handle all function activation/deactivation/working themselves.
Parameters:
-
selector
JObjecta target selector that serves as a toggle for the tool
-
d
JObjecta Deferred object to be resolved after tool initiates
-
[options]
Object optionalAdditional options
-
[target]
JObject optionalTarget where the tool's float should be appended to
-
[outputFloatTemplate]
String optionalTemplate name to generate the float container with
-
[outputFloatData]
Object optionalData payload to be passed to the template engine when generate the float container
-
[workingLabelTemplate]
String optionalTemplate name to generate the
busy
label -
[workingLabelData]
Object optionalData payload to be passed to the template engine when generate the
busy
label -
[activate]
Function optionalan activate function to be called when the toggle is clicked
-
[deactivate]
Function optionala deactivate function to be called when the toggle is clicked
-
[defaultAction]
Function optionalFunction to be executed when the
float-default-button
is clicked
-
Returns:
this tool
outputAreaAndLength
-
evtObj
Defined in
src\js\RAMP\Tools\areaTool.js:81
Display the calculated area and length on the map.
Parameters:
-
evtObj
Objectan object representing the event.
working
-
state
Inherited from
BaseTool:
src\js\RAMP\Tools\baseTool.js:348
Sets the tool into a specified state; if the tool is working
, a working
label is placed beside the cursor and injected into the tool output float.
Parameters:
-
state
Booleanindicates the state of the tool: working, idle
Returns:
This tool
Properties
event
Object
Inherited from
BaseTool:
src\js\RAMP\Tools\baseTool.js:133
Event names published by the BaseTool
Default: null
Example:
{
ACTIVATE: "basetool-activate",
DEACTIVATE: "basetool-deactivate"
}
handle
JObject
Inherited from
BaseTool:
src\js\RAMP\Tools\baseTool.js:65
Handle (popup handle) that triggers opening/closing of the tool.
Default: null
name
String
Inherited from
BaseTool:
src\js\RAMP\Tools\baseTool.js:167
Name of the tool so AdvancedToolbar can distinguish between them.
Default: BaseTool
node
JObject
Inherited from
BaseTool:
src\js\RAMP\Tools\baseTool.js:75
Node (button) the handle is attached too.
Default: null
options
Object
private
Inherited from
BaseTool:
src\js\RAMP\Tools\baseTool.js:55
Stored options passed to the BaseTool.
Default: null
outputFloat
JObject
Inherited from
BaseTool:
src\js\RAMP\Tools\baseTool.js:84
Node representing the tool output float container.
Default: templates/tools_template.json:base_tool_float
Example:
<div class='advanced-output-section-container'>
<div class='advanced-output-section'>
<section class='float-content'></section>
<button class='button button-none float-default-button' >
<i class='fa fa-trash-o'></i><span class='on-right'>{%= o.clearMapButton %}</span>
</button>
<div class='clear'></div>
</div>
</div>
template
Object
Inherited from
BaseTool:
src\js\RAMP\Tools\baseTool.js:123
Stringified and parsed templates
Default: templates/tools_template.json
tooltip
JObject
Inherited from
BaseTool:
src\js\RAMP\Tools\baseTool.js:113
Tooltip node that appears by the mouse cursor when tools is activated.
Default: $("#mainMap.map > .tooltip")
workingLabel
String
Inherited from
BaseTool:
src\js\RAMP\Tools\baseTool.js:103
Template string representing working
label shown when the tool is in busy
state.
Default: templates/tools_template.json:working_label
Example:
<span class='tool-tooltip'><i class='fa fa-cog fa-spin'></i>{%= o.workingLabel %}</span>
Events
ACTIVATE
Inherited from
BaseTool:
src\js\RAMP\Tools\baseTool.js:146
Published whenever a Tool is activated.
DEACTIVATE
Inherited from
BaseTool:
src\js\RAMP\Tools\baseTool.js:155
Published whenever a Tool is deactivated.