- 315-1 fordChuteLine — 길이 맞춘 선의 첫 조각만 쓰던 흠(원지반 이음 조각 버림) · 이은 조각까지 한 선 · 길이 없음 · 짧은 길이 · 절토 쪽 그대로 - 315-2 overflowLine — 성토 쪽(노면 끝 밖 설계선이 내려감) = 성토 사면선을 노면 끝 너머 위로 연장해 월류 높이선과 만나는 자리에서 끝 · 절토 · 늘인 노면 끝(294-3) 그대로 · 같은 점선 양식(B06 카드 · B07 [상세] 같은 그림) - 시험 test_315_ford_chute_overflow 새로 · test_287 월류선 기대값 315 규칙 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TteK8mfYZetk5P3bEZkyVZ
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", "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: 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));
|