fix: align junction crossings and round pedestrian islands
This commit is contained in:
1 parent
76f81d024a
commit
7a7912f302
18 files changed
+491
-96
No files matched your search
+67
-1
@@ -479,7 +479,14 @@ const sourceCrossingRadius = Math.hypot(
|
||||
(sourceCrossingModel.crossings[0].coordinate[0] - sourceCenter[0]) * sourceLatitudeScale,
|
||||
(sourceCrossingModel.crossings[0].coordinate[1] - sourceCenter[1]) * 111320,
|
||||
);
|
||||
assert.ok(Math.abs(sourcedComplexCrosswalk.properties.radial_distance_m - sourceCrossingRadius) < 0.1);
|
||||
assert.ok(
|
||||
Math.abs(
|
||||
sourcedComplexCrosswalk.properties.radial_distance_m -
|
||||
sourceCrossingRadius -
|
||||
sourcedComplexCrosswalk.properties.group_depth_m,
|
||||
) < 0.1,
|
||||
'complex crossing retreats by its full rectangle depth from its source station',
|
||||
);
|
||||
const sourcedStopLine = sourceCrossingGeometry.vehicleStopLines.features.find(
|
||||
(feature) => feature.properties?.crossing_key === inferredStopLine.properties.crossing_key,
|
||||
);
|
||||
@@ -532,3 +539,62 @@ assert.equal(
|
||||
'source-osm-region',
|
||||
);
|
||||
console.log('road compiler package tests passed');
|
||||
|
||||
// Stop lines must remain outside the relocated matching crossing stripes.
|
||||
const polygonClipping = require('polygon-clipping');
|
||||
for (const stop of sourceCrossingGeometry.vehicleStopLines.features) {
|
||||
if (stop.properties.kind !== 'complex-stop-line') continue;
|
||||
for (const stripe of sourceCrossingGeometry.crosswalks.features) {
|
||||
if (stripe.properties.crossing_key !== stop.properties.crossing_key) continue;
|
||||
assert.deepEqual(
|
||||
polygonClipping.intersection(stop.geometry.coordinates, stripe.geometry.coordinates),
|
||||
[],
|
||||
'stop line does not intersect its crosswalk after default retreat',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const minimumStopGeometry = compiler.nativeRoad.compileGeometry(
|
||||
sourceCrossingModel,
|
||||
{ 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,
|
||||
},
|
||||
],
|
||||
},
|
||||
directEdit: {
|
||||
clusterCrossings: new Map([
|
||||
[
|
||||
'fixture-five-arm',
|
||||
new Map(
|
||||
sourceCrossingGeometry.vehicleStopLines.features
|
||||
.filter((f) => f.properties.kind === 'complex-stop-line')
|
||||
.map((f) => [f.properties.crossing_key, { stopLineOffsetMeters: 0.5 }]),
|
||||
),
|
||||
],
|
||||
]),
|
||||
},
|
||||
},
|
||||
);
|
||||
const minimumStops = minimumStopGeometry.vehicleStopLines.features.filter(
|
||||
(f) => f.properties.kind === 'complex-stop-line',
|
||||
);
|
||||
assert.ok(minimumStops.length > 0);
|
||||
for (const stop of minimumStops) {
|
||||
for (const stripe of minimumStopGeometry.crosswalks.features) {
|
||||
if (stripe.properties.crossing_key !== stop.properties.crossing_key) continue;
|
||||
assert.deepEqual(
|
||||
polygonClipping.intersection(stop.geometry.coordinates, stripe.geometry.coordinates),
|
||||
[],
|
||||
'minimum stop offset must not overlap its matching crossing',
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user