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
|
||||||||||
- 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 |
|
||||||||||||||||||||||||||||
- Source:
Returns:
(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 |
|
||||||||||||||||||||||
- Source:
Returns:
(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 |
- 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 |
|
||||||||||||||||||||||
- Source:
Returns:
(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 |
|
|||||||||||||||||||
- Source:
Returns:
(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.
|
|||||||
- 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.
|
||||||||||
- 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.
|
||||||||||||||||||||||
- Source:
Returns:
Result.
- Type
- Object