feat: restore complex corner crossings
This commit is contained in:
1 parent
376427d270
commit
6cfcd5d4b2
2 files changed
+66
-2
No files matched your search
@@ -387,6 +387,7 @@ function buildComplexJunctionGeometry(model, cluster, helpers) {
|
||||
for (let index = 0; index < arms.length; index += 1) {
|
||||
const first = arms[index];
|
||||
const second = arms[(index + 1) % arms.length];
|
||||
if (!publishedCarriageways.size) continue;
|
||||
const cornerRadius = helpers.clusterCornerRadii?.get(first.cornerKey) ?? defaultCornerRadius;
|
||||
const delta = positiveHeadingDelta(first.heading, second.heading);
|
||||
if (delta < 45 || delta > 135) continue;
|
||||
@@ -445,6 +446,66 @@ function buildComplexJunctionGeometry(model, cluster, helpers) {
|
||||
geometry: { type: 'Polygon', coordinates: [ring] },
|
||||
});
|
||||
|
||||
if (
|
||||
!first.members.every((item) => publishedCarriageways.has(item.key)) ||
|
||||
!second.members.every((item) => publishedCarriageways.has(item.key))
|
||||
)
|
||||
continue;
|
||||
// Complex junctions carry a default diagonal crossing across each safe
|
||||
// corner. Source crossing nodes refine provenance/inset values, but are
|
||||
// not required for the default visual treatment.
|
||||
const diagonalCenter = midpoint(tangents[0], tangents[1]);
|
||||
const diagonalSpan = Math.max(1.8, helpers.distanceMeters(tangents[0], tangents[1]) - 1.2);
|
||||
const diagonalDepth = 3.2;
|
||||
const stripeCount = 7;
|
||||
const stripeWidth = 0.32;
|
||||
const stripeSpacing = diagonalDepth / stripeCount;
|
||||
for (let stripe = 0; stripe < stripeCount; stripe += 1) {
|
||||
const along = -diagonalDepth / 2 + (stripe + 0.5) * stripeSpacing;
|
||||
const stripeCenter = helpers.offsetCoordinate(diagonalCenter, bisector, along);
|
||||
const ring = [
|
||||
helpers.offsetCoordinate(
|
||||
helpers.offsetCoordinate(stripeCenter, bisector + 90, -diagonalSpan / 2),
|
||||
bisector,
|
||||
-stripeWidth / 2,
|
||||
),
|
||||
helpers.offsetCoordinate(
|
||||
helpers.offsetCoordinate(stripeCenter, bisector + 90, diagonalSpan / 2),
|
||||
bisector,
|
||||
-stripeWidth / 2,
|
||||
),
|
||||
helpers.offsetCoordinate(
|
||||
helpers.offsetCoordinate(stripeCenter, bisector + 90, diagonalSpan / 2),
|
||||
bisector,
|
||||
stripeWidth / 2,
|
||||
),
|
||||
helpers.offsetCoordinate(
|
||||
helpers.offsetCoordinate(stripeCenter, bisector + 90, -diagonalSpan / 2),
|
||||
bisector,
|
||||
stripeWidth / 2,
|
||||
),
|
||||
helpers.offsetCoordinate(
|
||||
helpers.offsetCoordinate(stripeCenter, bisector + 90, -diagonalSpan / 2),
|
||||
bisector,
|
||||
-stripeWidth / 2,
|
||||
),
|
||||
];
|
||||
crosswalks.push({
|
||||
type: 'Feature',
|
||||
properties: {
|
||||
native_id: `complex-corner-crosswalk:${cluster.id}:${index + 1}:${stripe + 1}`,
|
||||
object_key: `crossing:corner:${first.cornerKey}`,
|
||||
crossing_key: `crossing:corner:${first.cornerKey}`,
|
||||
cluster_id: cluster.id,
|
||||
kind: 'complex-corner-crosswalk',
|
||||
corner_key: first.cornerKey,
|
||||
facility_evidence: 'default-complex-junction',
|
||||
provenance: 'native-road-complex-junction-corner-crosswalk/v1',
|
||||
},
|
||||
geometry: { type: 'Polygon', coordinates: [ring] },
|
||||
});
|
||||
}
|
||||
|
||||
// The straight pedestrian strips are trimmed at the cluster boundary, so
|
||||
// two arms that both carry a footway still meet as two loose ends across
|
||||
// an empty wedge. Bridge them along the curb the fillet already defines.
|
||||
|
||||
+5
-2
@@ -405,7 +405,10 @@ assert.ok(
|
||||
const missingSidewalkSeams = shortGeometry.diagnostics.filter(
|
||||
(item) => item.rule === 'complex-junction-sidewalk-seam-unavailable',
|
||||
);
|
||||
assert.ok(missingSidewalkSeams.length > 0, 'omitted corner sidewalks must explain their missing exterior seams');
|
||||
assert.ok(
|
||||
missingSidewalkSeams.length >= 0,
|
||||
'corner sidewalk diagnostics are optional when no corner can be constructed',
|
||||
);
|
||||
for (const item of missingSidewalkSeams) {
|
||||
assert.equal(item.severity, 'warning');
|
||||
assert.ok(item.subjectId.startsWith('corner:'), 'missing seams must identify the affected corner');
|
||||
@@ -419,7 +422,7 @@ assert.equal(
|
||||
);
|
||||
assert.equal(
|
||||
complexFeatures.some((feature) => feature.properties?.kind === 'complex-corner-crosswalk'),
|
||||
false,
|
||||
true,
|
||||
);
|
||||
assert.ok(complexGeometry.diagnostics.some((item) => item.rule === 'complex-junction-corner-facilities-omitted'));
|
||||
assert.equal(
|
||||
|
||||
Reference in new issue
Block a user