Files
Aislo/resources/tester/helper_315_ford_chute_overflow.cjs
T
eomsangdonandClaude Opus 5.5 e4befd158a refactor(472-3 B06 구조물): 관 · BOX · 세월교 · 물넘이 모양 계산을 logic 으로 옮김(518-2)
- logic 새 파일 9 — B06_Section_Cross_Culvert · _Culvert_Geom · _Culvert_Extra · _Culvert_Tiers ·
  _Culvert_Types · _Culvert_Wire · _Box_Geom · _Ford_Geom · _Ford_Pavement
- 그림 파일(UI_Cross_Culvert · _Culvert_Types · _Box · _Ford · _Ford_Pavement)은 받은 좌표로 그리기만 ·
  관 겹 꼭짓점(pipeShellCorners) · 물넘이 노면 끝 · 월류선 · 유출 성토선은 logic 으로
- 옛 순수 기하 6 파일(UI_Cross_Culvert_Geom · _Extra · _Tiers · _Wire · _Box_Geom · _Ford_Geom) 지움 ·
  부르는 쪽(B05 Corridor · Structure_Layouts · Route_Carry_Patch · Wall 등)은 import 줄만
- test_472_3 GEOMETRY_PULLS 자기 11 줄 + 더는 안 끌리는 Design_Surface 1 줄 걷음
- 시험 · helper 경로를 새 logic 파일로 — 옮긴 파일을 가리키던 낡은 경로

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 19:17:23 +09:00

85 lines
3.1 KiB
JavaScript

/* 315 물넘이포장 도수로 · 돌붙임 길이(성토) · 월류 높이선 성토 쪽 연장 헬퍼 — 진짜 TS 를 Node 로 돌려 JSON 한 벌로. */
const fs = require("fs");
const path = require("path");
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
const ROOT = path.join(__dirname, "..", "..");
const cache = new Map();
const load = (file) => {
if (cache.has(file)) return cache.get(file);
const js = ts.transpileModule(fs.readFileSync(file, "utf8"), {
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
}).outputText;
const box = { exports: {} };
cache.set(file, box.exports);
const near = (m) => {
if (m.startsWith("@config/")) return load(path.join(ROOT, "config", `${m.slice(8)}.ts`));
if (m.startsWith("@util/")) return load(path.join(ROOT, "common_util", `${m.slice(6)}.ts`));
if (m.startsWith(".")) return load(path.join(path.dirname(file), `${m}.ts`));
return new Proxy({}, { get: () => () => {} });
};
new Function("exports", "module", "require", js)(box.exports, box, near);
return box.exports;
};
class Node {
constructor(tag) {
this.tag = tag;
this.attrs = {};
this.children = [];
this.dataset = {};
this.style = {};
}
setAttribute(k, v) {
this.attrs[k] = String(v);
}
getAttribute(k) {
return this.attrs[k] ?? null;
}
append(...kids) {
this.children.push(...kids);
}
}
globalThis.document = { createElementNS: (_ns, tag) => new Node(tag) };
const input = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
const pave = load(path.join(ROOT, "B06_Section", "B06_Section_UI_Cross_Ford_Pavement.ts"));
const paveGeo = load(path.join(ROOT, "B06_Section", "logic", "B06_Section_Cross_Ford_Pavement.ts"));
const hatch = load(path.join(ROOT, "B06_Section", "B06_Section_UI_Cross_Wall_Hatch.ts"));
const fillGround = hatch.groundLine(input.fillSamples);
const dipGround = hatch.groundLine(input.dipSamples);
const chute = (design, ground, length) =>
pave.fordChuteLine(design, length ? { length_m: length } : {}, ground);
// 그린 SVG — 띠(돌붙임) · 월류 높이선 점 수
const svg = new Node("g");
pave.appendFordPavementOverlay(
svg,
{
span_m: 8,
depth_m: 0.3,
slope_pct: 5,
chute: { structure: "돌붙임", thickness_m: 0.3, length_m: 6 },
},
input.fillDesign,
(o) => o,
(e) => e,
fillGround,
);
const deck = svg.children.find((k) => k.attrs.class === "b06-chart__ford-deck-plan");
const band = svg.children.find((k) => k.attrs.class === "b06-chart__culvert-pitching");
const out = {
fillNone: chute(input.fillDesign, fillGround),
fillShort: chute(input.fillDesign, fillGround, 1),
fillLong: chute(input.fillDesign, fillGround, 6),
dipNone: chute(input.dipDesign, dipGround),
dipLong: chute(input.dipDesign, dipGround, 2),
fillOverflow: paveGeo.overflowLine(input.fillDesign, 0.3),
dipOverflow: paveGeo.overflowLine(input.dipDesign, 0.3),
fillEdges: paveGeo.fordEdges(input.fillDesign),
dipEdges: paveGeo.fordEdges(input.dipDesign),
deckPoints: deck?.attrs.points ?? null,
bandPoints: band?.attrs.points ?? null,
};
process.stdout.write(JSON.stringify(out));