Files
Aislo/B06_Section/logic/B06_Section_UI_Page_Patches.ts
T
eomsangdonandClaude Opus 5.5 281c71b55b refactor(logic): 348-1 순수 계산 TS 49 파일 <페이지>/logic/ 로 옮김 — 이름 앞머리 그대로 · 동작 고침 없음
- 옮김: B04 2 · B05 23 · B06 11 · A00_Common/design 13 (9,299 줄) · 이미 logic/ 에 있던 16 파일 그대로
- 안 옮김: 묶음 입구(package.json build:*) · 파이썬 · 순수지만 계산 아닌 8 (보기 결선 · 콜백 · API 타입 · 갈아끼움 알림판)
- import 266 줄(142 파일) · 시험 · 주석 · 짝 표시 문자열 경로 고침 · B05 · B06 CLAUDE.md 짝 줄 logic/
- 시험 도우미 새 경로: 가짜 require 열쇠 · B05()/B06() 부름 · 형제 import 자리 · tsc 묶어 돌리는 시험 · 정규식 · rglob
- design_view_cross 줄 한도 시험 685 → 688 (긴 import 경로 줄바꿈 3줄)
- 확인: typecheck 0 · 서버 묶음 넷(corridor · server-calc · b07-extent · b07-note) 다시 지어 코드 같음(//#region 경로 주석만 다름) · 관련 시험 270 파일 — 남은 실패 19 는 옮기기 전과 같음

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014utrjfoW831Vc5wJUd13kL
2026-10-16 13:44:50 +09:00

86 lines
4.3 KiB
TypeScript

/* =============================================================================
* B06_Section_UI_Page_Patches.ts
* 확정·임시저장이 보내는 **측점별 편집분(cross_patches) 조립** — 페이지
* (`_UI_Page.ts`)에서 700줄 제한으로 분리했다(2026-08-25).
*
* 세션·제어기에 흩어져 있던 조작값을 누가거리 하나로 합친다. 값은 만들지 않고
* 모으기만 한다 — 판정·한계는 각 제어기가 이미 끝냈다.
* ========================================================================== */
import type { CrossSectionPatch, StoredWallAdjust, StoredWallSpan } from "../B06_Section_Api_Fetch";
import type { BasinAdjust } from "../B06_Section_UI_Cross_Culvert_Types";
import type { FordAdjust } from "../B06_Section_UI_Cross_Ford";
import type { BoxAdjust } from "../B06_Section_UI_Cross_Box";
import type { InletStructureChoice } from "../B06_Section_UI_Cross_Culvert";
export interface CrossPatchSources {
/** 암 경계선 오프셋(누가거리 문자열 키). */
rockOffsets: Map<string, number>;
/** 측점별 암 절토 경사비(1:n 의 n). **0 은 「표준값을 씀」**(되돌리기)이다. */
cutSlopeRatios: Map<string, number>;
/** 측점 개별 표시 반폭(m). */
stationWidths: Map<string, number>;
inletStructures: Map<string, InletStructureChoice>;
basinAdjustments: Map<string, BasinAdjust>;
revetAdjusts: Map<number, Record<string, StoredWallAdjust>>;
extraCounts: Map<number, { outlet: number; basin: number }>;
/** 다단 단별 구간값(2026-08-29) — 키는 벽 키("extra0"…/"bextra0"…). */
extraSpans: Map<number, Record<string, StoredWallSpan>>;
fordAdjusts: Map<number, FordAdjust>;
boxAdjusts: Map<number, BoxAdjust>;
linkFlags: Map<number, { detached?: boolean; followGrade?: boolean }>;
}
/** 누가거리별 패치를 합쳐 한 배열로 돌려준다. */
export function buildCrossPatches(sources: CrossPatchSources): CrossSectionPatch[] {
const patchByChainage = new Map<number, CrossSectionPatch>();
const patchFor = (chainageM: number): CrossSectionPatch => {
const existing = patchByChainage.get(chainageM);
if (existing) return existing;
const created: CrossSectionPatch = { chainage_m: chainageM };
patchByChainage.set(chainageM, created);
return created;
};
sources.rockOffsets.forEach((offset, chainage) => {
patchFor(Number(chainage)).rock_boundary_offset_m = offset;
});
// 측점별 암 절토 경사(2026-09-07) — 0 이면 「표준값을 씀」이라 정본의 옛 값을 덮어 지운다.
sources.cutSlopeRatios.forEach((ratio, chainage) => {
patchFor(Number(chainage)).cut_slope_ratio_user = ratio;
});
// 개별 표시 반폭(2026-08-06) — design에 병합돼 재접근 시 유지된다.
sources.stationWidths.forEach((width, chainage) => {
patchFor(Number(chainage)).display_half_width_m = width;
});
sources.inletStructures.forEach((structure, chainage) => {
patchFor(Number(chainage)).inlet_structure = structure;
});
sources.basinAdjustments.forEach((adjust, chainage) => {
patchFor(Number(chainage)).basin_adjust = adjust;
});
// 기슭막이 4축·다단 단 수 — 세션 전용이던 값을 정본에 실어 확정한다(2026-08-24).
sources.revetAdjusts.forEach((adjusts, chainage) => {
patchFor(chainage).revet_adjust = adjusts;
});
sources.extraCounts.forEach((counts, chainage) => {
patchFor(chainage).extra_wall_counts = counts;
});
// 다단 단별 구간값 — 세션에서 만진 값을 정본에 싣는다(2026-08-29 사용자).
sources.extraSpans.forEach((spans, chainage) => {
patchFor(chainage).extra_spans = spans;
});
// 세월교 측벽 조작값(2026-08-25) — 배수관 값과 같은 자리에 실어 3D·재계산이 잇는다.
sources.fordAdjusts.forEach((adjust, chainage) => {
patchFor(chainage).ford_adjust = adjust;
});
sources.boxAdjusts.forEach((adjust, chainage) => {
patchFor(chainage).box_adjust = adjust;
});
// 연동 해제(측점별)·종단경사 반영(전체 공통) — 같은 체계로 정본에 싣는다.
sources.linkFlags.forEach((flags, chainage) => {
if (flags.detached !== undefined) patchFor(chainage).revet_link_detached = flags.detached;
if (flags.followGrade !== undefined) patchFor(chainage).revet_follow_grade = flags.followGrade;
});
return [...patchByChainage.values()];
}