Acts as a split feature agent while editing vector features.
OpenLayers. | Acts as a split feature agent while editing vector features. |
Properties | |
source | {<OpenLayers.Layer.Vector>} Optional source layer. |
sourceOptions | {Options} If a temporary sketch layer is created, these layer options will be applied. |
handler | {<OpenLayers.Handler.Path>} The temporary sketch handler created if no source layer is provided. |
Functions | |
OpenLayers. | Creates a new split control. |
onSketchComplete | Registered as a listener for the sketchcomplete event on the editable layer. |
afterFeatureModified | Registered as a listener for the afterfeaturemodified event on the editable layer. |
removeByGeometry | Remove a feature from a list based on the given geometry. |
isEligible | Test if a target feature is eligible for splitting. |
considerSplit | Decide whether or not to split target features with the supplied feature. |
geomsToFeatures | Create new features given a template feature and a list of geometries. |
destroy | Clean up the control. |
Creates a new split control. A control is constructed with a target layer and an optional source layer. While the control is active, creating new features or modifying existing features on the source layer will result in splitting any eligible features on the target layer. If no source layer is provided, a temporary sketch layer will be created to create lines for splitting features on the target.
options | {Object} An object containing all configuration properties for the control. |
layer | {OpenLayers.Layer.Vector} The target layer. Features from this layer will be split by new or modified features on the source layer or temporary sketch layer. |
source | {OpenLayers.Layer.Vector} Optional source layer. If provided newly created features or modified features will be used to split features on the target layer. If not provided, a temporary sketch layer will be created for drawing lines. |
tolerance | {Number} Optional value for the distance between a source vertex and the calculated intersection below which the split will occur at the vertex. |
edge | {Boolean} Allow splits given intersection of edges only. Default is true. If false, a vertex on the source must be within the <tolerance> distance of the calculated intersection for a split to occur. |
mutual | {Boolean} If source and target are the same, split source features and target features where they intersect. Default is true. If false, only target features will be split. |
targetFilter | {OpenLayers.Filter} Optional filter that will be evaluated to determine if a feature from the target layer is eligible for splitting. |
sourceFilter | {OpenLayers.Filter} Optional filter that will be evaluated to determine if a feature from the target layer is eligible for splitting. |
considerSplit: function( feature )
Decide whether or not to split target features with the supplied feature. If <mutual> is true, both the source and target features will be split if eligible.
feature | {<OpenLayers.Feature.Vector>} The newly created or modified feature. |
{Boolean} The supplied feature was split (and destroyed).
geomsToFeatures: function( feature, geoms )
Create new features given a template feature and a list of geometries. The list of geometries is modified in place. The result will be a list of new features.
feature | {<OpenLayers.Feature.Vector>} The feature to be cloned. |
geoms | {Array(<OpenLayers.Geometry>)} List of goemetries. This will become a list of new features. |
Registered as a listener for the sketchcomplete event on the editable layer.
onSketchComplete: function( event )
Registered as a listener for the afterfeaturemodified event on the editable layer.
afterFeatureModified: function( event )
Remove a feature from a list based on the given geometry.
removeByGeometry: function( features, geometry )
Test if a target feature is eligible for splitting.
isEligible: function( target )
Decide whether or not to split target features with the supplied feature.
considerSplit: function( feature )
Create new features given a template feature and a list of geometries.
geomsToFeatures: function( feature, geoms )
Clean up the control.
destroy: function()