# OpenLayers.Handler.Point

Handler to draw a point on the map. Point is displayed on activation, 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.

#### Inherits from

- OpenLayers.Handler

Summary

OpenLayers.Handler.Point | 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.
citeCompliant | {Boolean} If set to true, coordinates of features drawn in a map extent crossing the date line won’t exceed the world bounds.
mouseDown | {Boolean} The mouse is down
stoppedDown | {Boolean} Indicate whether the last mousedown stopped the event propagation.
lastDown | {OpenLayers.Pixel} Location of the last mouse down
lastUp | {OpenLayers.Pixel}
persist | {Boolean} Leave the feature rendered until destroyFeature is called.
stopDown | {Boolean} Stop event propagation on mousedown.
layerOptions | {Object} Any optional properties to be set on the sketch layer.
pixelTolerance | {Number} Maximum number of pixels between down and up (mousedown and mouseup, or touchstart and touchend) for the handler to add a new point.
lastTouchPx | {OpenLayers.Pixel} The last pixel used to know the distance between two touches (for double touch).
Constructor |
OpenLayers.Handler.Point | 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
destroyPersistedFeature | Destroy the persisted feature.
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 mousedown.
touchstart | Handle touchstart.
mousemove | Handle mousemove.
touchmove | Handle touchmove.
mouseup | Handle mouseup.
touchend | Handle touchend.
down | Handle mousedown and touchstart.
move | Handle mousemove and touchmove.
up | Handle mouseup and touchend.
mouseout | Handle mouse out.
passesTolerance | Determine whether the event is within the optional pixel tolerance.

### 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. Default is false.

### citeCompliant

{Boolean} If set to true, coordinates of features drawn in a map extent crossing the date line won’t exceed the world bounds. Default is false.

### mouseDown

{Boolean} The mouse is down

### stoppedDown

{Boolean} Indicate whether the last mousedown stopped the event propagation.

### lastDown

{OpenLayers.Pixel} Location of the last mouse down

### lastUp

{OpenLayers.Pixel}

### persist

{Boolean} Leave the feature rendered until destroyFeature is called. Default is false. If set to true, the feature remains rendered until destroyFeature is called, typically by deactivating the handler or starting another drawing.

### stopDown

{Boolean} Stop event propagation on mousedown. Must be false to allow “pan while drawing”. Defaults to false.

### layerOptions

{Object} Any optional properties to be set on the sketch layer.

### pixelTolerance

{Number} Maximum number of pixels between down and up (mousedown and mouseup, or touchstart and touchend) for the handler to add a new point. If set to an integer value, if the displacement between down and up is great to this value no point will be added. Default value is 5.

### lastTouchPx

{OpenLayers.Pixel} The last pixel used to know the distance between two touches (for double touch).

### Constructor

### OpenLayers.Handler.Point

Create a new point handler.

#### Parameters

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

#### Named callbacks

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.

### Functions

### activate

> activate: function()

turn on the handler

### createFeature

> createFeature: function( | pixel | )

Add temporary features

#### Parameters

pixel | {OpenLayers.Pixel} A pixel location on the map.

### deactivate

> deactivate: function()

turn off the handler

### destroyFeature

> destroyFeature: function( | force | )

Destroy the temporary geometries

#### Parameters

force | {Boolean} Destroy even if persist is true.

### destroyPersistedFeature

> destroyPersistedFeature: function()

Destroy the persisted feature.

### finalize

> finalize: function( | cancel | )

Finish the geometry and call the “done” callback.

#### Parameters

cancel | {Boolean} Call cancel instead of done callback. Default is false.

### cancel

> cancel: function()

Finish the geometry and call the “cancel” callback.

### click

> click: function( | evt | )

Handle clicks. Clicks are stopped from propagating to other listeners on map.events or other dom elements.

#### Parameters

evt | {Event} The browser event

#### Returns

{Boolean} Allow event propagation

### dblclick

> dblclick: function( | evt | )

Handle double-clicks. Double-clicks are stopped from propagating to other listeners on map.events or other dom elements.

#### Parameters

evt | {Event} The browser event

#### Returns

{Boolean} Allow event propagation

### modifyFeature

> modifyFeature: function( | pixel | )

Modify the existing geometry given a pixel location.

#### Parameters

pixel | {OpenLayers.Pixel} A pixel location on the map.

### drawFeature

> drawFeature: function()

Render features 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.Point}

### geometryClone

> geometryClone: function()

Return a clone of the relevant geometry.

#### Returns

{OpenLayers.Geometry}

### mousedown

> mousedown: function( | evt | )

Handle mousedown.

#### Parameters

evt | {Event} The browser event

#### Returns

{Boolean} Allow event propagation

### touchstart

> touchstart: function( | evt | )

Handle touchstart.

#### Parameters

evt | {Event} The browser event

#### Returns

{Boolean} Allow event propagation

### mousemove

> mousemove: function( | evt | )

Handle mousemove.

#### Parameters

evt | {Event} The browser event

#### Returns

{Boolean} Allow event propagation

### touchmove

> touchmove: function( | evt | )

Handle touchmove.

#### Parameters

evt | {Event} The browser event

#### Returns

{Boolean} Allow event propagation

### mouseup

> mouseup: function( | evt | )

Handle mouseup.

#### Parameters

evt | {Event} The browser event

#### Returns

{Boolean} Allow event propagation

### touchend

> touchend: function( | evt | )

Handle touchend.

#### Parameters

evt | {Event} The browser event

#### Returns

{Boolean} Allow event propagation

### down

> down: function( | evt | )

Handle mousedown and touchstart. 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

### move

> move: function ( | evt | )

Handle mousemove and touchmove. 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

### up

> up: function ( | evt | )

Handle mouseup and touchend. 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

### mouseout

> mouseout: function( | evt | )

Handle mouse out. For better user experience reset mouseDown and stoppedDown when the mouse leaves the map viewport.

#### Parameters

evt | {Event} The browser event

### passesTolerance

> passesTolerance: function( | pixel1,
> | pixel2,
> | tolerance | )

Determine whether the event is within the optional pixel tolerance.

#### Returns

{Boolean} The event is within the pixel tolerance (if specified).

Vector features use the OpenLayers.Geometry classes as geometry description.
Instances of OpenLayers.Layer.Vector are used to render vector data from a variety of sources.
This class represents a screen coordinate, in x and y coordinates

> activate: function()

turn on the handler

> createFeature: function( | pixel | )

Add temporary features

> deactivate: function()

turn off the handler

> destroyFeature: function( | force | )

Destroy the temporary geometries

> destroyPersistedFeature: function()

Destroy the persisted feature.

> finalize: function( | cancel | )

Finish the geometry and call the “done” callback.

> cancel: function()

Finish the geometry and call the “cancel” callback.

> click: function( | evt | )

Handle clicks.

> dblclick: function( | evt | )

Handle double-clicks.

> modifyFeature: function( | pixel | )

Modify the existing geometry given a pixel location.

> drawFeature: function()

Render features on the temporary layer.

> getGeometry: function()

Return the sketch geometry.

> geometryClone: function()

Return a clone of the relevant geometry.

> mousedown: function( | evt | )

Handle mousedown.

> touchstart: function( | evt | )

Handle touchstart.

> mousemove: function( | evt | )

Handle mousemove.

> touchmove: function( | evt | )

Handle touchmove.

> mouseup: function( | evt | )

Handle mouseup.

> touchend: function( | evt | )

Handle touchend.

> down: function( | evt | )

Handle mousedown and touchstart.

> move: function ( | evt | )

Handle mousemove and touchmove.

> up: function ( | evt | )

Handle mouseup and touchend.

> mouseout: function( | evt | )

Handle mouse out.

> passesTolerance: function( | pixel1,
> | pixel2,
> | tolerance | )

Determine whether the event is within the optional pixel tolerance.
Create a new point handler.
Base class to construct a higher-level handler for event sequences.
Controls affect the display or behavior of the map.
{Boolean} Cast features to multi-part geometries before passing to the layer.
Point geometry class.
A Geometry is a description of a geographic object.
Close