Handler to draw a path on the map. Path is displayed on mouse down, moves on mouse move, and is finished on mouse up.
OpenLayers. | 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. | Create a new path hander |
Functions | |
createFeature | Add temporary geometries |
destroyFeature | Destroy temporary geometries |
removePoint | 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. |
getSketch | Return the sketch feature. |
getGeometry | Return the sketch geometry. |
mousedown | Handle mouse down. |
mousemove | Handle mouse move. |
mouseup | Handle mouse up. |
dblclick | Handle double-clicks. |
Create a new path hander
control | {OpenLayers.Control} The control that owns this handler |
callbacks | {Object} An object with a properties whose values are functions. Various callbacks described below. |
options | {Object} An optional object with properties to be set on the handler |
create | Called when a sketch is first created. Callback called with the creation point geometry and sketch feature. |
modify | Called with each move of a vertex with the vertex (point) geometry and the sketch feature. |
point | Called as each point is added. Receives the new point geometry. |
done | Called when the point drawing is finished. The callback will recieve a single argument, the linestring geometry. |
cancel | Called when the handler is deactivated while drawing. The cancel callback will receive a geometry. |
createFeature: function( pixel )
Add temporary geometries
pixel | {OpenLayers.Pixel} The initial pixel location for the new feature. |
addPoint: function( pixel )
Add point to geometry. Send the point index to override the behavior of LinearRing that disregards adding duplicate points.
pixel | {OpenLayers.Pixel} The pixel location for the new point. |
modifyFeature: function( pixel )
Modify the existing geometry given the new point
pixel | {OpenLayers.Pixel} The updated pixel location for the latest point. |
Add temporary geometries
createFeature: function( pixel )
Destroy temporary geometries
destroyFeature: function()
Destroy the temporary point.
removePoint: function()
Add point to geometry.
addPoint: function( pixel )
Determine whether to behave in freehand mode or not.
freehandMode: function( evt )
Modify the existing geometry given the new point
modifyFeature: function( pixel )
Render geometries on the temporary layer.
drawFeature: function()
Return the sketch feature.
getSketch: function()
Return the sketch geometry.
getGeometry: function()
Handle mouse down.
mousedown: function( evt )
Handle mouse move.
mousemove: function ( evt )
Handle mouse up.
mouseup: function ( evt )
Handle double-clicks.
dblclick: function( evt )