feat(junction): edit complex crossing facilities

This commit is contained in:
que01 committed 2026-09-08 15:05:00 +08:00
1 parent bb5dc01c07
commit 49a44fdf73
16 files changed
+307 -39

No files matched your search

+51 -1
View File
@@ -258,7 +258,13 @@ const complexArea = compileInput(complexInput).area;
const clusterState = editState(complexArea, selectionFrom({ cluster: cluster.id }));
assert.ok(
clusterState.handles.handles.every((handle) =>
['cluster-carriageway-width', 'cluster-carriageway-cutback', 'cluster-corner-radius'].includes(handle.kind),
[
'cluster-carriageway-width',
'cluster-carriageway-cutback',
'cluster-corner-radius',
'cluster-crossing-inset',
'cluster-stop-line-offset',
].includes(handle.kind),
),
'cluster selection publishes only scoped complex geometry handles',
);
@@ -322,6 +328,50 @@ assert.notDeepEqual(
complexSurface(clusterPreview).geometry,
'a cluster carriageway constraint must change compiled complex geometry',
);
const complexCrossingHandle = clusterState.handles.handles.find((handle) => handle.kind === 'cluster-crossing-inset');
assert.ok(complexCrossingHandle, 'the complex fixture must publish grouped crossing handles');
const complexCrossingConstraint = {
id: 'constraint:complex-crossing',
kind: 'cluster-crossing-inset',
anchor: complexCrossingHandle.anchor,
anchorSnapshot: {
coordinate: complexCrossingHandle.position,
tangentAzimuth: complexCrossingHandle.axisAzimuth,
roadLengthMeters: 120,
osmNodeIds: cluster.nodeIds,
},
value: { insetMeters: complexCrossingHandle.value.max },
enabled: true,
status: 'exact',
provenance: { operationId: 'operation:complex-crossing', createdAt: '2026-09-08T00:00:00.000Z' },
};
const movedCrossingPreview = editPreview(complexArea, {
document: {
...emptyDocument,
constraints: [complexCrossingConstraint],
operations: [
{
id: 'operation:complex-crossing',
createdAt: '2026-09-08T00:00:00.000Z',
constraintIds: [complexCrossingConstraint.id],
},
],
},
selection: { cluster: cluster.id },
});
const crossingGeometry = (preview) =>
preview.layers.crosswalks.features.find(
(feature) => feature.properties.crossing_key === complexCrossingHandle.anchor.crossingKey,
)?.geometry;
assert.deepEqual(
movedCrossingPreview.constraintStates?.map((state) => state.applied),
[true],
);
assert.notDeepEqual(
crossingGeometry(movedCrossingPreview),
crossingGeometry(clusterPreview),
'a complex crossing inset must move only its keyed stripe group',
);
const complexCornerHandle = clusterState.handles.handles.find((handle) => handle.kind === 'cluster-corner-radius');
assert.ok(complexCornerHandle, 'the complex fixture must publish stable corner-radius handles');
const complexCornerConstraint = {