- config 기본 L 20 · 초기값 직선 문턱 500 m ↔ TS `logic/B05_Profile_Profile_CurveLaw.ts` 상수 짝 - 초기값(1차 지반 종단 · 추천 [적용])만 정책 `no_curve_keys` 로 얼림 · 손 편집 · R 이면 기본 곡선 - 법정 종단곡선 최소 R · L 미달 = 경고 글(파이썬 · TS 같은 글) + 종단 요약줄 「종단곡선 미달」 - 노선 [저장]은 옛 정책(L · 열쇠) 이어받음 · 바뀐 자리 새 꼭짓점만 새 지반 열쇠(`carry_policy` ↔ `carryNoCurveKeys`) - 시험 test_432_1 + 헬퍼 스텁 넷 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XWh5wNNycMkbwMpACz1rte
75 lines
2.9 KiB
JavaScript
75 lines
2.9 KiB
JavaScript
/* 344-2 노선 짝 거울 — 진짜 TS(`logic/B05_Profile_Grade_Ground` · `logic/B05_Profile_Grade_Carry` ·
|
|
* `common_util_route_follow`)를 Node 로 돌림. 입력 argv[2] JSON(파이썬과 같은 값) · 표준출력 JSON 한 벌.
|
|
*/
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
|
|
|
|
const ROOT = path.join(__dirname, "..", "..");
|
|
|
|
function loadTs(file, stubs = {}) {
|
|
const js = ts.transpileModule(fs.readFileSync(path.join(ROOT, file), "utf8"), {
|
|
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
|
|
}).outputText;
|
|
const box = { exports: {} };
|
|
const localRequire = (request) => {
|
|
if (stubs[request]) return stubs[request];
|
|
throw new Error(`stub 없음: ${request} (${file})`);
|
|
};
|
|
new Function("exports", "module", "require", js)(box.exports, box, localRequire);
|
|
return box.exports;
|
|
}
|
|
|
|
const straightJudge = loadTs("B05_Profile/logic/B05_Profile_Profile_Straight.ts");
|
|
const curveLaw = loadTs("B05_Profile/logic/B05_Profile_Profile_CurveLaw.ts");
|
|
const pivot = loadTs("B05_Profile/logic/B05_Profile_UI_Profile_Pivot.ts", {
|
|
"./B05_Profile_Profile_Straight": straightJudge,
|
|
});
|
|
const alignment = loadTs("B05_Profile/logic/B05_Profile_UI_Profile_Alignment.ts", {
|
|
"./B05_Profile_UI_Profile_Pivot": pivot,
|
|
"./B05_Profile_Profile_Straight": straightJudge,
|
|
"./B05_Profile_Profile_CurveLaw": curveLaw,
|
|
});
|
|
const ground = loadTs("B05_Profile/logic/B05_Profile_Grade_Ground.ts", {
|
|
"./B05_Profile_Profile_CurveLaw": curveLaw,
|
|
"./B05_Profile_UI_Profile_Alignment": alignment,
|
|
});
|
|
const carry = loadTs("B05_Profile/logic/B05_Profile_Grade_Carry.ts", {
|
|
"./B05_Profile_UI_Profile_Alignment": alignment,
|
|
});
|
|
const catalog = require("./helper_322_catalog_module.cjs");
|
|
const station = loadTs("common_util/common_util_structure_station.ts", {
|
|
"./common_util_structure_catalog": catalog,
|
|
});
|
|
const follow = loadTs("common_util/common_util_route_follow.ts", {
|
|
"./common_util_structure_station": station,
|
|
});
|
|
|
|
const input = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
|
|
const out = {
|
|
ground: input.ground.map((item) => ground.groundFollowingBasePvi(item)),
|
|
carry: input.carry.map((item) => {
|
|
const span = carry.changedSpan(item.old_xy, item.new_xy);
|
|
return {
|
|
span,
|
|
result: span
|
|
? {
|
|
basePvi: carry.carryBase(item.old_xy, item.new_xy, item.base_pvi, item.ground_pvi),
|
|
edits: carry.carryEdits(
|
|
item.old_xy,
|
|
item.new_xy,
|
|
item.base_pvi,
|
|
item.edits,
|
|
item.stations,
|
|
10,
|
|
),
|
|
}
|
|
: null,
|
|
};
|
|
}),
|
|
pipes: input.pipes.map((item) => follow.projectPipePoints(item.points, item.line)),
|
|
structures: input.structures.map((item) => follow.followStructures(item.items, item.line)),
|
|
driftMax: follow.STRUCTURE_ROUTE_DRIFT_MAX_M,
|
|
};
|
|
process.stdout.write(JSON.stringify(out));
|