Class: DrawRegular

ol.interaction. DrawRegular

Interaction rotate


new DrawRegular(options)

Parameters:
Name Type Description
options olx.interaction.TransformOptions
Properties
Name Type Argument Default Description
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

condition ol.events.ConditionType | undefined

A function that takes an ol.MapBrowserEvent and returns a boolean that event should be handled. By default module:ol/events/condition.always.

squareCondition ol.events.ConditionType | undefined

A function that takes an ol.MapBrowserEvent and returns a boolean to draw square features. Default test shift key

centerCondition ol.events.ConditionType | undefined

A function that takes an ol.MapBrowserEvent and returns a boolean to draw centered features. Default check Ctrl key

canRotate bool

Allow rotation when centered + square, default: true

geometryName string <optional>
geometry
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