ALKMaps.Control.Measure

Allows for drawing of features for measurements.

Inherits from

Summary
ALKMaps.Control.MeasureAllows for drawing of features for measurements.
Properties
events{ALKMaps.Events} Events instance for listeners and triggering control specific events.
handlerOptions{Object} Used to set non-default properties on the control’s handler
callbacks{Object} The functions that are sent to the handler for callback
displaySystem{String} Display system for output measurements.
geodesic{Boolean} Calculate geodesic metrics instead of planar metrics.
displaySystemUnits{Object} Units for various measurement systems.
delay{Number} Number of milliseconds between clicks before the event is considered a double-click.
delayedTrigger{Number} Timeout id of trigger for measurepartial.
persist{Boolean} Keep the temporary measurement sketch drawn after the measurement is complete.
immediate{Boolean} Activates the immediate measurement so that the “measurepartial” event is also fired once the measurement sketch is modified.
Constructor
ALKMaps.Control.Measure
Functions
deactivate
cancelStop the control from measuring.
setImmediateSets the immediate property.
updateHandler
measureCompleteCalled when the measurement sketch is done.
measurePartialCalled each time a new point is added to the measurement sketch.
measureImmediateCalled each time the measurement sketch is modified.
cancelDelayCancels the delay measurement that measurePartial began.
measure
getBestAreaBased on the displaySystem returns the area of a geometry.
getArea
getBestLengthBased on the displaySystem returns the length of a geometry.
getLength

Properties

events

{ALKMaps.Events} Events instance for listeners and triggering control specific events.

Register a listener for a particular event with the following syntax

control.events.register(type, obj, listener);

Supported event types (in addition to those from <ALKMaps.Control.events>)

measureTriggered when a measurement sketch is complete.  Listeners will receive an event with measure, units, order, and geometry properties.
measurepartialTriggered when a new point is added to the measurement sketch or if the immediate property is true and the measurement sketch is modified.  Listeners receive an event with measure, units, order, and geometry.

handlerOptions

{Object} Used to set non-default properties on the control’s handler

callbacks

{Object} The functions that are sent to the handler for callback

displaySystem

{String} Display system for output measurements.  Supported values are ‘english’, ‘metric’, and ‘geographic’.  Default is ‘metric’.

geodesic

{Boolean} Calculate geodesic metrics instead of planar metrics.  This requires that geometries can be transformed into Geographic/WGS84 (if that is not already the map projection).  Default is true.

displaySystemUnits

{Object} Units for various measurement systems.  Values are arrays of unit abbreviations (from ALKMaps.INCHES_PER_UNIT) in decreasing order of length.

delay

{Number} Number of milliseconds between clicks before the event is considered a double-click.  The “measurepartial” event will not be triggered if the sketch is completed within this time.  This is required for IE where creating a browser reflow (if a listener is modifying the DOM by displaying the measurement values) messes with the dblclick listener in the sketch handler.

delayedTrigger

{Number} Timeout id of trigger for measurepartial.

persist

{Boolean} Keep the temporary measurement sketch drawn after the measurement is complete.  The geometry will persist until a new measurement is started, the control is deactivated, or cancel is called.

immediate

{Boolean} Activates the immediate measurement so that the “measurepartial” event is also fired once the measurement sketch is modified.  Default is false.

Constructor

ALKMaps.Control.Measure

Parameters

handler{ALKMaps.Handler}
options{Object}

Functions

deactivate

deactivate: function()

cancel

cancel: function()

Stop the control from measuring.  If persist is true, the temporary sketch will be erased.

setImmediate

setImmediate: function(immediate)

Sets the immediate property.  Changes the activity of immediate measurement.

updateHandler

updateHandler: function(handler,
options)

Parameters

handler{Function} One of the sketch handler constructors.
options{Object} Options for the handler.

measureComplete

measureComplete: function(geometry)

Called when the measurement sketch is done.

Parameters

geometry{ALKMaps.Geometry}

measurePartial

measurePartial: function(point,
geometry)

Called each time a new point is added to the measurement sketch.

Parameters

point{ALKMaps.Geometry.Point} The last point added.
geometry{ALKMaps.Geometry} The sketch geometry.

measureImmediate

measureImmediate : function(point,
feature,
drawing)

Called each time the measurement sketch is modified.

Parameters: point{ALKMaps.Geometry.Point} The point at the
mouseposition. feature{ALKMaps.Feature.Vector} The sketch feature.

cancelDelay

cancelDelay: function()

Cancels the delay measurement that measurePartial began.

measure

measure: function(geometry,
eventType)

Parameters

geometry{ALKMaps.Geometry}
eventType{String}

getBestArea

getBestArea: function(geometry)

Based on the displaySystem returns the area of a geometry.

Parameters

geometry{ALKMaps.Geometry}

Returns

{Array([Float, String])} Returns a two item array containing the area and the units abbreviation.

getArea

getArea: function(geometry,
units)

Parameters

geometry{ALKMaps.Geometry}
units{String} Unit abbreviation

Returns

{Float} The geometry area in the given units.

getBestLength

getBestLength: function(geometry)

Based on the displaySystem returns the length of a geometry.

Parameters

geometry{ALKMaps.Geometry}

Returns

{Array([Float, String])} Returns a two item array containing the length and the units abbreviation.

getLength

getLength: function(geometry,
units)

Parameters

geometry{ALKMaps.Geometry}
units{String} Unit abbreviation

Returns

{Float} The geometry length in the given units.

deactivate: function()
cancel: function()
Stop the control from measuring.
setImmediate: function(immediate)
Sets the immediate property.
{Boolean} Activates the immediate measurement so that the “measurepartial” event is also fired once the measurement sketch is modified.
updateHandler: function(handler,
options)
measureComplete: function(geometry)
Called when the measurement sketch is done.
measurePartial: function(point,
geometry)
Called each time a new point is added to the measurement sketch.
measureImmediate : function(point,
feature,
drawing)
Called each time the measurement sketch is modified.
cancelDelay: function()
Cancels the delay measurement that measurePartial began.
measure: function(geometry,
eventType)
getBestArea: function(geometry)
Based on the displaySystem returns the area of a geometry.
{String} Display system for output measurements.
getArea: function(geometry,
units)
getBestLength: function(geometry)
Based on the displaySystem returns the length of a geometry.
getLength: function(geometry,
units)
Controls affect the display or behavior of the map.
Base class to construct a higher-level handler for event sequences.
{Boolean} Keep the temporary measurement sketch drawn after the measurement is complete.
A Geometry is a description of a geographic object.
Point geometry class.
Vector features use the ALKMaps.Geometry classes as geometry description.
Close