Merge pull request #871 from marcjansen/measure-api
Measure API enhancements
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||
|
||||
/**
|
||||
/**
|
||||
* APIProperty: events
|
||||
* {<OpenLayers.Events>} Events instance for listeners and triggering
|
||||
* control specific events.
|
||||
@@ -41,28 +41,28 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||
* APIProperty: handlerOptions
|
||||
* {Object} Used to set non-default properties on the control's handler
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Property: callbacks
|
||||
* {Object} The functions that are sent to the handler for callback
|
||||
*/
|
||||
callbacks: null,
|
||||
|
||||
|
||||
/**
|
||||
* Property: displaySystem
|
||||
* APIProperty: displaySystem
|
||||
* {String} Display system for output measurements. Supported values
|
||||
* are 'english', 'metric', and 'geographic'. Default is 'metric'.
|
||||
*/
|
||||
displaySystem: 'metric',
|
||||
|
||||
|
||||
/**
|
||||
* Property: geodesic
|
||||
* APIProperty: 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 false.
|
||||
*/
|
||||
geodesic: false,
|
||||
|
||||
|
||||
/**
|
||||
* Property: displaySystemUnits
|
||||
* {Object} Units for various measurement systems. Values are arrays
|
||||
@@ -111,10 +111,10 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Control.Measure
|
||||
*
|
||||
*
|
||||
* Parameters:
|
||||
* handler - {<OpenLayers.Handler>}
|
||||
* options - {Object}
|
||||
* handler - {<OpenLayers.Handler>}
|
||||
* options - {Object}
|
||||
*/
|
||||
initialize: function(handler, options) {
|
||||
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
||||
@@ -125,14 +125,14 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||
}
|
||||
this.callbacks = OpenLayers.Util.extend(callbacks, this.callbacks);
|
||||
|
||||
// let the handler options override, so old code that passes 'persist'
|
||||
// let the handler options override, so old code that passes 'persist'
|
||||
// directly to the handler does not need an update
|
||||
this.handlerOptions = OpenLayers.Util.extend(
|
||||
{persist: this.persist}, this.handlerOptions
|
||||
);
|
||||
this.handler = new handler(this, this.callbacks, this.handlerOptions);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* APIMethod: deactivate
|
||||
*/
|
||||
@@ -164,7 +164,7 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||
delete this.callbacks.modify;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Method: updateHandler
|
||||
*
|
||||
@@ -194,7 +194,7 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||
this.cancelDelay();
|
||||
this.measure(geometry, "measure");
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Method: measurePartial
|
||||
* Called each time a new point is added to the measurement sketch.
|
||||
@@ -225,9 +225,11 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||
/**
|
||||
* Method: measureImmediate
|
||||
* Called each time the measurement sketch is modified.
|
||||
*
|
||||
* Parameters: point - {<OpenLayers.Geometry.Point>} The point at the
|
||||
* mouseposition. feature - {<OpenLayers.Feature.Vector>} The sketch feature.
|
||||
*
|
||||
* Parameters:
|
||||
* 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.
|
||||
*/
|
||||
measureImmediate : function(point, feature, drawing) {
|
||||
if (drawing && !this.handler.freehandMode(this.handler.evt)) {
|
||||
@@ -270,7 +272,7 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||
geometry: geometry
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Method: getBestArea
|
||||
* Based on the <displaySystem> returns the area of a geometry.
|
||||
@@ -294,7 +296,7 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||
}
|
||||
return [area, unit];
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Method: getArea
|
||||
*
|
||||
@@ -321,7 +323,7 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||
}
|
||||
return area;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Method: getBestLength
|
||||
* Based on the <displaySystem> returns the length of a geometry.
|
||||
|
||||
Reference in New Issue
Block a user