# OpenLayers.Control.DrawFeature

The DrawFeature control draws point, line or polygon features on a vector layer when active.

#### Inherits from

- OpenLayers.Control

Summary

OpenLayers.Control.DrawFeature | The DrawFeature control draws point, line or polygon features on a vector layer when active.
Properties |
events | {OpenLayers.Events} Events instance for listeners and triggering control specific events.
multi | {Boolean} Cast features to multi-part geometries before passing to the layer.
featureAdded | {Function} Called after each feature is added
handlerOptions | {Object} Used to set non-default properties on the control’s handler
Constructor |
OpenLayers.Control.DrawFeature |
Functions |
insertXY | Insert a point in the current sketch given x & y coordinates.
insertDeltaXY | Insert a point given offsets from the previously inserted point.
insertDirectionLength | Insert a point in the current sketch given a direction and a length.
insertDeflectionLength | Insert a point in the current sketch given a deflection and a length.
undo | Remove the most recently added point in the current sketch geometry.
redo | Reinsert the most recently removed point resulting from an undo call.
finishSketch | Finishes the sketch without including the currently drawn point.
cancel | Cancel the current sketch.

### Properties

### events

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

featureadded | Triggered when a feature is added

### multi

{Boolean} Cast features to multi-part geometries before passing to the layer. Default is false.

### featureAdded

{Function} Called after each feature is added

### handlerOptions

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

### Constructor

### OpenLayers.Control.DrawFeature

#### Parameters

layer | {OpenLayers.Layer.Vector}
handler | {OpenLayers.Handler}
options | {Object}

### Functions

### insertXY

> insertXY: function( | x,
> | y | )

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.

### insertDeltaXY

> insertDeltaXY: function( | dx,
> | dy | )

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.

### insertDirectionLength

> insertDirectionLength: function( | direction,
> | length | )

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.

### insertDeflectionLength

> insertDeflectionLength: function( | deflection,
> | length | )

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.

### undo

> undo: function()

Remove the most recently added point in the current sketch geometry.

#### Returns

{Boolean} An edit was undone.

### redo

> redo: function()

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.

### finishSketch

> finishSketch: function()

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.

### cancel

> cancel: function()

Cancel the current sketch. This removes the current sketch and keeps the drawing control active.

> insertXY: function( | x,
> | y | )

Insert a point in the current sketch given x & y coordinates.

> insertDeltaXY: function( | dx,
> | dy | )

Insert a point given offsets from the previously inserted point.

> insertDirectionLength: function( | direction,
> | length | )

Insert a point in the current sketch given a direction and a length.

> insertDeflectionLength: function( | deflection,
> | length | )

Insert a point in the current sketch given a deflection and a length.

> undo: function()

Remove the most recently added point in the current sketch geometry.

> redo: function()

Reinsert the most recently removed point resulting from an undo call.

> finishSketch: function()

Finishes the sketch without including the currently drawn point.

> cancel: function()

Cancel the current sketch.
Controls affect the display or behavior of the map.
{OpenLayers.Events} Events instance for listeners and triggering control specific events.
Instances of OpenLayers.Layer.Vector are used to render vector data from a variety of sources.
Base class to construct a higher-level handler for event sequences.
Close