Files
Aislo/resources/tester/helper_349_0v_span.cjs
T
eomsangdonandClaude Opus 5.5 c95266efd0 fix(349-0v): 손으로 고친 노선 [저장] = 계획고 옮김만 · 바뀐 구간 = 화면과 같은 계획 폴리라인
손 편집 [저장]이 추천 갈래를 따라 균형 종단을 새로 풀어 사용자 계획고가 노선 전체에서 바뀌던 흠.
화면은 balanced_profile 안 보냄(profileShown 없앰) · 서버도 균형 종단은 as_initial(추천 [적용])일
때만. 계획고 옮김의 바뀐 구간 = 옛 계획 폴리라인(read_route_plan planned) 대 새로 쓴 계획
폴리라인 — 풀린 노선 geojson(점 간격 다름) 대신 화면 planline 단계와 같은 선. 거울 시험 test_349_0v.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ji4nuyLVHcxrXWHTdb5nRD
2026-10-16 18:02:58 +09:00

47 lines
1.7 KiB
JavaScript

/* 349-0v 바뀐 구간 거울 — 화면 planline 단계 차례 그대로: 새 노선 = `buildEditedPolyline`(노드 초안) ·
* 옛 노선 = 저장 계획 폴리라인 · `changedSpan` → `carryProfileEdits`. 입력 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 curve = loadTs("B05_Profile/logic/B05_Profile_UI_RouteEdit_Curve.ts");
const alignment = loadTs("B05_Profile/logic/B05_Profile_UI_Profile_Alignment.ts");
const carry = loadTs("B05_Profile/logic/B05_Profile_Grade_Carry.ts", {
"./B05_Profile_UI_Profile_Alignment": alignment,
});
const input = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
const xy = (line) => line.map(([x, y]) => ({ x, y }));
const built = curve.buildEditedPolyline(
input.nodes,
input.curveOn,
input.curveRadius,
input.minRadiusM,
);
const span = carry.changedSpan(xy(input.old_line), xy(built.vertices));
process.stdout.write(
JSON.stringify({
new_line: built.vertices,
span,
result: span
? carry.carryProfileEdits(input.base_pvi, input.edits, span, input.ground_pvi)
: null,
}),
);