feat(junction): enable complex carriageway width editing

This commit is contained in:
que01 committed 2026-09-08 12:09:44 +08:00
1 parent 56647fcdaa
commit c4bcbe8ff9
22 files changed
+449 -52

No files matched your search

+33 -1
View File
@@ -354,10 +354,42 @@ const clusterResolution = resolveDirectEditConstraints(junctionModel, document(a
});
const clusterPlan = clusterResolution.effectiveJunctionPlans.get('cluster:cluster-1');
assert.ok(clusterPlan);
assert.equal(clusterPlan.readOnly, true);
assert.equal(clusterPlan.readOnly, false);
assert.deepEqual(clusterPlan.junctionRef, { type: 'cluster', id: 'cluster-1' });
assert.equal(clusterPlan.approaches.find((item) => item.segmentId === 'segment:a').widthMeters, 7);
const clusterHandleResolution = resolveDirectEditConstraints(junctionModel, document([]), {
junctionClusters: [{ id: 'cluster-1', nodeIds: ['junction'] }],
selection: { type: 'cluster', id: 'cluster-1' },
});
const clusterWidthHandle = clusterHandleResolution.handles.handles.find(
(handle) => handle.kind === 'cluster-carriageway-width',
);
assert.ok(clusterWidthHandle, 'a cluster selection publishes only its external carriageway widths');
const widenedCluster = resolveDirectEditConstraints(
junctionModel,
document([
constraint({
id: 'cluster-carriageway-width',
kind: 'cluster-carriageway-width',
anchor: clusterWidthHandle.anchor,
value: { widthMeters: clusterWidthHandle.value.current + 0.5 },
}),
]),
{ junctionClusters: [{ id: 'cluster-1', nodeIds: ['junction'] }] },
);
assert.equal(widenedCluster.constraintStates[0].applied, true);
assert.equal(
widenedCluster.clusterPlans.get('cluster-1').get(clusterWidthHandle.anchor.carriagewayKey),
clusterWidthHandle.value.current + 0.5,
);
assert.equal(
widenedCluster.effectiveJunctionPlans
.get('cluster:cluster-1')
.carriageways.find((item) => item.key === clusterWidthHandle.anchor.carriagewayKey).widthMeters,
clusterWidthHandle.value.current + 0.5,
);
const recheckResolution = resolveDirectEditConstraints(
junctionModel,
{ ...document([anchored]), base: { compilerGeometryVersion: 'old-geometry' } },