Class: Splitter

ol.interaction. Splitter


new Splitter(options)

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

Parameters:
Name Type Description
options olx.interaction.SplitOptions

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) - 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. - features {ol.Collection.<ol.Feature>} A collection of feature to be split (replace source target). - 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). - filter {function|undefined} a filter that takes a feature and return true if the feature is eligible for splitting, default always split. - 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_

onAddFeature()

New feature source is added


onChangeFeature()

Feature source is changing


onRemoveFeature()

Feature source is removed > count features added/removed


splitSource(feature)

Split the source using a feature

Parameters:
Name Type Description
feature ol.Feature

The feature to use to split.