/* ============================================================================= * B06_Section_UI_Cross_Excavation.ts * 횡단도에 **벽 터파기 선**을 얹는다 — 관 터파기 선은 그리지 않음(사용자 10-7). * * 왜 있나 — 「터파기가 현재 횡단도에서 표현이 안 된다」가 사용자 지적이었다. 수량을 * 세기 전에 **도면에 그것이 보여야** 한다. * * ⚠ 근거의 급이 다르므로 **노티스를 갈라 적는다** — 값은 `common_util_excavation` 한 곳에서 * 온다(파이썬 짝과 거울 시험으로 묶여 있다). 여기서는 **그리기만** 한다. * 관 : 법정 시방서 표(KCS 44 40 10 그림 3.2-1) * 벽 : 법정 근거 없음 — 실무 정본 식(구조도 기슭막이 xls) * ⚠ **비탈을 주지 않는다 — 수직으로 그린다.** 정본 식에 기울기 항이 없다. * ========================================================================== */ import { BASIS_WALL, WALL_BLINDING_DEPTH_M, WALL_BLINDING_WIDTH_M, WALL_FOUNDATION_DEPTH_M, WALL_FOUNDATION_WIDTH_M, WALL_TRENCH_CLEARANCE_M, } from "@util/common_util_excavation"; import type { WallLayout } from "./B06_Section_UI_Cross_Culvert_Types"; const SVG_NS = "http://www.w3.org/2000/svg"; /** 「기초유」인가 — 저장 제원 `foundation` 의 값. 비어 있으면 **그리지 않는다**(근거 없음). */ export function foundationChoice(value: unknown): "기초유" | "기초버림" | null { const text = typeof value === "string" ? value.trim() : ""; if (text === "기초유") return "기초유"; if (text === "기초버림") return "기초버림"; return null; } function trenchPath(layer: SVGElement, corners: Array<[number, number]>, tooltip: string): void { const line = document.createElementNS(SVG_NS, "polyline"); line.setAttribute("points", corners.map(([px, py]) => `${px},${py}`).join(" ")); line.setAttribute("class", "b06-chart__excavation"); const title = document.createElementNS(SVG_NS, "title"); title.textContent = tooltip; line.append(title); layer.append(line); } /** * 벽 터파기 — 벽 바닥선 아래로 **수직**. 폭은 바닥 폭 + 여유 0.2, 깊이는 기초 몫. * `foundation` 이 비어 있으면 **그리지 않는다** — 사용자가 고르기 전에는 근거가 없다. */ export function appendWallTrench( layer: SVGElement, wall: WallLayout, foundation: "기초유" | "기초버림" | null, x: (offset: number) => number, toDisplayY: (elevation: number) => number, ): { widthM: number; depthM: number } | null { if (foundation === null) return null; const hasFoundation = foundation === "기초유"; const depth = hasFoundation ? WALL_FOUNDATION_DEPTH_M : WALL_BLINDING_DEPTH_M; // 폭: 기초 몫은 정본이 정한 값(0.9 / 0.7), 다만 벽 바닥이 그보다 넓으면 그 폭 + 여유. const baseWidth = Math.abs(wall.bottomFront.offset - wall.bottomBack.offset); const minWidth = hasFoundation ? WALL_FOUNDATION_WIDTH_M : WALL_BLINDING_WIDTH_M; const width = Math.max(minWidth, baseWidth + (hasFoundation ? WALL_TRENCH_CLEARANCE_M : 0)); const center = (wall.bottomFront.offset + wall.bottomBack.offset) / 2; const top = Math.max(wall.bottomFront.elevation, wall.bottomBack.elevation); const bottom = top - depth; const left = center - width / 2; const right = center + width / 2; trenchPath( layer, [ [x(left), toDisplayY(top)], [x(left), toDisplayY(bottom)], [x(right), toDisplayY(bottom)], [x(right), toDisplayY(top)], ], `${foundation} 터파기 폭 ${width.toFixed(2)}m · 깊이 ${depth.toFixed(2)}m (수직)\n` + `품셈에 규정이 없어 실무 관행으로 정한 값 — ${BASIS_WALL}`, ); return { widthM: width, depthM: depth }; }