OpenLayers.Handler.Path - OpenLayers

# OpenLayers. Handler.Path

Handler to draw a path on the map. Path is displayed on mouse down, moves on mouse move, and is finished on mouse up.

#### Inherits from

- OpenLayers.Handler.Point

Summary

OpenLayers. Handler.Path | Handler to draw a path on the map.
Properties |
line | {OpenLayers.Feature.Vector}
freehand | {Boolean} In freehand mode, the handler starts the path on mouse down, adds a point for every mouse move, and finishes the path on mouse up.
freehandToggle | {String} If set, freehandToggle is checked on mouse events and will set the freehand mode to the opposite of this.freehand.
Constructor |
OpenLayers. Handler.Path | Create a new path hander
Functions |
createFeature | Add temporary geometries
destroyFeature | Destroy temporary geometries
destroyPoint | Destroy the temporary point.
addPoint | Add point to geometry.
freehandMode | Determine whether to behave in freehand mode or not.
modifyFeature | Modify the existing geometry given the new point
drawFeature | Render geometries on the temporary layer.
getGeometry | Return the sketch geometry.
mousedown | Handle mouse down.
mousemove | Handle mouse move.
mouseup | Handle mouse up.
dblclick | Handle double-clicks.

### Properties

### line

{OpenLayers.Feature.Vector}

### freehand

{Boolean} In freehand mode, the handler starts the path on mouse down, adds a point for every mouse move, and finishes the path on mouse up. Outside of freehand mode, a point is added to the path on every mouse click and double-click finishes the path.

### freehandToggle

{String} If set, freehandToggle is checked on mouse events and will set the freehand mode to the opposite of this.freehand. To disallow toggling between freehand and non-freehand mode, set freehandToggle to null. Acceptable toggle values are ‘shiftKey’, ‘ctrlKey’, and ‘altKey’.

### Constructor

### OpenLayers. Handler.Path

Create a new path hander

#### Parameters

control | {OpenLayers.Control}
callbacks | {Object} 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 line string geometry. If the callbacks object contains a ‘point’ property, this function will be sent each point as they are added. If the callbacks object contains a ‘cancel’ property, this function will be called when the handler is deactivated while drawing. The cancel should expect to receive a geometry.
options | {Object} An optional object with properties to be set on the handler

### Functions

### createFeature

> createFeature: function()

Add temporary geometries

### destroyFeature

> destroyFeature: function()

Destroy temporary geometries

### destroyPoint

> destroyPoint: function()

Destroy the temporary point.

### addPoint

> addPoint: function()

Add point to geometry. Send the point index to override the behavior of LinearRing that disregards adding duplicate points.

### freehandMode

> freehandMode: function( | evt | )

Determine whether to behave in freehand mode or not.

#### Returns

{Boolean}

### modifyFeature

> modifyFeature: function()

Modify the existing geometry given the new point

### drawFeature

> drawFeature: function()

Render geometries on the temporary layer.

### getGeometry

> getGeometry: function()

Return the sketch geometry. If <multi> is true, this will return a multi-part geometry.

#### Returns

{OpenLayers.Geometry.LineString}

### mousedown

> mousedown: function( | evt | )

Handle mouse down. Add a new point to the geometry and render it. Return determines whether to propagate the event on the map.

#### Parameters

evt | {Event} The browser event

#### Returns

{Boolean} Allow event propagation

### mousemove

> mousemove: function ( | evt | )

Handle mouse move. Adjust the geometry and redraw. Return determines whether to propagate the event on the map.

#### Parameters

evt | {Event} The browser event

#### Returns

{Boolean} Allow event propagation

### mouseup

> mouseup: function ( | evt | )

Handle mouse up. Send the latest point in the geometry to the control. Return determines whether to propagate the event on the map.

#### Parameters

evt | {Event} The browser event

#### Returns

{Boolean} Allow event propagation

### dblclick

> dblclick: function( | evt | )

Handle double-clicks. Finish the geometry and send it back to the control.

#### Parameters

evt | {Event} The browser event

#### Returns

{Boolean} Allow event propagation

Vector features use the OpenLayers.Geometry classes as geometry description.

> createFeature: function()

Add temporary geometries

> destroyFeature: function()

Destroy temporary geometries

> destroyPoint: function()

Destroy the temporary point.

> addPoint: function()

Add point to geometry.

> freehandMode: function( | evt | )

Determine whether to behave in freehand mode or not.

> modifyFeature: function()

Modify the existing geometry given the new point

> drawFeature: function()

Render geometries on the temporary layer.

> getGeometry: function()

Return the sketch geometry.

> mousedown: function( | evt | )

Handle mouse down.

> mousemove: function ( | evt | )

Handle mouse move.

> mouseup: function ( | evt | )

Handle mouse up.

> dblclick: function( | evt | )

Handle double-clicks.
Handler to draw a point on the map.
Controls affect the display or behavior of the map.
A LineString is a Curve which, once two points have been added to it, can never be less than two points long.
Close