feat(junction): project sourced islands

This commit is contained in:
que01 committed 2026-09-09 10:54:45 +08:00
1 parent cd3a9c9613
commit 0e162d1f43
3 files changed
+67 -1

No files matched your search

+39
View File
@@ -193,4 +193,43 @@ assert.equal(
.provenance.facilityEvidence,
'source-crossing-node',
);
const knownIsland = {
id: 'known-structure-island',
source: 'osm-traffic-island',
ring: [
[sourceCenter[0] - 0.00001, sourceCenter[1] - 0.00001],
[sourceCenter[0] + 0.00001, sourceCenter[1] - 0.00001],
[sourceCenter[0] + 0.00001, sourceCenter[1] + 0.00001],
[sourceCenter[0] - 0.00001, sourceCenter[1] + 0.00001],
[sourceCenter[0] - 0.00001, sourceCenter[1] - 0.00001],
],
};
const islandStructureModel = structuredClone(sourceCrossingModel);
islandStructureModel.exclusionRegions = [knownIsland];
const islandStructureGeometry = compiler.nativeRoad.compileGeometry(
islandStructureModel,
{ schema: 'native-road-overrides/v1', overrides: [] },
{
edgeLines: false,
junctionTemplates: {
enabled: true,
clusters: [
{
id: 'fixture-five-arm',
template: 'complex-junction-v1',
nodeIds: ['8005332807', '8024512135', '8024512145', '8024512147', '8613058676'],
coreRadiusMeters: 24,
},
],
},
},
);
const islandStructure = islandStructureGeometry.roadSurface.features.find(
(feature) => feature.properties?.junction_structure,
)?.properties.junction_structure;
assert.equal(
islandStructure.facilities.find((facility) => facility.key === 'island:osm/known-structure-island').provenance
.facilityEvidence,
'source-osm-region',
);
console.log('road compiler package tests passed');