feat: preserve safe junction exclusion holes
This commit is contained in:
1 parent
c003edaf51
commit
609935d209
2 files changed
+11
-2
No files matched your search
@@ -528,7 +528,7 @@ function buildComplexJunctionGeometry(model, cluster, helpers) {
|
|||||||
closure_count: coreClosure.closureCount,
|
closure_count: coreClosure.closureCount,
|
||||||
provenance: 'native-road-complex-junction/v7-shared-entry-core',
|
provenance: 'native-road-complex-junction/v7-shared-entry-core',
|
||||||
},
|
},
|
||||||
geometry: { type: 'Polygon', coordinates: [coreRing] },
|
geometry: { type: 'Polygon', coordinates: [coreRing, ...(coreClosure.holes || [])] },
|
||||||
});
|
});
|
||||||
else {
|
else {
|
||||||
cornerDiagnostics.push(
|
cornerDiagnostics.push(
|
||||||
|
|||||||
@@ -239,7 +239,15 @@ function buildCoreClosure(topology, graph, center) {
|
|||||||
});
|
});
|
||||||
if (ring.length < 7 || hasZeroLengthEdge || !paired || Math.abs(signedArea(ring)) < 1e-14 || ringSelfIntersects(ring))
|
if (ring.length < 7 || hasZeroLengthEdge || !paired || Math.abs(signedArea(ring)) < 1e-14 || ringSelfIntersects(ring))
|
||||||
return { status: 'unsupported', reason: 'core-closure-invalid' };
|
return { status: 'unsupported', reason: 'core-closure-invalid' };
|
||||||
if (graph.exclusionRegions.some((region) => ringsOverlap(region.ring, ring)))
|
const holes = graph.exclusionRegions
|
||||||
|
.filter((region) => {
|
||||||
|
const boundaryIntersects = ringSelfIntersects([...region.ring]);
|
||||||
|
const contained = region.ring.slice(0, -1).every((point) => pointInRing(point, ring));
|
||||||
|
const clearOfEntries = graph.sections.every((section) => !ringsOverlap(region.ring, section.ring));
|
||||||
|
return region.isHole === true && !boundaryIntersects && contained && clearOfEntries;
|
||||||
|
})
|
||||||
|
.map((region) => region.ring);
|
||||||
|
if (graph.exclusionRegions.some((region) => ringsOverlap(region.ring, ring) && !holes.includes(region.ring)))
|
||||||
return { status: 'unsupported', reason: 'known-exclusion-region' };
|
return { status: 'unsupported', reason: 'known-exclusion-region' };
|
||||||
const seamErrors = graph.sections.map((section) => {
|
const seamErrors = graph.sections.map((section) => {
|
||||||
const leftIndex = ring.findIndex(
|
const leftIndex = ring.findIndex(
|
||||||
@@ -270,6 +278,7 @@ function buildCoreClosure(topology, graph, center) {
|
|||||||
return {
|
return {
|
||||||
status: 'supported',
|
status: 'supported',
|
||||||
ring,
|
ring,
|
||||||
|
holes,
|
||||||
sharedEdgeRefs: [...pairedEdges.keys()].sort(),
|
sharedEdgeRefs: [...pairedEdges.keys()].sort(),
|
||||||
closureCount: graph.sections.length,
|
closureCount: graph.sections.length,
|
||||||
maxSharedSeamErrorMeters: seamErrorMeters,
|
maxSharedSeamErrorMeters: seamErrorMeters,
|
||||||
|
|||||||
Reference in new issue
Block a user