- 얹기: attachShapes · attach_shapes 에 소단(section.berm · 덮는 소단 없음 = null) · SHAPE_KEYS 에 berm · TS attachBermSpecs ↔ 파이썬 attach_berm_specs · berm_spans_from 짝 - 읽기: 저장 노선 다시 셈(브라우저 · Node cross.refresh) = 얹힌 section.berm(칸 없음 = 저장분 design.berm) · 노선 초안 · 서버 Node 묶음 cross = crossWithShapes 의 얹힌 제원(bermAt · crossWithBerm 걷음) - 계단은 계산 안쪽 그대로 · [저장] 길(구조물 정본 → cross.berm_spans) 그대로 - 지움: 시설 줄 syncBerm · putBerm(C4.copy) · writeBermSpans · 세션 칸 berm · bermRequest · design_shared bermAt - 시험: test_272_berm_source 측점 얹기 거울로 · test_323_4 소단 얹음 · 477 · 511-A · 472 떠남 · 365 · 272 고름 헬퍼가 사본 대신 얹힌 소단 · design_pipeline_page 700 줄 → 699(주석 한 줄) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
60 lines
2.3 KiB
JavaScript
60 lines
2.3 KiB
JavaScript
/* PLAN 472-8 헬퍼 — 브라우저 다시 셈(`B06_Section_Cross_Refresh_Calc.refreshDesigns`)을 Node 로.
|
|
* 입력 argv[2] JSON {sections, plan: [[누가거리, 계획고]], standard} · 결과 = 표준출력 JSON(측점 설계 목록).
|
|
* 짝 = `test_472_8_section_mode_default.py`. */
|
|
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();
|
|
function loadTs(full) {
|
|
if (cache.has(full)) return cache.get(full);
|
|
const js = ts.transpileModule(fs.readFileSync(full, "utf8"), {
|
|
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
|
|
}).outputText;
|
|
const box = { exports: {} };
|
|
cache.set(full, box.exports);
|
|
const localRequire = (request) => {
|
|
if (request.endsWith(".json"))
|
|
return require(
|
|
request.startsWith("@util/")
|
|
? path.join(ROOT, "common_util", request.slice(6))
|
|
: path.join(path.dirname(full), request),
|
|
);
|
|
if (request.startsWith("@util/"))
|
|
return loadTs(path.join(ROOT, "common_util", `${request.slice(6)}.ts`));
|
|
if (request.startsWith(".")) return loadTs(path.join(path.dirname(full), `${request}.ts`));
|
|
return require(request);
|
|
};
|
|
new Function("exports", "module", "require", js)(box.exports, box, localRequire);
|
|
return box.exports;
|
|
}
|
|
|
|
const job = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
|
|
const { refreshDesigns } = loadTs(
|
|
path.join(ROOT, "B06_Section", "logic", "B06_Section_Cross_Refresh_Calc.ts"),
|
|
);
|
|
const samples = job.plan.map(([chainage_m, elevation_m]) => ({ chainage_m, elevation_m }));
|
|
const alignment = {
|
|
stations: samples.map((s) => ({ chainage_m: s.chainage_m, plan_elevation_m: s.elevation_m })),
|
|
samples,
|
|
balance: { cut_area_m2: 0, fill_area_m2: 0, cut_volume_m3: 0, fill_volume_m3: 0 },
|
|
};
|
|
const detail = { longitudinal: { design_profiles: [] }, cross_sections: job.sections };
|
|
refreshDesigns(
|
|
detail,
|
|
{
|
|
alignment,
|
|
standard: job.standard,
|
|
rockOffsets: [],
|
|
rockDefault: job.rockDefault,
|
|
cutSlopes: [],
|
|
bermDepths: [],
|
|
choices: [],
|
|
shoulderExtends: [],
|
|
canon: [],
|
|
},
|
|
null,
|
|
);
|
|
process.stdout.write(JSON.stringify(detail.cross_sections.map((s) => s.design)));
|