feat(junction): enable complex carriageway width editing
This commit is contained in:
1 parent
56647fcdaa
commit
c4bcbe8ff9
22 files changed
+449
-52
No files matched your search
@@ -256,10 +256,18 @@ const complexInput = {
|
||||
};
|
||||
const complexArea = compileInput(complexInput).area;
|
||||
const clusterState = editState(complexArea, selectionFrom({ cluster: cluster.id }));
|
||||
assert.deepEqual(clusterState.handles.handles, [], 'cluster selection must never fall through to node handles');
|
||||
assert.ok(
|
||||
clusterState.handles.handles.every((handle) => handle.kind === 'cluster-carriageway-width'),
|
||||
'cluster selection publishes only scoped complex carriageway width handles',
|
||||
);
|
||||
assert.ok(clusterState.handles.handles.length, 'the complex fixture must publish editable carriageways');
|
||||
assert.deepEqual(clusterState.junctionStructure.junctionRef, { type: 'cluster', id: cluster.id });
|
||||
assert.equal(clusterState.junctionStructure.shape.effectiveArmCount, 5);
|
||||
assert.equal(clusterState.junctionStructure.capability.editable, false);
|
||||
assert.equal(
|
||||
clusterState.junctionStructure.capability.editable,
|
||||
false,
|
||||
'structure capability opens with the frontend stage',
|
||||
);
|
||||
const complexTracked = trackedFiles.map(({ file }) => ({
|
||||
file,
|
||||
bytes: fs.readFileSync(file),
|
||||
@@ -267,12 +275,51 @@ const complexTracked = trackedFiles.map(({ file }) => ({
|
||||
}));
|
||||
const emptyDocument = { ...clusterState.document, constraints: [], operations: [] };
|
||||
const clusterPreview = editPreview(complexArea, { document: emptyDocument, selection: { cluster: cluster.id } });
|
||||
assert.deepEqual(clusterPreview.handles.handles, []);
|
||||
assert.deepEqual(clusterPreview.handles.handles, clusterState.handles.handles);
|
||||
assert.deepEqual(
|
||||
clusterPreview.junctionStructure,
|
||||
clusterState.junctionStructure,
|
||||
'preview and persisted compiler structure agree',
|
||||
);
|
||||
const complexWidthHandle = clusterState.handles.handles[0];
|
||||
const complexWidthConstraint = {
|
||||
id: 'constraint:complex-width',
|
||||
kind: 'cluster-carriageway-width',
|
||||
anchor: complexWidthHandle.anchor,
|
||||
anchorSnapshot: {
|
||||
coordinate: complexWidthHandle.position,
|
||||
tangentAzimuth: complexWidthHandle.axisAzimuth,
|
||||
roadLengthMeters: 120,
|
||||
osmNodeIds: complexWidthHandle.anchor.sourceNodeIds,
|
||||
},
|
||||
value: { widthMeters: complexWidthHandle.value.current + 0.25 },
|
||||
enabled: true,
|
||||
status: 'exact',
|
||||
provenance: { operationId: 'operation:complex-width', createdAt: '2026-09-08T00:00:00.000Z' },
|
||||
};
|
||||
const widenedClusterPreview = editPreview(complexArea, {
|
||||
document: {
|
||||
...emptyDocument,
|
||||
constraints: [complexWidthConstraint],
|
||||
operations: [
|
||||
{
|
||||
id: 'operation:complex-width',
|
||||
createdAt: '2026-09-08T00:00:00.000Z',
|
||||
constraintIds: [complexWidthConstraint.id],
|
||||
},
|
||||
],
|
||||
},
|
||||
selection: { cluster: cluster.id },
|
||||
});
|
||||
const complexSurface = (preview) =>
|
||||
preview.layers.roadSurface.features.find(
|
||||
(feature) => feature.properties.carriageway_key === complexWidthHandle.anchor.carriagewayKey,
|
||||
);
|
||||
assert.notDeepEqual(
|
||||
complexSurface(widenedClusterPreview).geometry,
|
||||
complexSurface(clusterPreview).geometry,
|
||||
'a cluster carriageway constraint must change compiled complex geometry',
|
||||
);
|
||||
const browsing = browseState(complexArea);
|
||||
const unavailableStructureState = browseState({
|
||||
...complexArea,
|
||||
|
||||
Reference in new issue
Block a user