feat: add native preview traffic simulation

This commit is contained in:
2026-08-18 16:57:27 +08:00
parent 0bc949bc24
commit 5403936ae4
21 changed files with 777 additions and 45 deletions

View File

@@ -148,6 +148,14 @@ assert.equal(sharedInteriorGeometry.intersectionSurface.features.length, 1);
assert.equal(sharedInteriorGeometry.intersectionSurface.features[0].properties.osm_node_id, "2");
assert.equal(sharedInteriorGeometry.intersectionSurface.features[0].properties.kind, "t");
assert.ok(sharedInteriorGeometry.connectors.features.length >= 4);
const throughConnector = sharedInteriorGeometry.connectors.features.find((feature) => feature.properties.turn === "through");
assert.ok(throughConnector, "T junction emits a through connector");
const throughCoordinates = throughConnector.geometry.coordinates;
const throughStart = throughCoordinates[0]; const throughEnd = throughCoordinates.at(-1);
for (const point of throughCoordinates.slice(1, -1)) {
const area = Math.abs((throughEnd[0] - throughStart[0]) * (point[1] - throughStart[1]) - (throughEnd[1] - throughStart[1]) * (point[0] - throughStart[0]));
assert.ok(area < 1e-12, "through connector stays on its lane-to-lane chord instead of bending through the junction node");
}
assert.ok(sharedInteriorGeometry.sidewalkSurface.features.some((feature) => feature.properties.kind === "continuation" && /segment:way\/50\/1:.*->segment:way\/50\/2:/.test(feature.properties.native_id)));
const connection = initial.connections[0];
assert.ok(initial.connections.every((item) => item.fromEndpointId.endsWith(":end") && item.toEndpointId.endsWith(":start")));