Files
Pier_v1/src/core/abut/order.ts
T
ypshimandClaude Haiku 5.5 1d31d2f3a9 feat(abut): 교대 형상·입력 패널과 교각 받침·솔플레이트 개편
- 교대 형상(src/core/abut, 3D 장면, 목록·카메라·맞춤)과 교대 입력 패널 추가
- 교각 받침 기준 카드 제거, 솔플레이트 규칙을 교각별 입력으로 변경
- 받침 ELEVATION·솔플레이트 TABLE을 모델값으로 연결
- 교대 입력값 카드: 형식 행에 시점·종점 표시, 제목을 "A1 입력값 [입력]"으로 변경
- 테스트 614건 통과, 타입 검사 통과

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-03 14:51:34 +09:00

25 lines
1.2 KiB
TypeScript

/**
* 구조물 목록 순서 (2026-11-03, 교대 AB): 시점 교대(A1) → 교각 P1 … Pn → 종점 교대(A2), 교대가 여럿이면 번호 순.
* Pure. Used by the 구조물 목록 so the abutments sit at the two ends of the bridge.
*/
export interface StructureRef {
kind: 'pier' | 'abut';
name: string;
/** 교대 형식 (A1 · A2), only for abutments. */
type?: 'A1' | 'A2';
}
const numberOf = (name: string) => Number(name.replace(/\D/g, '')) || 0;
export function structureOrder(abutments: { name: string; type: 'A1' | 'A2' }[], piers: string[]): StructureRef[] {
const start = abutments.filter((a) => a.type === 'A1').sort((a, b) => numberOf(a.name) - numberOf(b.name));
const end = abutments.filter((a) => a.type === 'A2').sort((a, b) => numberOf(a.name) - numberOf(b.name));
const others = abutments.filter((a) => a.type !== 'A1' && a.type !== 'A2');
return [
...start.map((a) => ({ kind: 'abut' as const, name: a.name, type: a.type })),
...piers.map((name) => ({ kind: 'pier' as const, name })),
...end.map((a) => ({ kind: 'abut' as const, name: a.name, type: a.type })),
...others.map((a) => ({ kind: 'abut' as const, name: a.name, type: a.type })),
];
}