- 브라우저 다시 셈(Cross_Refresh_Calc) · 묶음 cross 단계(Cross_Stage) 의 좌 깎기 고정 폴백 걷음 · cross 단계는 이미 있는 uphillSide(Pipeline_Detail) 다시 씀 - 서버 [저장] 두 길도 같은 규칙 — 파이썬 stored_section_mode(Router_Design 셋 · SampleExtend) · Node Cross_Save storedOptions · Node 에 측점 uphill_side 넘김(Server_Calc_Prebuild) · 화면만 상단측이면 [저장] 뒤 좌 깎기로 뒤집혀 같이 고침 - 값 바뀜 = section_mode 없는 설계뿐(지금 DB 16 측점 · 한 프로젝트) · 그 밖 0 차 - 거울 시험 test_472_8_section_mode_default(파이썬 = Node = 브라우저 · 없음 = 상단측 적음) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
61 lines
2.3 KiB
JavaScript
61 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: [],
|
|
bermSpans: null,
|
|
bermDepths: [],
|
|
choices: [],
|
|
shoulderExtends: [],
|
|
canon: [],
|
|
},
|
|
null,
|
|
);
|
|
process.stdout.write(JSON.stringify(detail.cross_sections.map((s) => s.design)));
|