Methods for programmatically manipulating sketches while digitizing features. r=bartvde (closes #3343)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@12103 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -121,6 +121,106 @@ OpenLayers.Control.DrawFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
this.events.triggerEvent("featureadded",{feature : feature});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: insertXY
|
||||
* Insert a point in the current sketch given x & y coordinates.
|
||||
*
|
||||
* Parameters:
|
||||
* x - {Number} The x-coordinate of the point.
|
||||
* y - {Number} The y-coordinate of the point.
|
||||
*/
|
||||
insertXY: function(x, y) {
|
||||
if (this.handler && this.handler.line) {
|
||||
this.handler.insertXY(x, y);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: insertDeltaXY
|
||||
* Insert a point given offsets from the previously inserted point.
|
||||
*
|
||||
* Parameters:
|
||||
* dx - {Number} The x-coordinate offset of the point.
|
||||
* dy - {Number} The y-coordinate offset of the point.
|
||||
*/
|
||||
insertDeltaXY: function(dx, dy) {
|
||||
if (this.handler && this.handler.line) {
|
||||
this.handler.insertDeltaXY(dx, dy);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: insertDirectionLength
|
||||
* Insert a point in the current sketch given a direction and a length.
|
||||
*
|
||||
* Parameters:
|
||||
* direction - {Number} Degrees clockwise from the positive x-axis.
|
||||
* length - {Number} Distance from the previously drawn point.
|
||||
*/
|
||||
insertDirectionLength: function(direction, length) {
|
||||
if (this.handler && this.handler.line) {
|
||||
this.handler.insertDirectionLength(direction, length);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: insertDeflectionLength
|
||||
* Insert a point in the current sketch given a deflection and a length.
|
||||
* The deflection should be degrees clockwise from the previously
|
||||
* digitized segment.
|
||||
*
|
||||
* Parameters:
|
||||
* deflection - {Number} Degrees clockwise from the previous segment.
|
||||
* length - {Number} Distance from the previously drawn point.
|
||||
*/
|
||||
insertDeflectionLength: function(deflection, length) {
|
||||
if (this.handler && this.handler.line) {
|
||||
this.handler.insertDeflectionLength(deflection, length);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: undo
|
||||
* Remove the most recently added point in the current sketch geometry.
|
||||
*
|
||||
* Returns:
|
||||
* {Boolean} An edit was undone.
|
||||
*/
|
||||
undo: function() {
|
||||
return this.handler.undo && this.handler.undo();
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: redo
|
||||
* Reinsert the most recently removed point resulting from an <undo> call.
|
||||
* The undo stack is deleted whenever a point is added by other means.
|
||||
*
|
||||
* Returns:
|
||||
* {Boolean} An edit was redone.
|
||||
*/
|
||||
redo: function() {
|
||||
return this.handler.redo && this.handler.redo();
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: finishSketch
|
||||
* Finishes the sketch without including the currently drawn point.
|
||||
* This method can be called to terminate drawing programmatically
|
||||
* instead of waiting for the user to end the sketch.
|
||||
*/
|
||||
finishSketch: function() {
|
||||
this.handler.finishGeometry();
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: cancel
|
||||
* Cancel the current sketch. This removes the current sketch and keeps
|
||||
* the drawing control active.
|
||||
*/
|
||||
cancel: function() {
|
||||
this.handler.cancel();
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Control.DrawFeature"
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user