- 충돌 24 파일 = import 줄 다툼 — 518-2 새 경로(Cross_Culvert · Culvert_Geom · Extra · Wire · Types · Box_Geom · Ford_Geom · Ford_Pavement) + 518-3 새 경로(Cross_Body_Guard · Wall_Geom · Wall_Hatch_Geom · Excavation_Geom · Revetment_Geom · Structure_Layouts · Route_Carry_Patch)
- 518-2 logic 셋이 부르던 UI_Cross_Wall · Wall_Hatch · Body_Guard = 518-3 logic 경로로 · 518-3 새 logic 넷의 옛 Culvert_Types · Extra 경로 = 518-2 logic 으로
- test_472_3 GEOMETRY_PULLS 남은 3 줄(Design_Surface · Excavation · Wall_Hatch) 걷음 = 빈 목록
- Corridor_Structures prettier
- 확인 = 518-1 · 518-2 · 518-3 고친 시험 + golden_472 73 파일 444 통과 · typecheck 0 · design-calc · corridor 묶음 · 옛 판(1d5d63875) ↔ 합친 판 덧그림 대조 938 측점 같음
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
85 lines
3.2 KiB
JavaScript
85 lines
3.2 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", "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: 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));
|