/* ============================================================================= * design_structure_ford.ts * 횡단배수 › 세월교 명세 — 사용자 구조물 표 04(`docs/raw/구조물정의_표/04_횡단배수_세월교.md`) + 65장. * * 컨테이너: 세월교(필수) · 유입 구조(필수) · 유출 구조(필수) · 흙막이(선택 · 여러 개) · 도수로/돌붙임(선택 · 하나). * 구조 · 정본 = 이 명세 · 이름만 정의(M02)에서 바꿈. * 저장 키 = pipe_points.json 옛 키 그대로(B06 세월교 세트 · B07 · B08 이 읽는 자리) — 유입 · 유출 구조 * (`inlet_type` · `outlet_type` = 없음 · 날개벽 · 흙막이) · 고르면 옛 날개벽 설치 칸(`wing_in` · `wing_out`)도 함께 적음. * 흙막이 = 배관과 같은 양식(`design_structure_guard` · 키 `{side}_revet_*` · 65-2) · 구조 「없음」 = 목록 램프 · 잇기 줄 없음(65-3). * 월류 높이 = 월류 폭과 연동(폭을 바꾸면 필요 수심으로 채움 · 그 아래로는 안 받음) — 계산은 `design_structure_ford_calc`. * import = 같은 폴더 명세뿐 — 시험이 이 폴더 파일만 옮겨 돌림. * ========================================================================== */ import type { SpecContainer, SpecChoice, StructureSpec } from "./design_structure_spec"; import { CHUTE_ADD, guardItems, revetKeys, SOIL_ADD } from "./design_structure_guard"; /** 유입 · 유출 구조 — 날개벽만 옛 설치 칸이 「있음」. */ const guard = (side: "in" | "out"): SpecChoice[] => [ { value: "없음", label: "없음", also: { [`wing_${side}`]: "없음" } }, { value: "날개벽", label: "날개벽", also: { [`wing_${side}`]: "있음" } }, { value: "흙막이", label: "흙막이", also: { [`wing_${side}`]: "없음" } }, ]; const guardContainer = (id: "inlet" | "outlet", title: string, link: string): SpecContainer => ({ id, title, required: true, none: "없음", link, items: [ { id: "structure", label: "구조", kind: "select", key: `${id}_type`, choices: guard(id === "inlet" ? "in" : "out"), }, ...guardItems({ 흙막이: revetKeys(id) }, undefined, true), ], }); export const FORD_SPEC: StructureSpec = { typeId: "ford_bridge", containers: [ { id: "ford", title: "세월교", required: true, link: "gford", items: [ { id: "diameter", label: "관경", kind: "select", key: "pipe_diameter_mm", asNumber: true, choices: ["800", "1000", "1200", "1500"].map((v) => ({ value: v, label: v })), }, { id: "count", label: "수량 (련)", kind: "number", key: "pipe_count", step: 1 }, // 관경 바로 뒤(65-4) // 월류 폭 · 높이 = 물넘이 포장과 같은 키 · 같은 계산(65-5 · B06 횡단이 읽음) { id: "width", label: "월류 폭 (m)", kind: "number", key: "ford_width_m", step: 0.1 }, { id: "height", label: "월류 높이 (m)", kind: "number", key: "ford_height_m", step: 0.01 }, ], }, guardContainer("inlet", "유입 구조", "gfordin"), guardContainer("outlet", "유출 구조", "gfordout"), SOIL_ADD, CHUTE_ADD, ], // 표 04 에 없는 옛 칸 — 화면에서 빼고 값은 남김(지난 정의 값) retired: [ "pipe_kind", "wing_in_height_m", "wing_in_length_m", "wing_in_angle_deg", "wing_out_height_m", "wing_out_length_m", "wing_out_angle_deg", ], }; /** 구조를 날개벽 설치 칸(옛 저장 · B06 조정창이 고치는 칸)에 맞춤 — 있음 = 날개벽 · 없음 = 날개벽이면 없음 * (흙막이는 그대로) · 설치 칸이 없으면 구조 그대로. */ export function withLegacyGuards( options: Record, ): Record { const out = { ...options }; for (const [type, wing] of [ ["inlet_type", "wing_in"], ["outlet_type", "wing_out"], ]) { if (out[wing] === "있음") out[type] = "날개벽"; else if (out[wing] === "없음" && (out[type] ?? "날개벽") === "날개벽") out[type] = "없음"; } return out; }