- common_util_structure_station: 기존 측점(일반 · 구조물 · 추가) · snapExistingStation(가운데면 앞 측점) · snapStationFor(site 만) - 폼 [추가] · 끌기(movedStructure) · 우클릭 추가 = 같은 맞춤 · 폼 칸에 맞춘 측점 다시 씀 - 옛 소수 자동 맞춤 = 기존 측점(끝 소수 · 옛 구조물 측점)에 선 site 안 옮김 - 상세 모달 CAD 글 = 맞춘 측점에서 종류 이름 + 「상세 내용: 사토장 부피」 줄(기존 길 그대로) - 시험 test_380_2_site_station(아무 m 입력 = 가까운 측점 · CAD 글 줄) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VmC34fsxxbweEG3RUjs3Mn
53 lines
2.5 KiB
JavaScript
53 lines
2.5 KiB
JavaScript
/* 380-2 사토장 · 토취장(site) = 가장 가까운 기존 측점(일반 · 구조물 · 추가) · 새 측점 안 심음.
|
|
* 진짜 `common_util_structure_station` · `_Structures_Snap` 을 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 input = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
|
|
const catalog = require("./helper_322_catalog_module.cjs");
|
|
const station = loadTs("common_util/common_util_structure_station.ts", {
|
|
"./common_util_structure_catalog": catalog,
|
|
});
|
|
const snap = loadTs("B05_Profile/B05_Profile_UI_Structures_Snap.ts", {
|
|
"@ui/ui_template_elements": { showToast: () => {}, showConfirmDialog: async () => true },
|
|
"../common_util/common_util_structure_station": station,
|
|
"../A00_Common/design/design_selection": { PIPE_MATCH_M: 0.51 },
|
|
"./B05_Profile_Api_Structures": {
|
|
structureAnchorM: (entry) => entry.chainage_m ?? entry.start_m ?? 0,
|
|
},
|
|
});
|
|
|
|
const out = {};
|
|
out.emptySnap = station.snapExistingStation(25.4); // 목록 전 = 정수 m
|
|
station.setGeneralStations(input.stations);
|
|
station.setPlusStations(() => input.plus);
|
|
out.existing = station.existingStations();
|
|
out.snap = input.typed.map((value) => station.snapExistingStation(value));
|
|
out.twice = out.snap.map((value) => station.snapExistingStation(value));
|
|
out.siteFor = station.snapStationFor(25.4, "site");
|
|
out.pointFor = station.snapStationFor(25.4, "point");
|
|
out.movedSite = snap.movedStructure({ placement: "site", chainage_m: 20 }, 35.2).chainage_m;
|
|
out.movedPoint = snap.movedStructure({ placement: "point", chainage_m: 20 }, 35.2).chainage_m;
|
|
out.offGrid = input.offGrid.map((entry) => snap.structureOffGrid(entry));
|
|
out.planned = snap
|
|
.snapPlan(input.offGrid, [])
|
|
.structures.map((entry) => [entry.index, entry.next.chainage_m]);
|
|
process.stdout.write(JSON.stringify(out));
|