feat: complete complex junction transition editing
This commit is contained in:
1 parent
801d8be980
commit
79f83412e6
18 files changed
+400
-59
No files matched your search
@@ -115,6 +115,7 @@ const KIND_LABELS: Record<ConstraintKind, string> = {
|
||||
'junction-approach-width': '进口宽度',
|
||||
'cluster-carriageway-width': '车行道宽度',
|
||||
'cluster-carriageway-cutback': '车行道收口距离',
|
||||
'cluster-carriageway-transition-length': '车行道过渡长度',
|
||||
'cluster-corner-radius': '角部圆角',
|
||||
'cluster-crossing-inset': '斑马线退让',
|
||||
'cluster-stop-line-offset': '停止线偏移',
|
||||
|
||||
@@ -328,3 +328,25 @@ describe('draft constraint', () => {
|
||||
expect(operationFor(constraint).author).toBe('dingkang');
|
||||
});
|
||||
});
|
||||
|
||||
describe('complex transition length projection', () => {
|
||||
it('maps dragging to a bounded length constraint', () => {
|
||||
const handle = makeHandle(
|
||||
'cluster-carriageway-transition-length',
|
||||
{
|
||||
type: 'cluster-carriageway',
|
||||
clusterId: 'cluster-1',
|
||||
carriagewayKey: 'entry-1',
|
||||
sourceNodeIds: ['node-1'],
|
||||
sourceRoadIds: ['road-1'],
|
||||
},
|
||||
12,
|
||||
8,
|
||||
20,
|
||||
);
|
||||
const scalar = projectHandleValue(handle, ...dragBy(handle.axisAzimuth, 2));
|
||||
expect(scalar).toBeCloseTo(14, 3);
|
||||
expect(constraintValueFor(handle, scalar)).toEqual({ transitionLengthMeters: scalar });
|
||||
expect(projectHandleValue(handle, ...dragBy(handle.axisAzimuth, 100))).toBe(20);
|
||||
});
|
||||
});
|
||||
@@ -106,6 +106,8 @@ export function constraintValueFor(
|
||||
return { widthMeters: Math.max(0, scalar) };
|
||||
case 'cluster-carriageway-cutback':
|
||||
return { cutbackMeters: Math.max(0, scalar) };
|
||||
case 'cluster-carriageway-transition-length':
|
||||
return { transitionLengthMeters: Math.max(0, scalar) };
|
||||
case 'cluster-corner-radius':
|
||||
return { radiusMeters: Math.max(0, scalar) };
|
||||
case 'junction-cutback':
|
||||
|
||||
@@ -33,6 +33,7 @@ export const JUNCTION_KINDS = [
|
||||
'junction-approach-width',
|
||||
'cluster-carriageway-width',
|
||||
'cluster-carriageway-cutback',
|
||||
'cluster-carriageway-transition-length',
|
||||
'cluster-corner-radius',
|
||||
'junction-cutback',
|
||||
'junction-corner-radius',
|
||||
@@ -126,6 +127,7 @@ export type ConstraintValue =
|
||||
| { boundaryIndex: number; offsetMeters: number; transition?: Transition }
|
||||
| { depthMeters: number; stripeCount: number }
|
||||
| { cutbackMeters: number }
|
||||
| { transitionLengthMeters: number }
|
||||
| { radiusMeters: number }
|
||||
| { insetMeters: number };
|
||||
export interface LaneManeuverValue {
|
||||
|
||||
Reference in new issue
Block a user