- 암 경계선 그리기 · 호출 · 스타일 삭제 (암 구간 면적 · 수량 계산 그대로) - 쓰는 곳 없는 culvert-cut 스타일 삭제 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EYJJRCfHfdCGNhmXTjQKV7
28 lines
904 B
TypeScript
28 lines
904 B
TypeScript
import type { CrossDesign } from "./B06_Section_Api_Fetch";
|
|
|
|
const SVG_NS = "http://www.w3.org/2000/svg";
|
|
|
|
export function appendPavementOverlay(
|
|
svg: SVGElement,
|
|
design: CrossDesign,
|
|
x: (offset: number) => number,
|
|
y: (elevation: number) => number,
|
|
): void {
|
|
const edges = design.carriageway_edges ?? design.road_edges;
|
|
if (!design.paved || !edges) return;
|
|
const thickness = design.pavement_thickness_m ?? 0.2;
|
|
const { left, right } = edges;
|
|
const polygon = document.createElementNS(SVG_NS, "polygon");
|
|
polygon.setAttribute(
|
|
"points",
|
|
[
|
|
`${x(left.offset_m)},${y(left.elevation_m)}`,
|
|
`${x(right.offset_m)},${y(right.elevation_m)}`,
|
|
`${x(right.offset_m)},${y(right.elevation_m - thickness)}`,
|
|
`${x(left.offset_m)},${y(left.elevation_m - thickness)}`,
|
|
].join(" "),
|
|
);
|
|
polygon.setAttribute("class", "b06-chart__pavement");
|
|
svg.append(polygon);
|
|
}
|