Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Se7ytqbohmBQnfYpwYFnYf
96 lines
2.5 KiB
JavaScript
96 lines
2.5 KiB
JavaScript
/* 432-3 헬퍼 — MC 가 움직여도 B06 고침이 곡선 측점을 따라가는지.
|
|
* node helper_432_3_curve_key.mjs <묶음.mjs>
|
|
*/
|
|
import { pathToFileURL } from "node:url";
|
|
|
|
const store = () => {
|
|
const m = new Map();
|
|
return {
|
|
getItem: (k) => (m.has(k) ? m.get(k) : null),
|
|
setItem: (k, v) => m.set(k, String(v)),
|
|
removeItem: (k) => m.delete(k),
|
|
key: (i) => [...m.keys()][i] ?? null,
|
|
get length() {
|
|
return m.size;
|
|
},
|
|
clear: () => m.clear(),
|
|
};
|
|
};
|
|
globalThis.window = globalThis;
|
|
globalThis.sessionStorage = store();
|
|
globalThis.localStorage = store();
|
|
const any = new Proxy(function () {}, {
|
|
get: (_t, k) => (k === Symbol.toPrimitive ? () => 0 : any),
|
|
apply: () => any,
|
|
construct: () => any,
|
|
});
|
|
globalThis.document = any;
|
|
globalThis.requestAnimationFrame = (run) => setTimeout(run, 0);
|
|
|
|
const m = await import(pathToFileURL(process.argv[2]).href);
|
|
const P = "p432";
|
|
const detailOf = (rows) => {
|
|
const sections = rows.map(([chainage_m, kind]) => ({
|
|
station_id: `s${chainage_m}`,
|
|
chainage_m,
|
|
kind,
|
|
label: String(chainage_m),
|
|
samples: [],
|
|
}));
|
|
return {
|
|
longitudinal: { stations: sections, profile_alignment: { policy: { station_interval_m: 20 } } },
|
|
cross_sections: sections,
|
|
};
|
|
};
|
|
const base = [
|
|
[0, "bp"],
|
|
[20, "regular"],
|
|
[40, "regular"],
|
|
[60, "regular"],
|
|
[120, "ep"],
|
|
];
|
|
const route = (curves) => detailOf([...base, ...curves].sort((a, b) => a[0] - b[0]));
|
|
|
|
// 옛 노선 7 — MC 둘(47.35 · 90.00)에 카드 고침 · 사면 쉬프트(측구 폭 칸 crossw 는 누가거리 열쇠)
|
|
m.useStationKeys(
|
|
P,
|
|
7,
|
|
route([
|
|
[47.35, "curve"],
|
|
[90, "curve"],
|
|
]),
|
|
);
|
|
const card = { ground_type: "rock", section_mode: "right_cut" };
|
|
m.writeKeyed(
|
|
"crossdesign",
|
|
P,
|
|
7,
|
|
new Map([
|
|
["47.35", card],
|
|
["90.00", card],
|
|
]),
|
|
);
|
|
m.writeKeyed("shoulderext", P, 7, new Map([["47.35", { left: 0.5 }]]));
|
|
m.writeState("crossw", { 47.35: 3.2 }, P, 7);
|
|
|
|
// 새 노선 8 — 첫 MC 1.75 m 움직임(R 고침) · 둘째 MC 15 m 움직임(10 m 넘음 = 다른 곡선으로 봄)
|
|
m.useStationKeys(
|
|
P,
|
|
8,
|
|
route([
|
|
[49.1, "curve"],
|
|
[105, "curve"],
|
|
]),
|
|
);
|
|
const outside = m.carryStationDrafts(P, 7, 8, { quiet: true });
|
|
const states = m.carryChainageStates(P, 7, 8);
|
|
process.stdout.write(
|
|
JSON.stringify({
|
|
outside,
|
|
states,
|
|
cards: Object.fromEntries(m.readKeyed("crossdesign", P, 8)),
|
|
shoulder: Object.fromEntries(m.readKeyed("shoulderext", P, 8)),
|
|
crossw: m.readState("crossw", P, 8),
|
|
}),
|
|
);
|