- logic 새 파일 다섯 — Cross_Wall_Geom(벽 1매) · Cross_Wall_Hatch_Geom(무늬 띠 · 물빼기 · 도수로 띠 · 원지반선) · Cross_Excavation_Geom(벽 터파기) · Cross_Design_Surface_Geom(암선 · 포장층) · Cross_Revetment_Geom(독립 기슭막이 배치) - logic 으로 옮김 — Body_Guard → Cross_Body_Guard · Structure_Layouts · Route_Carry_Patch(내용 그대로 · import 경로만) - inferStationInterval → common_util_station(글자표 없는 자리 · common_util_svg 는 다시 내보냄) — Node 묶음 ui_template_locale 끌림 끊음 - 부르는 쪽 import 줄 · 등록부 ts 경로 · 시험 · 도우미 경로 - test_472_3 GEOMETRY_PULLS 다섯 줄 걷음 · Wall_Hatch · Excavation · Design_Surface 세 줄은 Culvert · Box · Ford 그림 파일(518-2)이 그리기 함수로 부르는 동안 남김 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
84 lines
3.0 KiB
JavaScript
84 lines
3.0 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 hatch = load(path.join(ROOT, "B06_Section", "logic", "B06_Section_Cross_Wall_Hatch_Geom.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: pave.overflowLine(input.fillDesign, 0.3),
|
|
dipOverflow: pave.overflowLine(input.dipDesign, 0.3),
|
|
fillEdges: pave.fordEdges(input.fillDesign),
|
|
dipEdges: pave.fordEdges(input.dipDesign),
|
|
deckPoints: deck?.attrs.points ?? null,
|
|
bandPoints: band?.attrs.points ?? null,
|
|
};
|
|
process.stdout.write(JSON.stringify(out));
|