feat: close four-arm divided junction cores
This commit is contained in:
1 parent
6cfcd5d4b2
commit
eaafcd85da
1 file changed
+13
-4
@@ -218,11 +218,20 @@ function coordinateDistanceMeters(first, second) {
|
|||||||
// source carriageway. Its shared entry seams are the sections' `inner` edges;
|
// source carriageway. Its shared entry seams are the sections' `inner` edges;
|
||||||
// every remaining edge is an explicit closure between adjacent arms.
|
// every remaining edge is an explicit closure between adjacent arms.
|
||||||
function buildCoreClosure(topology, graph, center) {
|
function buildCoreClosure(topology, graph, center) {
|
||||||
if (topology.arms.some((arm) => arm.members.length !== 1))
|
let coreSections = graph.sections;
|
||||||
return { status: 'unsupported', reason: 'parallel-carriageway-closure-unresolved' };
|
if (topology.arms.some((arm) => arm.members.length !== 1)) {
|
||||||
if (graph.sections.length < 3 || graph.sections.length > 6)
|
if (topology.arms.length !== 4) return { status: 'unsupported', reason: 'parallel-carriageway-closure-unresolved' };
|
||||||
|
coreSections = topology.arms.map((arm) =>
|
||||||
|
graph.sections
|
||||||
|
.filter((section) => section.armKey === arm.key && section.ringStatus === 'supported')
|
||||||
|
.sort((a, b) => a.carriagewayKey.localeCompare(b.carriagewayKey))[0],
|
||||||
|
);
|
||||||
|
if (coreSections.some((section) => !section))
|
||||||
|
return { status: 'unsupported', reason: 'parallel-carriageway-closure-unresolved' };
|
||||||
|
}
|
||||||
|
if (coreSections.length < 3 || coreSections.length > 6)
|
||||||
return { status: 'unsupported', reason: 'unsupported-arm-count' };
|
return { status: 'unsupported', reason: 'unsupported-arm-count' };
|
||||||
const points = graph.sections
|
const points = coreSections
|
||||||
.flatMap((section) => [
|
.flatMap((section) => [
|
||||||
{ point: section.inner.left, edgeRef: section.edgeRefs.inner },
|
{ point: section.inner.left, edgeRef: section.edgeRefs.inner },
|
||||||
{ point: section.inner.right, edgeRef: section.edgeRefs.inner },
|
{ point: section.inner.right, edgeRef: section.edgeRefs.inner },
|
||||||
|
|||||||
Reference in new issue
Block a user