fix: constrain complex junction corner and crossing publication
This commit is contained in:
1 parent
79f2ee5d4e
commit
101bcb3792
4 files changed
+84
-3
No files matched your search
@@ -330,6 +330,30 @@ for (const corner of corners) {
|
||||
);
|
||||
}
|
||||
}
|
||||
// Every generated corner surface must respect the same known exclusion regions
|
||||
// as the core and entry surfaces, including containment without edge crossings.
|
||||
for (const target of [
|
||||
sidewalkGeometry.roadSurface.features.find((feature) => feature.properties.kind === 'complex-corner-fillet'),
|
||||
corners[0],
|
||||
]) {
|
||||
assert.ok(target, 'fixture exercises both corner pavement and sidewalk');
|
||||
const protectedRing = target.geometry.coordinates[0];
|
||||
const excludedGeometry = compiler.nativeRoad.compileGeometry(
|
||||
{ ...sidewalkModel, exclusionRegions: [{ id: 'corner-protection', ring: protectedRing }] },
|
||||
{ overrides: [] },
|
||||
{ junctionTemplates: boundaryEditOptions.junctionTemplates },
|
||||
);
|
||||
const { ringsOverlap } = require('../src/compile/junction-boundary-graph');
|
||||
const publishedCorners = [
|
||||
...excludedGeometry.roadSurface.features,
|
||||
...excludedGeometry.sidewalkSurface.features,
|
||||
].filter((feature) => ['complex-corner-fillet', 'complex-sidewalk-corner'].includes(feature.properties.kind));
|
||||
assert.ok(publishedCorners.every((feature) => !ringsOverlap(protectedRing, feature.geometry.coordinates[0])));
|
||||
assert.ok(
|
||||
excludedGeometry.diagnostics.some((item) => item.rule === 'complex-junction-corner-exclusion-overlap'),
|
||||
'omitted corner surfaces report their exclusion conflict',
|
||||
);
|
||||
}
|
||||
// Empty pavement is a real result, not a signal to disable attachment checks.
|
||||
const shortPoints = [
|
||||
[1, -1, 0],
|
||||
@@ -370,8 +394,24 @@ for (const name of [
|
||||
'directionArrows',
|
||||
'turnArrows',
|
||||
'sidewalkSurface',
|
||||
'crosswalks',
|
||||
'vehicleStopLines',
|
||||
])
|
||||
assert.equal(shortGeometry[name].features.length, 0, `${name} must remain empty when all source roads are swallowed`);
|
||||
assert.ok(
|
||||
shortGeometry.diagnostics.some((item) => item.rule === 'complex-junction-crosswalk-pavement-unavailable'),
|
||||
'unsupported crossings explain their missing pavement',
|
||||
);
|
||||
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');
|
||||
for (const item of missingSidewalkSeams) {
|
||||
assert.equal(item.severity, 'warning');
|
||||
assert.ok(item.subjectId.startsWith('corner:'), 'missing seams must identify the affected corner');
|
||||
assert.ok(item.sourceIds.length > 0);
|
||||
assert.ok(item.sourceIds.every((id) => shortModel.roads.some((road) => road.id === id)));
|
||||
}
|
||||
const complexFeatures = Object.values(complexGeometry).flatMap((layer) => layer?.features || []);
|
||||
assert.equal(
|
||||
complexFeatures.some((feature) => feature.properties?.kind === 'complex-corner-island'),
|
||||
|
||||
Reference in new issue
Block a user