/* ============================================================================= * B06_Section_UI_Cross_Ford_Linked.ts * 물넘이포장 연결 표기(294-6) — 월류 폭으로 옆 측점 카드에 걸쳐 그린 포장층 · 월류 높이선을 * 흙막이 연동 형상(79-6 `.is-linked`)과 같은 꼴로 · 호버 글에 주인 측점. 주인 측점 카드는 그대로 · * 고름 표식(`data-structure-id`)은 주인 구조물 그대로. * ========================================================================== */ import { stationLabel } from "../common_util/common_util_station"; import type { CrossSection } from "./B06_Section_Api_Fetch"; const SVG_NS = "http://www.w3.org/2000/svg"; /** 연결 꼴을 입힐 물넘이 그림 — 포장층 · 월류 높이선 */ const LINKED_CLASSES = ["b06-chart__ford-pavement", "b06-chart__ford-deck-plan"]; /** `from` 번째 자식부터(방금 그린 물넘이포장) 옆 카드면 연결 꼴 · 주인 측점 글. 붙였으면 true */ export function markLinkedFordPavement( svg: SVGElement, from: number, section: Pick, stationInterval: number, ): boolean { const owner = section.ford_pavement?.chainage_m; if (typeof owner !== "number" || Math.abs(owner - section.chainage_m) < 1e-3) return false; const name = `물넘이포장 · ${stationLabel(owner, stationInterval)} 연결`; for (const el of [...svg.children].slice(from)) { if (!LINKED_CLASSES.some((className) => el.classList.contains(className))) continue; el.classList.add("is-linked"); const title = document.createElementNS(SVG_NS, "title"); title.textContent = name; el.append(title); } return true; }