Class: DrawHole

ol.interaction. DrawHole

Interaction to draw holes in a polygon. It fires a drawstart, drawend event when drawing the hole and a modifystart, modifyend event before and after inserting the hole in the feature geometry.


new DrawHole(options, Style)

Parameters:
Name Type Description
options olx.interaction.DrawHoleOptions

extend olx.interaction.DrawOptions

Properties
Name Type Description
layers Array.<ol.layer.Vector> | function | undefined

A list of layers from which polygons should be selected. Alternatively, a filter function can be provided. default: all visible layers

featureFilter Array.<ol.Feature> | ol.Collection.<ol.Feature> | function | undefined

An array or a collection of features the interaction applies on or a function that takes a feature and a layer and returns true if the feature is a candidate

Style ol.style.Style | Array.<ol.style.Style> | StyleFunction | undefined

for the selected features, default: default edit style

options.geometryFunction function | undefined

Draw interaction geometry function to customize the hole

Fires:
  • event:drawstart
  • event:drawend
  • event:modifystart
  • event:modifyend

Extends

  • ol.interaction.Interaction

Methods


getPolygon()

Get the current polygon to hole

Returns:
Type
ol.Feature

removeLastPoint()

Remove last point of the feature currently being drawn (test if points to remove before).


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.