Class: Splitter

ol.interaction. Splitter

Interaction splitter: acts as a split feature agent while editing vector features (LineString).


new Splitter()

Parameters:
Name Type Description
options
options.source ol.source.Vector | Array.<ol.source.Vector>

The target source (or array of source) with features to be split (configured with useSpatialIndex set to true)

options.triggerSource ol.source.Vector

Any newly created or modified features from this source will be used to split features on the target source. If none is provided the target source is used instead.

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

A collection of feature to be split (replace source target).

options.triggerFeatures ol.Collection.<ol.Feature>

Any newly created or modified features from this collection will be used to split features on the target source (replace triggerSource).

options.filter function | undefined

a filter that takes a feature and return true if the feature is eligible for splitting, default always split.

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.

To Do:
  • verify auto intersection on features that split.
Fires:
  • beforesplit,event: aftersplit

Extends

  • ol.interaction.Interaction

Methods


intersectSegs(s1, s2)

Calculate intersection on 2 segs

Parameters:
Name Type Description
s1 Array.<_ol_coordinate_>

first seg to intersect (2 points)

s2 Array.<_ol_coordinate_>

second seg to intersect (2 points)

Returns:

intersection point or false no intersection

Type
boolean | _ol_coordinate_