# 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 |
layer | {OpenLayers.Layer.Vector}
callbacks | {Object} The functions that are sent to the handler for callback
Constants |
EVENT_TYPES |
Properties |
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 |
drawFeature |
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

### layer

{OpenLayers.Layer.Vector}

### callbacks

{Object} The functions that are sent to the handler for callback

### Constants

### EVENT_TYPES

#### Supported event types

featureadded | Triggered when a feature is added

### Properties

### 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

### drawFeature

> drawFeature: function( | geometry | )

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

Instances of OpenLayers.Layer.Vector are used to render vector data from a variety of sources.

> drawFeature: function( | geometry | )

> 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.
Base class to construct a higher-level handler for event sequences.
Close