/* 272-1 측점 한 벌 — 진짜 `common_util_structure_station.ts` 의 `plantedChainages` · `oneStationList` 를 * Node 로 돌림. 입력 argv[2] JSON(파이썬과 같은 값) · 표준출력 JSON 한 벌. */ const fs = require("fs"); const path = require("path"); const { makeLoader } = require("./helper_ts_stub_loader.cjs"); const CATALOG = require("./helper_322_catalog_module.cjs"); // 구조물 표(322-1) const ROOT = path.join(__dirname, "..", ".."); function loadTs(file) { return makeLoader({ root: ROOT, cache: false, requireFor: (full) => (request) => { if (CATALOG.isCatalogRequest(request)) return CATALOG; throw new Error(`stub 없음: ${request} (${file})`); }, }).loadTs(path.join(ROOT, file)); } const input = JSON.parse(fs.readFileSync(process.argv[2], "utf8")); const station = loadTs("common_util/common_util_structure_station.ts"); const out = { planted: station.plantedChainages(input.pipes, input.structures, input.types), list: station.oneStationList(input.server, input.fresh), nodes: station.followMovedNodes(input.base.basePvi, input.gone, input.born, input.edited).nodes, }; // 368-2 추가 측점 — 화면이 둔 읽는 곳(setPlusStations)으로 심는 자리에 듦 station.setPlusStations(() => input.plus); out.plantedPlus = station.plantedChainages(input.pipes, input.structures, input.types); process.stdout.write(JSON.stringify(out));