Merge all changes from the naturaldocs sandbox. This brings all the work that
has been done in the NaturalDocs branch back to trunk. Thanks to everyone who helped out in making this happen. (I could list people, but the list would be long, and I'm already mentally on vacation.) git-svn-id: http://svn.openlayers.org/trunk/openlayers@3545 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -4,28 +4,34 @@
|
||||
|
||||
|
||||
/**
|
||||
* Handler to draw a path on the map. Polygon is displayed on mouse down,
|
||||
* moves on mouse move, and is finished on mouse up.
|
||||
*
|
||||
* @class
|
||||
* @requires OpenLayers/Handler/Path.js
|
||||
* @requires OpenLayers/Geometry/Polygon.js
|
||||
*
|
||||
* Class: OpenLayers.Handler.Polygon
|
||||
* Handler to draw a polygon on the map. Polygon is displayed on mouse down,
|
||||
* moves on mouse move, and is finished on mouse up.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Handler.Path>
|
||||
* - <OpenLayers.Handler>
|
||||
*/
|
||||
OpenLayers.Handler.Polygon = OpenLayers.Class.create();
|
||||
OpenLayers.Handler.Polygon.prototype =
|
||||
OpenLayers.Class.inherit(OpenLayers.Handler.Path, {
|
||||
|
||||
/**
|
||||
* @type OpenLayers.Feature.Vector
|
||||
* @private
|
||||
* Parameter: polygon
|
||||
* *Private*. {<OpenLayers.Feature.Vector>}
|
||||
*/
|
||||
polygon: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Handler.Polygon
|
||||
* Create a Polygon Handler.
|
||||
*
|
||||
* @param {OpenLayers.Control} control
|
||||
* @param {Array} callbacks An object with a 'done' property whos value is
|
||||
* Parameters:
|
||||
* control - {<OpenLayers.Control>}
|
||||
* callbacks - {Array} An object with a 'done' property whos value is
|
||||
* a function to be called when the path drawing is
|
||||
* finished. The callback should expect to recieve a
|
||||
* single argument, the polygon geometry.
|
||||
@@ -35,13 +41,14 @@ OpenLayers.Handler.Polygon.prototype =
|
||||
* a 'cancel' property, this function will be called when
|
||||
* the handler is deactivated while drawing. The cancel
|
||||
* should expect to receive a geometry.
|
||||
* @param {Object} options
|
||||
* options - {Object}
|
||||
*/
|
||||
initialize: function(control, callbacks, options) {
|
||||
OpenLayers.Handler.Path.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: createFeature
|
||||
* Add temporary geometries
|
||||
*/
|
||||
createFeature: function() {
|
||||
@@ -55,6 +62,7 @@ OpenLayers.Handler.Polygon.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: destroyFeature
|
||||
* Destroy temporary geometries
|
||||
*/
|
||||
destroyFeature: function() {
|
||||
@@ -63,6 +71,7 @@ OpenLayers.Handler.Polygon.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: modifyFeature
|
||||
* Modify the existing geometry given the new point
|
||||
*
|
||||
*/
|
||||
@@ -73,6 +82,7 @@ OpenLayers.Handler.Polygon.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: drawFeature
|
||||
* Render geometries on the temporary layer.
|
||||
*/
|
||||
drawFeature: function() {
|
||||
@@ -81,19 +91,23 @@ OpenLayers.Handler.Polygon.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: geometryClone
|
||||
* Return a clone of the relevant geometry.
|
||||
*
|
||||
* @type OpenLayers.Geometry.Polygon
|
||||
* Return:
|
||||
* {<OpenLayers.Geometry.Polygon>}
|
||||
*/
|
||||
geometryClone: function() {
|
||||
return this.polygon.geometry.clone();
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: dblclick
|
||||
* Handle double-clicks. Finish the geometry and send it back
|
||||
* to the control.
|
||||
*
|
||||
* @param {Event} evt
|
||||
* Parameters:
|
||||
* evt - {Event}
|
||||
*/
|
||||
dblclick: function(evt) {
|
||||
if(!this.freehandMode(evt)) {
|
||||
|
||||
Reference in New Issue
Block a user