Handler to draw a point on the map. Point is displayed on mouse down, moves on mouse move, and is finished on mouse up. The handler triggers callbacks for ‘done’, ‘cancel’, and ‘modify’. The modify callback is called with each change in the sketch and will receive the latest point drawn. Create a new instance with the OpenLayers.Handler.Point constructor.
OpenLayers. | Handler to draw a point on the map. |
Properties | |
point | {OpenLayers.Feature.Vector} The currently drawn point |
layer | {OpenLayers.Layer.Vector} The temporary drawing layer |
multi | {Boolean} Cast features to multi-part geometries before passing to the layer. |
drawing | {Boolean} A point is being drawn |
mouseDown | {Boolean} The mouse is down |
lastDown | {OpenLayers.Pixel} Location of the last mouse down |
lastUp | {OpenLayers.Pixel} |
persist | {Boolean} Leave the feature rendered until destroyFeature is called. |
layerOptions | {Object} Any optional properties to be set on the sketch layer. |
Constructor | |
OpenLayers. | Create a new point handler. |
Functions | |
activate | turn on the handler |
createFeature | Add temporary features |
deactivate | turn off the handler |
destroyFeature | Destroy the temporary geometries |
finalize | Finish the geometry and call the “done” callback. |
cancel | Finish the geometry and call the “cancel” callback. |
click | Handle clicks. |
dblclick | Handle double-clicks. |
modifyFeature | Modify the existing geometry given a pixel location. |
drawFeature | Render features on the temporary layer. |
getGeometry | Return the sketch geometry. |
geometryClone | Return a clone of the relevant geometry. |
mousedown | Handle mouse down. |
mousemove | Handle mouse move. |
mouseup | Handle mouse up. |
{OpenLayers.Feature.Vector} The currently drawn point
{OpenLayers.Layer.Vector} The temporary drawing layer
{OpenLayers.Pixel} Location of the last mouse down
Create a new point handler.
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. |
done | Called when the point drawing is finished. The callback will recieve a single argument, the point geometry. |
cancel | Called when the handler is deactivated while drawing. The cancel callback will receive a geometry. |
createFeature: function( pixel )
Add temporary features
pixel | {OpenLayers.Pixel} A pixel location on the map. |
modifyFeature: function( pixel )
Modify the existing geometry given a pixel location.
pixel | {OpenLayers.Pixel} A pixel location on the map. |
getGeometry: function()
Return the sketch geometry. If multi is true, this will return a multi-part geometry.
turn on the handler
activate: function()
Add temporary features
createFeature: function( pixel )
turn off the handler
deactivate: function()
Destroy the temporary geometries
destroyFeature: function()
Finish the geometry and call the “done” callback.
finalize: function( cancel )
Finish the geometry and call the “cancel” callback.
cancel: function()
Handle clicks.
click: function( evt )
Handle double-clicks.
dblclick: function( evt )
Modify the existing geometry given a pixel location.
modifyFeature: function( pixel )
Render features on the temporary layer.
drawFeature: function()
Return the sketch geometry.
getGeometry: function()
Return a clone of the relevant geometry.
geometryClone: function()
Handle mouse down.
mousedown: function( evt )
Handle mouse move.
mousemove: function ( evt )
Handle mouse up.
mouseup: function ( evt )