fix: fill pavement gaps when junction islands move outward

This commit is contained in:
que01 committed 2026-09-16 15:35:33 +08:00
1 parent 0c42eb46cd
commit e0eaa1c950
2 files changed
+80

No files matched your search

+26
View File
@@ -802,6 +802,32 @@ function buildComplexJunctionGeometry(model, cluster, helpers) {
if (crossing.properties.arm_key === arm.key)
crossing.geometry.coordinates[0] = movedRing(crossing.geometry.coordinates[0]);
}
// Preserve the original full crossing footprint and pave the swept
// connection to its new position, including the gaps between white bars.
const frame = arm.crosswalkFrame;
const corners = rectangle(frame.center, frame.heading, frame.groupDepth, frame.spanMeters);
const originalRegion = [];
// Split at the same endpoint clamps used by movedRing. A four-vertex
// rectangle would interpolate across those clamps and cut off the bars.
const contactRatio = frame.contactEndpointRatio || 0;
for (let edge = 0; edge < 4; edge++) {
const ratios = edge % 2 === 0 ? [0, contactRatio, 1 - contactRatio] : [0];
for (const ratio of ratios) {
originalRegion.push(corners[edge].map((value, axis) => value + (corners[edge + 1][axis] - value) * ratio));
}
}
originalRegion.push(originalRegion[0]);
const movedRegion = movedRing(originalRegion);
crossingRegions.push(movedRegion);
for (let edge = 0; edge < originalRegion.length - 1; edge++) {
crossingRegions.push([
originalRegion[edge],
originalRegion[edge + 1],
movedRegion[edge + 1],
movedRegion[edge],
originalRegion[edge],
]);
}
const averageShift = [(offsets[0][0] + offsets[1][0]) / 2, (offsets[0][1] + offsets[1][1]) / 2];
for (const stopLine of stopLines) {
if (stopLine.properties.arm_key !== arm.key) continue;