fix: share complex junction entry sections across layers

This commit is contained in:
que01 committed 2026-09-09 17:23:17 +08:00
1 parent 49212b3f34
commit cd65dbe879
5 files changed
+221 -50

No files matched your search

+19 -10
View File
@@ -106,16 +106,9 @@ function buildComplexJunctionGeometry(model, cluster, helpers) {
(crossingPlans.get(arm.key)?.baseRadius || coreRadius * 0.68) +
(crossingControls.get(`crossing:${arm.key}`)?.crosswalkInsetMeters || 0),
);
const boundaryGraph = buildJunctionBoundaryGraph(
topology,
center,
{
outerRadiusFor: (item) => Math.max(coreRadius + 4, outerRadius - Math.max(0, Number(item.approach.cutback) || 0)),
innerRadiusFor: () => complexJunctionMetrics(cluster).approachInnerRadius,
},
helpers,
model.exclusionRegions || [],
);
const boundaryGraph =
helpers.boundaryGraph ||
buildComplexApproachBoundaryGraph(topology, center, cluster, helpers, model.exclusionRegions || []);
for (const section of boundaryGraph.sections) {
const item = carriageways.find((candidate) => candidate.key === section.carriagewayKey);
if (!item) continue;
@@ -639,6 +632,21 @@ function buildComplexJunctionGeometry(model, cluster, helpers) {
};
}
function buildComplexApproachBoundaryGraph(topology, center, cluster, helpers, exclusionRegions = []) {
const metrics = complexJunctionMetrics(cluster);
return buildJunctionBoundaryGraph(
topology,
center,
{
outerRadiusFor: (item) =>
Math.max(metrics.coreRadius + 4, metrics.approachOuterRadius - Math.max(0, Number(item.approach.cutback) || 0)),
innerRadiusFor: () => metrics.approachInnerRadius,
},
helpers,
exclusionRegions,
);
}
function classifyJunctionShape(arms, center, helpers) {
const headings = arms.map((arm) => arm.heading);
const throughPairs = [];
@@ -903,6 +911,7 @@ function directionalProjectionMeters(origin, point, heading) {
module.exports = {
resolveComplexJunctionTopology,
buildComplexJunctionGeometry,
buildComplexApproachBoundaryGraph,
classifyJunctionShape,
complexJunctionMetrics,
};