Handler to draw a polygon on the map. Polygon is displayed on mouse down, moves on mouse move, and is finished on mouse up. Modified to use ALKPath handler.
ALKMaps. | Handler to draw a polygon on the map. |
Properties | |
holeModifier | {String} Key modifier to trigger hole digitizing. |
drawingHole | {Boolean} Currently drawing an interior ring. |
polygon | {ALKMaps.Feature.Vector} |
Constructor | |
ALKMaps. | Create a Polygon Handler. |
Functions | |
createFeature | Add temporary geometries |
addPoint | Add point to geometry. |
getCurrentPointIndex | {Number} The index of the most recently drawn point. |
enforceTopology | Simple topology enforcement for drawing interior rings. |
finishGeometry | Finish the geometry and send it back to the control. |
finalizeInteriorRing | Enforces that new ring has some area and doesn’t contain vertices of any other rings. |
cancel | Finish the geometry and call the “cancel” callback. |
restoreFeature | Move the feature from the sketch layer to the target layer. |
destroyFeature | Destroy temporary geometries |
drawFeature | Render geometries on the temporary layer. |
getSketch | Return the sketch feature. |
getGeometry | Return the sketch geometry. |
Create a Polygon Handler.
control | {ALKMaps.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 receive a single argument, the polygon geometry. |
cancel | Called when the handler is deactivated while drawing. The cancel callback will receive a geometry. |
createFeature: function( pixel )
Add temporary geometries
pixel | {ALKMaps.Pixel} The initial pixel location for the new feature. |
addPoint: function( pixel )
Add point to geometry.
pixel | {ALKMaps.Pixel} The pixel location for the new point. |
enforceTopology: function( event )
Simple topology enforcement for drawing interior rings. Ensures vertices of interior rings are contained by exterior ring. Other topology rules are enforced in finalizeInteriorRing to allow drawing of rings that intersect only during the sketch (e.g. a “C” shaped ring that nearly encloses another ring).
Add temporary geometries
createFeature: function( pixel )
Add point to geometry.
addPoint: function( pixel )
{Number} The index of the most recently drawn point.
getCurrentPointIndex: function()
Simple topology enforcement for drawing interior rings.
enforceTopology: function( event )
Finish the geometry and send it back to the control.
finishGeometry: function()
Enforces that new ring has some area and doesn’t contain vertices of any other rings.
finalizeInteriorRing: function()
Finish the geometry and call the “cancel” callback.
cancel: function()
Move the feature from the sketch layer to the target layer.
restoreFeature: function( cancel )
Destroy temporary geometries
destroyFeature: function( force )
Render geometries on the temporary layer.
drawFeature: function()
Return the sketch feature.
getSketch: function()
Return the sketch geometry.
getGeometry: function()