Handler to draw a regular polygon on the map. Polygon is displayed on mouse down, moves or is modified on mouse move, and is finished on mouse up. The handler triggers callbacks for ‘done’ and ‘cancel’. Create a new instance with the OpenLayers.Handler.RegularPolygon constructor.
OpenLayers. | Handler to draw a regular polygon on the map. |
Properties | |
sides | {Integer} Number of sides for the regular polygon. |
radius | {Float} Optional radius in map units of the regular polygon. |
snapAngle | {Float} If set to a non-zero value, the handler will snap the polygon rotation to multiples of the snapAngle. |
snapToggle | {String} If set, snapToggle is checked on mouse events and will set the snap mode to the opposite of what it currently is. |
persist | {Boolean} Leave the feature rendered until clear is called. |
irregular | {Boolean} Draw an irregular polygon instead of a regular polygon. |
Constructor | |
OpenLayers. | Create a new regular polygon handler. |
Functions | |
setOptions | |
activate | Turn on the handler. |
deactivate | Turn off the handler. |
cancel | Finish the geometry and call the “cancel” callback. |
clear | Clear any rendered features on the temporary layer. |
{String} If set, snapToggle is checked on mouse events and will set the snap mode to the opposite of what it currently is. To disallow toggling between snap and non-snap mode, set freehandToggle to null. Acceptable toggle values are ‘shiftKey’, ‘ctrlKey’, and ‘altKey’. Snap mode is only possible if this.snapAngle is set to a non-zero value.
{Boolean} Draw an irregular polygon instead of a regular polygon. Default is false. If true, the initial mouse down will represent one corner of the polygon bounds and with each mouse movement, the polygon will be stretched so the opposite corner of its bounds follows the mouse position. This property takes precedence over the radius property. If set to true, the radius property will be ignored.
Create a new regular polygon 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 object with properties to be set on the handler. If the options.sides property is not specified, the number of sides will default to 4. |
create | Called when a sketch is first created. Callback called with the creation point geometry and sketch feature. |
done | Called when the sketch drawing is finished. The callback will recieve a single argument, the sketch geometry. |
cancel | Called when the handler is deactivated while drawing. The cancel callback will receive a geometry. |
setOptions: function ( newOptions )
Turn on the handler.
activate: function()
Turn off the handler.
deactivate: function()
Finish the geometry and call the “cancel” callback.
cancel: function()
Clear any rendered features on the temporary layer.
clear: function()