Class: Split

ol.interaction. Split

Interaction split interaction for splitting feature geometry


new Split()

Parameters:
Name Type Argument Description
*
options.sources ol.source.Vector | Array.<ol.source.Vector> <optional>

a list of source to split (configured with useSpatialIndex set to true), if none use map visible layers.

options.features ol.Collection.<ol.Feature>

collection of feature to split (instead of a list of sources)

options.snapDistance integer

distance (in px) to snap to an object, default 25px

options.cursor string | undefined

cursor name to display when hovering an objet

options.filter function | undefined

a filter that takes a feature and return true if it can be clipped, default always split.

ol.style.Style

| Array<ol.style.Style> | false | undefined} options.featureStyle Style for the selected features, choose false if you don't want feature selection. By default the default edit style is used.

options.sketchStyle ol.style.Style | Array.<ol.style.Style> | undefined

Style for the sektch features.

options.tolerance function | undefined

Distance between the calculated intersection and a vertex on the source geometry below which the existing vertex will be used for the split. Default is 1e-10.

Fires:
  • beforesplit, aftersplit,event: pointermove

Extends

  • ol.interaction.Interaction

Methods


getNearestCoord(pt, coords)

Get nearest coordinate in a list

Parameters:
Name Type Description
pt ol.coordinate

the point to find nearest

coords Array.<ol.coordinate>

list of coordinates

Returns:

the nearest coordinate in the list

Type
ol.coordinate

getSources()

Get sources to split features in

Returns:
Type
Array.<ol.source.Vector>

handleDownEvent(evt)

Parameters:
Name Type Description
evt ol.MapBrowserEvent

Map browser event.

Returns:

true to start the drag sequence.

Type
boolean

handleMoveEvent(evt)

Parameters:
Name Type Description
evt ol.MapBrowserEvent

Event.


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.


setSources( [sources])

Set sources to split features in

Parameters:
Name Type Argument Description
sources ol.source.Vector | Array.<ol.source.Vector> | boolean <optional>

if not defined get all map vector sources