new DrawRegular(options, source, features, style, sides, squareCondition, centerCondition, canRotate, clickTolerance, maxCircleCoordinates)
Interaction rotate
Parameters:
Name | Type | Description |
---|---|---|
options |
olx.interaction.TransformOptions | |
source |
Array.<ol.Layer> | Destination source for the drawn features |
features |
ol.Collection.<ol.Feature> | Destination collection for the drawn features |
style |
ol.style.Style | Array.<ol.style.Style> | ol.style.StyleFunction | undefined | style for the sketch |
sides |
integer | number of sides, default 0 = circle |
squareCondition |
ol.events.ConditionType | undefined | A function that takes an ol.MapBrowserEvent and returns a boolean to draw square features. |
centerCondition |
ol.events.ConditionType | undefined | A function that takes an ol.MapBrowserEvent and returns a boolean to draw centered features. |
canRotate |
bool | Allow rotation when centered + square, default: true |
clickTolerance |
number | click tolerance on touch devices, default: 6 |
maxCircleCoordinates |
number | Maximum number of point on a circle, default: 100 |
Fires:
- drawstart, drawing, drawend,event: drawcancel
Extends
- ol.interaction.Interaction
Members
-
startAngle
-
Default start angle array for each sides
Methods
-
canRotate(b)
-
Allow rotation when centered + square
Parameters:
Name Type Description b
bool -
drawPoint_()
-
Draw sketch (Point)
-
drawSketch_()
-
Draw sketch
Returns:
The feature being drawn.
- Type
- ol.Feature
-
end_(evt)
-
End drawing
Parameters:
Name Type Description evt
ol.MapBrowserEvent Map browser event.
Returns:
false
to stop the drag sequence.- Type
- boolean
-
finishDrawing()
-
Stop drawing.
-
getGeom_()
-
Get geom of the current drawing
Returns:
- Type
- ol.geom.Polygon | ol.geom.Point
-
getSides()
-
Get the number of sides.
Returns:
number of sides.
- Type
- int
-
handleEvent_(evt)
-
Parameters:
Name Type Description evt
ol.MapBrowserEvent Map browser event.
-
handleMoveEvent_(evt)
-
Parameters:
Name Type Description evt
ol.MapBrowserEvent Event.
-
reset()
-
Reset the interaction
-
setActive(b)
-
Activate/deactivate the interaction
Parameters:
Name Type Description b
boolean -
setMap(map)
-
Remove the interaction from its current map, if any, and attach it to a new map, if any. Pass
null
to just remove the interaction from the current map.Parameters:
Name Type Description map
ol.Map Map.
-
setSides(number)
-
Set the number of sides.
Parameters:
Name Type Description number
int of sides.
-
start_(evt)
-
Start an new draw
Parameters:
Name Type Description evt
ol.MapBrowserEvent Map browser event.
Returns:
false
to stop the drag sequence.- Type
- boolean