feat(junction): publish sourced traffic islands
This commit is contained in:
1 parent
3bf2edaf99
commit
c14b8b09f2
2 files changed
+26
No files matched your search
@@ -854,6 +854,7 @@ function compileGeometry(model, overrides = { overrides: [] }, options = {}) {
|
|||||||
diagnostics,
|
diagnostics,
|
||||||
options,
|
options,
|
||||||
);
|
);
|
||||||
|
junctionFeatures.push(...compileKnownIslandFeatures(model));
|
||||||
validateConnectorContainment(connectorResult.features, junctionFeatures, diagnostics);
|
validateConnectorContainment(connectorResult.features, junctionFeatures, diagnostics);
|
||||||
return {
|
return {
|
||||||
roadSurface: { type: 'FeatureCollection', features },
|
roadSurface: { type: 'FeatureCollection', features },
|
||||||
@@ -873,6 +874,21 @@ function compileGeometry(model, overrides = { overrides: [] }, options = {}) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function compileKnownIslandFeatures(model) {
|
||||||
|
return (model.exclusionRegions || []).map((region) => ({
|
||||||
|
type: 'Feature',
|
||||||
|
properties: {
|
||||||
|
native_id: `osm-traffic-island:${region.id}`,
|
||||||
|
kind: 'island',
|
||||||
|
object_key: `island:osm/${region.id}`,
|
||||||
|
osm_way_ids: String(region.id),
|
||||||
|
source: region.source,
|
||||||
|
provenance: 'native-road-osm-traffic-island/v1',
|
||||||
|
},
|
||||||
|
geometry: { type: 'Polygon', coordinates: [region.ring] },
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
function modelWithDirectEditProfiles(model, directEdit) {
|
function modelWithDirectEditProfiles(model, directEdit) {
|
||||||
if (!directEdit?.roadProfiles?.size && !directEdit?.junctionPlans?.size) return model;
|
if (!directEdit?.roadProfiles?.size && !directEdit?.junctionPlans?.size) return model;
|
||||||
const approachWidths = new Map();
|
const approachWidths = new Map();
|
||||||
|
|||||||
@@ -78,6 +78,16 @@ assert.deepEqual(
|
|||||||
islandModel.exclusionRegions.map((region) => [region.id, region.source]),
|
islandModel.exclusionRegions.map((region) => [region.id, region.source]),
|
||||||
[['island', 'osm-traffic-island']],
|
[['island', 'osm-traffic-island']],
|
||||||
);
|
);
|
||||||
|
const islandGeometry = compiler.nativeRoad.compileGeometry(islandModel, {
|
||||||
|
schema: 'native-road-overrides/v1',
|
||||||
|
overrides: [],
|
||||||
|
});
|
||||||
|
assert.equal(
|
||||||
|
islandGeometry.intersectionSurface.features.find(
|
||||||
|
(feature) => feature.properties?.native_id === 'osm-traffic-island:island',
|
||||||
|
)?.properties?.object_key,
|
||||||
|
'island:osm/island',
|
||||||
|
);
|
||||||
const complexModel = compiler.nativeRoad.compileRoadModel(fs.readFileSync(fixture, 'utf8'), {
|
const complexModel = compiler.nativeRoad.compileRoadModel(fs.readFileSync(fixture, 'utf8'), {
|
||||||
schema: 'native-road-overrides/v1',
|
schema: 'native-road-overrides/v1',
|
||||||
overrides: [],
|
overrides: [],
|
||||||
|
|||||||
Reference in new issue
Block a user