/* 432-1 종단곡선 초기값 직선 · 법정 미달 거울 헬퍼 — `logic/B05_Profile_Grade_Ground.ts` * `groundFollowingBasePvi` · `_UI_Profile_Alignment.ts` `buildAlignment` · `_Profile_CurveLaw.ts` 를 * 그 자리에서 트랜스파일해 돌림. 입력 argv[2] JSON 파일 · 표준출력 JSON 한 벌. */ const fs = require("fs"); const path = require("path"); const { makeLoader } = require("./helper_ts_stub_loader.cjs"); const ROOT = path.join(__dirname, "..", ".."); const { loadTs } = makeLoader({ root: ROOT, }); const LOGIC = path.join(ROOT, "B05_Profile", "logic"); const align = loadTs(path.join(LOGIC, "B05_Profile_UI_Profile_Alignment.ts")); const ground = loadTs(path.join(LOGIC, "B05_Profile_Grade_Ground.ts")); const law = loadTs(path.join(LOGIC, "B05_Profile_Profile_CurveLaw.ts")); const input = JSON.parse(fs.readFileSync(process.argv[2], "utf8")); const pvi = ground.groundFollowingBasePvi(input.ground); const base = { policy: input.policy, onlyExplicitCurves: false, basePvi: input.basePvi, chainage: input.chainage, ground: input.groundZ, stations: input.stations.map((s) => ({ station_id: null, chainage_m: s })), }; const cases = input.edits.map((edits) => { const al = align.buildAlignment(base, edits); return { curves: al.curves.map((c) => [c.chainage_m, c.r_m, c.l_m]), shortfalls: law.verticalCurveShortfalls(al.curves, input.policy), warnings: al.warnings, }; }); console.log( JSON.stringify({ pvi, cases, consts: [law.DEFAULT_CURVE_LENGTH_M, law.INITIAL_STRAIGHT_RADIUS_M], }), );