Allows for drawing of features for measurements.

Summary

OpenLayers. | Allows for drawing of features for measurements. |

Properties | |

events | {OpenLayers.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 | |

OpenLayers. | |

Functions | |

deactivate | |

cancel | Stop the control from measuring. |

setImmediate | Sets the immediate property. |

updateHandler | |

measureComplete | Called when the measurement sketch is done. |

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

measureImmediate | Called each time the measurement sketch is modified. |

cancelDelay | Cancels the delay measurement that measurePartial began. |

measure | |

getBestArea | Based on the displaySystem returns the area of a geometry. |

getArea | |

getBestLength | Based on the displaySystem returns the length of a geometry. |

getLength |

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

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

measure | Triggered when a measurement sketch is complete. Listeners will receive an event with measure, units, order, and geometry properties. |

measurepartial | Triggered 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. |

{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.

{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.

handler | {OpenLayers.Handler} |

options | {Object} |

cancel: function()

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

setImmediate: function( immediate )

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

measureComplete: function( geometry )

Called when the measurement sketch is done.

geometry | {OpenLayers.Geometry} |

measurePartial: function( point, geometry )

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

point | {OpenLayers.Geometry.Point} The last point added. |

geometry | {OpenLayers.Geometry} The sketch geometry. |

measureImmediate : function( point, feature, drawing )

Called each time the measurement sketch is modified.

point | {OpenLayers.Geometry.Point} The point at the mouse position. |

feature | {OpenLayers.Feature.Vector} The sketch feature. |

drawing | {Boolean} Indicates whether we’re currently drawing. |

getBestArea: function( geometry )

Based on the displaySystem returns the area of a geometry.

geometry | {OpenLayers.Geometry} |

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

getArea: function( geometry, units )

geometry | {OpenLayers.Geometry} |

units | {String} Unit abbreviation |

{Float} The geometry area in the given units.

getBestLength: function( geometry )

Based on the displaySystem returns the length of a geometry.

geometry | {OpenLayers.Geometry} |

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

getLength: function( geometry, units )

geometry | {OpenLayers.Geometry} |

units | {String} Unit abbreviation |

{Float} The geometry length in the given units.

OpenLayers 2

JavaScript Mapping Library

deactivate: function()

Stop the control from measuring.

cancel: function()

Sets the immediate property.

setImmediate: function( immediate )

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

updateHandler: function( handler, options )

Called when the measurement sketch is done.

measureComplete: function( geometry )

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

measurePartial: function( point, geometry )

Called each time the measurement sketch is modified.

measureImmediate : function( point, feature, drawing )

Cancels the delay measurement that measurePartial began.

cancelDelay: function()

measure: function( geometry, eventType )

Based on the displaySystem returns the area of a geometry.

getBestArea: function( geometry )

{String} Display system for output measurements.

getArea: function( geometry, units )

Based on the displaySystem returns the length of a geometry.

getBestLength: function( geometry )

getLength: function( geometry, units )

Controls affect the display or behavior of the map.

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

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 OpenLayers.Geometry classes as geometry description.