Hierarchy (View Summary)

Constructors

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

    Parameters

    Returns Handler.Polygon

Properties

active: boolean

Property: active {Boolean}

citeCompliant: boolean

APIProperty: 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.

CLASS_NAME: string
control: Control

APIProperty: control {<OpenLayers.Control>}. The control that initialized this handler. The control is assumed to have a valid map property - that map is used in the handler's own setMap method.

evt: null | Event

Property: evt {Event} This property references the last event handled by the handler. Note that this property is not part of the stable API. Use of the evt property should be restricted to controls in the library or other applications that are willing to update with changes to the OpenLayers code.

id: string

Property: id {String}

keyMask: number

APIProperty: keyMask {Integer} Use bitwise operators and one or more of the OpenLayers.Handler constants to construct a keyMask. The keyMask is used by . If the keyMask matches the combination of keys down on an event, checkModifiers returns true.

Example: (code) // handler only responds if the Shift key is down handler.keyMask = OpenLayers.Handler.MOD_SHIFT;

// handler only responds if Ctrl-Shift is down
handler.keyMask = OpenLayers.Handler.MOD_SHIFT |
                  OpenLayers.Handler.MOD_CTRL;

(end)

lastDown: null | Pixel

Property: lastDown {<OpenLayers.Pixel>} Location of the last mouse down

lastTouchPx: null | Pixel

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

lastUp: null | Pixel

Property: lastUp {<OpenLayers.Pixel>}

layer: null | Layer.Vector

Property: layer {<OpenLayers.Layer.Vector>} The temporary drawing layer

layerOptions: {}

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

map: Map

Property: map {<OpenLayers.Map>}

mouseDown: boolean

Property: mouseDown {Boolean} The mouse is down

multi: boolean

APIProperty: multi {Boolean} Cast features to multi-part geometries before passing to the layer. Default is false.

persist: boolean

APIProperty: 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.

pixelTolerance: number

APIProperty: 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.

point: null | Vector<Geometry>

Property: point {<OpenLayers.Feature.Vector>} The currently drawn point

stopDown: boolean

APIProperty: stopDown {Boolean} Stop event propagation on mousedown. Must be false to allow "pan while drawing". Defaults to false.

stoppedDown: boolean

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

stopUp: boolean

APIPropery: stopUp {Boolean} Stop event propagation on mouse. Must be false to allow "pan while dragging". Defaults to fase.

touch: boolean

Property: touch {Boolean} Indicates the support of touch events. When touch events are started touch will be true and all mouse related listeners will do nothing.

Methods

  • APIMethod: activate turn on the handler

    Returns boolean

  • Method: callback Trigger the control's named callback with the given arguments

    Parameters: name - {String} The key for the callback that is one of the properties of the handler's callbacks object. args - {Array(*)} An array of arguments (any type) with which to call the callback (defined by the control).

    Parameters

    • name: string
    • args: any[]

    Returns void

  • APIMethod: cancel Finish the geometry and call the "cancel" callback.

    Returns void

  • Method: checkModifiers Check the keyMask on the handler. If no is set, this always returns true. If a is set and it matches the combination of keys down on an event, this returns true.

    Returns: {Boolean} The keyMask matches the keys down on an event.

    Parameters

    Returns boolean

  • Method: click 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

    Parameters

    Returns boolean

  • Method: createFeature Add temporary features

    Parameters: pixel - {<OpenLayers.Pixel>} A pixel location on the map.

    Parameters

    Returns void

  • Method: dblclick 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

    Parameters

    Returns boolean

  • APIMethod: deactivate turn off the handler

    Returns boolean

  • Method: destroy Deconstruct the handler.

    Returns void

  • Method: destroyFeature Destroy the temporary geometries

    Parameters: force - {Boolean} Destroy even if persist is true.

    Parameters

    • force: boolean

    Returns void

  • Method: destroyPersistedFeature Destroy the persisted feature.

    Returns void

  • Method: down 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

    Parameters

    Returns boolean

  • Method: drawFeature Render features on the temporary layer.

    Returns void

  • Method: finalize Finish the geometry and call the "done" callback.

    Parameters: cancel - {Boolean} Call cancel instead of done callback. Default is false.

    Parameters

    • cancel: boolean

    Returns void

  • Method: geometryClone Return a clone of the relevant geometry.

    Returns: {<OpenLayers.Geometry>}

    Returns null | Point

  • Method: getGeometry Return the sketch geometry. If is true, this will return a multi-part geometry.

    Returns: {<OpenLayers.Geometry.Polygon>}

    Returns Polygon

  • Method: modifyFeature Modify the existing geometry given a pixel location.

    Parameters: pixel - {<OpenLayers.Pixel>} A pixel location on the map.

    Parameters

    Returns void

  • Method: mousedown Handle mousedown.

    Parameters: evt - {Event} The browser event

    Returns: {Boolean} Allow event propagation

    Parameters

    Returns boolean

  • Method: mousemove Handle mousemove.

    Parameters: evt - {Event} The browser event

    Returns: {Boolean} Allow event propagation

    Parameters

    Returns boolean

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

    Parameters: evt - {Event} The browser event

    Parameters

    Returns void

  • Method: mouseup Handle mouseup.

    Parameters: evt - {Event} The browser event

    Returns: {Boolean} Allow event propagation

    Parameters

    Returns boolean

  • Method: move 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

    Parameters

    Returns boolean

  • Method: passesTolerance Determine whether the event is within the optional pixel tolerance.

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

    Parameters

    Returns boolean

  • Method: register register an event on the map

    Parameters

    • name: string
    • method: Function

    Returns void

  • Method: setEvent With each registered browser event, the handler sets its own evt property. This property can be accessed by controls if needed to get more information about the event that the handler is processing.

    This allows modifier keys on the event to be checked (alt, shift, ctrl, and meta cannot be checked with the keyboard handler). For a control to determine which modifier keys are associated with the event that a handler is currently processing, it should access (code)handler.evt.altKey || handler.evt.shiftKey || handler.evt.ctrlKey || handler.evt.metaKey(end).

    Parameters: evt - {Event} The browser event.

    Parameters

    Returns boolean

  • Method: setMap

    Parameters

    Returns void

  • Method: startTouch Start touch events, this method must be called by subclasses in "touchstart" method. When touch events are started will be true and all mouse related listeners will do nothing.

    Returns void

  • Method: touchend Handle touchend.

    Parameters: evt - {Event} The browser event

    Returns: {Boolean} Allow event propagation

    Parameters

    Returns boolean

  • Method: touchmove Handle touchmove.

    Parameters: evt - {Event} The browser event

    Returns: {Boolean} Allow event propagation

    Parameters

    Returns boolean

  • Method: touchstart Handle touchstart.

    Parameters: evt - {Event} The browser event

    Returns: {Boolean} Allow event propagation

    Parameters

    Returns boolean

  • Method: unregister unregister an event from the map

    Parameters

    • name: string
    • method: Function

    Returns void

  • Method: up 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

    Parameters

    Returns boolean