OpenLayers.Handler.Polygon

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

Inherits from

Summary
OpenLayers.Handler.PolygonHandler to draw a polygon on the map.
Constructor
OpenLayers.Handler.PolygonCreate a Polygon Handler.
Functions
createFeatureAdd temporary geometries
destroyFeatureDestroy temporary geometries
drawFeatureRender geometries on the temporary layer.
getSketchReturn the sketch feature.
getGeometryReturn the sketch geometry.
dblclickHandle double-clicks.

Constructor

OpenLayers.Handler.Polygon

Create a Polygon 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

createCalled when a sketch is first created.  Callback called with the creation point geometry and sketch feature.
modifyCalled with each move of a vertex with the vertex (point) geometry and the sketch feature.
pointCalled as each point is added.  Receives the new point geometry.
doneCalled when the point drawing is finished.  The callback will recieve a single argument, the polygon geometry.
cancelCalled when the handler is deactivated while drawing.  The cancel callback will receive a geometry.

Functions

createFeature

createFeature: function(pixel)

Add temporary geometries

Parameters

pixel{OpenLayers.Pixel} The initial pixel location for the new feature.

destroyFeature

destroyFeature: function()

Destroy temporary geometries

drawFeature

drawFeature: function()

Render geometries on the temporary layer.

getSketch

getSketch: function()

Return the sketch feature.

Returns

{OpenLayers.Feature.Vector}

getGeometry

getGeometry: function()

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

Returns

{OpenLayers.Geometry.Polygon}

dblclick

dblclick: function(evt)

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

Parameters

evt{Event}
createFeature: function(pixel)
Add temporary geometries
destroyFeature: function()
Destroy temporary geometries
drawFeature: function()
Render geometries on the temporary layer.
getSketch: function()
Return the sketch feature.
getGeometry: function()
Return the sketch geometry.
dblclick: function(evt)
Handle double-clicks.
Handler to draw a path on the map.
Base class to construct a higher-level handler for event sequences.
Controls affect the display or behavior of the map.
This class represents a screen coordinate, in x and y coordinates
Vector features use the OpenLayers.Geometry classes as geometry description.
Polygon is a collection of Geometry.LinearRings.
Close