Namespace: topology

lux.topology

Topology helpers exposed on lux.topology.

Properties:
Name Type Description
propagateSharedVertices function

Propagate moved shared vertices to neighbours.

findTopologicalNeighbours function

Find adjacent features.

createSelectInteraction function

Create a topology-aware select interaction.

createSnapInteraction function

Create a snap interaction and add it to the map.

createTopologicalModifyInteraction function

Create a topology-propagating modify interaction.

createFreeModifyInteraction function

Create a modify interaction that only reports overlaps.

createStrictModifyInteraction function

Create a modify interaction that rolls back overlaps.

createDrawInteraction function

Create a draw interaction and add it to the map.

splitFeatureWithLine function

Split a polygon with a line.

insertHole function

Insert a hole into a polygon feature.

mergeFeatures function

Merge several features into one.

computeGeomDiff function

Compare two geometries and return diff metrics.

validateGeometry function

Validate a geometry and optionally compute a fix.

getAllCoords function

Flatten geometry coordinates.

vertexKey function

Build a rounded vertex key.

checkOverlapsNeighboursDetailed function

Check overlaps with diagnostics.

Source:

Methods

(static) lux.topology.createDrawInteraction(map, source, opt_optionsopt) → {ol.interaction.Draw}

Create an ol/interaction/Draw and add it to the map.

Parameters:
Name Type Description
map ol.Map
source ol.source.Vector

Target source for drawn features.

options

Passed through to ol/interaction/Draw. type defaults to 'Polygon'.

Name Type Description
onDrawStart function | undefined

Called with { feature }.

onDrawEnd function | undefined

Called with { feature }.

Source:
Returns:
Type
ol.interaction.Draw

(static) lux.topology.createFreeModifyInteraction(map, editableFeatures, allFeatures, opt_optionsopt) → {ol.interaction.Modify}

Create an ol/interaction/Modify in free mode: overlaps are detected after each modification but the edit is always accepted.

Parameters:
Name Type Description
map ol.Map
editableFeatures Array.<ol.Feature>
allFeatures Array.<ol.Feature>
options
Name Type Description
pixelTolerance number | undefined
overlapAreaThreshold number | undefined

Default 0.01.

preModifyCoordsProperty string | undefined
preModifyRingsProperty string | undefined
overlapState string | undefined

State set on overlapping neighbours. Default 'overlap'.

stateProperty string | undefined
onModifyStart function | undefined
onModifyEnd function | undefined

Called with { features, overlaps }.

Source:
Returns:
Type
ol.interaction.Modify

(static) lux.topology.createSelectInteraction(map, layer, allFeatures, opt_optionsopt) → {ol.interaction.Select}

Create an ol/interaction/Select wired with topological neighbour detection.

After each selection the onSelect callback is called with: { selected, neighbours, allFeatures }

Parameters:
Name Type Description
map ol.Map
layer ol.layer.Vector

Layer to restrict selection to.

allFeatures Array.<ol.Feature>

Full feature list used for neighbour search.

options
Name Type Description
stateProperty string | undefined

Default '_selectionState'.

selectedState string | undefined

Default 'selected'.

neighbourState string | undefined

Default 'neighbour'.

normalState string | undefined

Default 'normal'.

vertexPrecision number | undefined

Default DEFAULT_VERTEX_PRECISION.

onSelect function | undefined

Callback after selection.

Source:
Returns:
Type
ol.interaction.Select

(static) lux.topology.createSnapInteraction(map, source, opt_optionsopt) → {ol.interaction.Snap}

Create an ol/interaction/Snap and add it to the map.

Parameters:
Name Type Description
map ol.Map
source ol.source.Vector
options Object | undefined

Passed through to ol/interaction/Snap.

Source:
Returns:
Type
ol.interaction.Snap

(static) lux.topology.createStrictModifyInteraction(map, editableFeatures, allFeatures, opt_optionsopt) → {ol.interaction.Modify}

Create an ol/interaction/Modify in strict mode: the edit is rolled back when an overlap is detected.

Parameters:
Name Type Description
map ol.Map
editableFeatures Array.<ol.Feature>
allFeatures Array.<ol.Feature>
options
Name Type Description
pixelTolerance number | undefined
overlapAreaThreshold number | undefined
preModifyCoordsProperty string | undefined
preModifyRingsProperty string | undefined
onModifyStart function | undefined
onModifyEnd function | undefined

Called with { features, accepted, overlaps }.

Source:
Returns:
Type
ol.interaction.Modify

(static) lux.topology.createTopologicalModifyInteraction(map, editableFeatures, allFeatures, opt_optionsopt) → {ol.interaction.Modify}

Create an ol/interaction/Modify in topological mode: shared vertices are automatically propagated to neighbours after each modification.

Parameters:
Name Type Description
map ol.Map
editableFeatures Array.<ol.Feature>

Features to make editable.

allFeatures Array.<ol.Feature>

Full list used for propagation.

options
Name Type Description
pixelTolerance number | undefined
vertexPrecision number | undefined
preModifyCoordsProperty string | undefined

Default '_preModifyCoords'.

onModifyStart function | undefined

Called with { features }.

onModifyEnd function | undefined

Called with { features, changed }.

Source:
Returns:
Type
ol.interaction.Modify

(static) lux.topology.insertHole(parser, feature, holePolygonGeom, opt_optionsopt) → {boolean}

Insert a hole into a Polygon or MultiPolygon feature.

Parameters:
Name Type Description
parser jsts.io.OL3Parser

JSTS parser.

feature ol.Feature

Target feature.

holePolygonGeom ol.geom.Polygon

Drawn hole polygon.

options

Options.

Name Type Description
coverRatioMin number | undefined

Minimum covered ratio required.

Source:
Returns:

True when hole has been inserted.

Type
boolean

(static) lux.topology.mergeFeatures(parser, selectedFeatures, opt_optionsopt) → {Object}

Merge selected features into the first one.

Parameters:
Name Type Description
parser jsts.io.OL3Parser

JSTS parser.

selectedFeatures Array.<ol.Feature>

Features to merge.

options

Options.

Name Type Description
originalGeomProperty string | undefined

Property name for original geometry snapshot.

surfaceProperty string | undefined

Surface property name.

Source:
Returns:

Result object.

Type
Object

(static) lux.topology.splitFeatureWithLine(parser, feature, splitLineGeom, opt_optionsopt) → {Object}

Split a polygon feature with a line using JSTS polygonizer.

Parameters:
Name Type Description
parser jsts.io.OL3Parser

JSTS parser.

feature ol.Feature

Feature to split.

splitLineGeom ol.geom.LineString

Splitting line.

options

Options.

Name Type Description
originalGeomProperty string | undefined

Property name for original geometry snapshot.

surfaceProperty string | undefined

Surface property name.

idProperty string | undefined

Identifier property name.

selectionStateProperty string | undefined

State property name.

defaultSelectionState string | undefined

Default state value.

generateId function

ID generator for new split features.

Source:
Returns:

Result.

Type
Object