- 세션 칸 pagesettings(설계속도 · 지형 · 기준값 · 최소고 강제 · 시작 측점) · 열 때 최신 응답 위에 얹음 - 저장 차례 settings = 노선 뒤 · 관 앞(기본 창구 · 노선 바꾼 [저장]에도 돎) - PUT /route/page-settings — stage 2 params 에 사용자 값만 병합(상태 · STALE 그대로) · 종단 정책 · criteria 갱신 뒤 위반 · 요약 다시 셈(기하 그대로) - 시 · 종점 계획고 조정 = 첫 · 끝 측점 계획고 편집(끝점 ▲▼ 와 같은 길) · 샘플 간격 두 칸 읽기 전용 - E1 재설계 요청이 설계속도 · 최소고 강제 · 시작 측점 옮김 · E2 B06 재생성 지형 기본 특수 · E3 초기값 스냅샷 stage 2 params 뜸 · 되돌림 - 노선 추천 · 평면 R 설정 읽기가 params.options 를 봄(옛 맨 위 칸 폴백) - 시험 test_442_2_page_settings · test_442_2_grade_limit_mirror · design_store_save 차례 갱신 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
45 lines
1.8 KiB
TypeScript
45 lines
1.8 KiB
TypeScript
/* =============================================================================
|
|
* logic/B05_Profile_EndOffsets.ts
|
|
* 「페이지 설정」 시 · 종점 계획고 조정(448) = 첫 · 끝 측점의 계획고 편집(`station_offsets`) 한 칸.
|
|
* 칸 값 = 자동 선형 대비 그 측점 편집(m) · 바꾸면 끝점 ▲▼ 와 같은 길(`adjustStation`)로 얹음 —
|
|
* 계산 줄 즉시 · [저장] `alignment` 차례가 서버 정본 · [초기화]는 종단 파일과 함께 0.
|
|
* ========================================================================== */
|
|
|
|
import {
|
|
adjustStation,
|
|
chainageKey,
|
|
type AlignmentBase,
|
|
type AlignmentEdits,
|
|
} from "./B05_Profile_UI_Profile_Alignment";
|
|
|
|
export type ProfileEnd = "start" | "end";
|
|
|
|
function endChainage(base: AlignmentBase, end: ProfileEnd): number | undefined {
|
|
const nodes = base.basePvi;
|
|
return (end === "start" ? nodes[0] : nodes[nodes.length - 1])?.chainage_m;
|
|
}
|
|
|
|
/** 첫 · 끝 측점 계획고 편집(m) — 편집이 없으면 0. */
|
|
export function endOffsetsOf(
|
|
base: AlignmentBase,
|
|
edits: AlignmentEdits,
|
|
): Record<ProfileEnd, number> {
|
|
const at = (end: ProfileEnd): number => {
|
|
const chainage = endChainage(base, end);
|
|
return chainage === undefined ? 0 : (edits.station_offsets[chainageKey(chainage)] ?? 0);
|
|
};
|
|
return { start: at("start"), end: at("end") };
|
|
}
|
|
|
|
/** 그 끝 측점 계획고 편집을 `value`(m)로 — 기준이 없으면 편집 그대로. */
|
|
export function withEndOffset(
|
|
base: AlignmentBase,
|
|
edits: AlignmentEdits,
|
|
end: ProfileEnd,
|
|
value: number,
|
|
): AlignmentEdits {
|
|
const chainage = endChainage(base, end);
|
|
if (chainage === undefined || !Number.isFinite(value)) return edits;
|
|
return adjustStation(base, edits, chainage, value - endOffsetsOf(base, edits)[end]);
|
|
}
|