- 서버 snap_curve_stations ↔ TS snapCurveStations · gridIndices 지움 — 스냅 켬 = 끔과 같은 측점(20 m 그대로 + 「No.N+10 (MC)」) - 고르기 = 10 m · 측점 No. 둘 · load_station_snap_step = 10 만 · 옛 0.1 · 1 = 측점 No. - 시험 = 새 test_280_4_stations(거울 다섯 경우) · 224_2 · 344_3 · 366_3 · 390_4 · 390_5 · 407 고쳐 씀 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 lines
1.7 KiB
JavaScript
41 lines
1.7 KiB
JavaScript
/* PLAN 483(요구 280-4) 측점 목록 거울 헬퍼 — 진짜 `B05_Profile/logic/B05_Profile_Sections_Stations.ts`
|
|
* `buildStations` 를 트랜스파일해 Node 로 돌림. 입력 argv[2] JSON(사례 목록) · 표준출력 JSON.
|
|
* 짝 = `test_280_4_stations.py`. */
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
|
|
const CATALOG = require("./helper_322_catalog_module.cjs");
|
|
|
|
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 (CATALOG.isCatalogRequest(request)) return CATALOG;
|
|
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 logic = loadTs(path.join(ROOT, "B05_Profile", "logic", "B05_Profile_Sections_Stations.ts"));
|
|
const station = loadTs(path.join(ROOT, "common_util", "common_util_structure_station.ts"));
|
|
station.setPlusStations(() => []);
|
|
const cases = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
|
|
const out = cases.map((c) =>
|
|
logic
|
|
.buildStations(c.line, c.curves, [], [], {
|
|
types: [],
|
|
stationSnap: c.snap,
|
|
stationSnapStep: c.step,
|
|
})
|
|
.map((s) => ({ m: s.chainageM, kind: s.kind, key: s.key })),
|
|
);
|
|
process.stdout.write(JSON.stringify(out));
|