Files
Aislo/resources/tester/helper_440_draft_card_ids.cjs
T
eomsangdonandClaude Opus 5.5 476205757f fix(440 B06 횡단 고름): 노선 초안 카드 번호 = 저장 카드 번호 · 찾기 = 지금 그린 상세 · 평면 빈 곳 누름 = 마커 고름만 · 목록 자리 따라감
- 초안 카드(묶음 새 상세)가 같은 측점 열쇠 저장 카드 번호를 이어 씀(옮긴 관도) — 찾기 상세에 모든 카드 번호
- 카드 고름 · 목록 → 카드 · 넘김 · 풀기 = 지금 그린 상세(drawnDetail)
- B06 위 평면 패널 빈 곳 누름 = 평면 마커가 고른 것만 풂(B06 고름 그대로)
- 바뀜 신호에서 B06 목록 자리가 가게와 다르면 다시 실음(listStale)
- 시험: test_440 새 · 409 마커 고름만 · 298 바뀜 신호 꼴 · 191_1 도우미 stub

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TteK8mfYZetk5P3bEZkyVZ
2026-10-18 18:22:19 +09:00

123 lines
4.2 KiB
JavaScript

// 440 — 노선 초안 동안 B06 카드(묶음 새 상세) 번호가 찾기 상세(갈아끼운 캐시)에 있음.
// 저장 상세 → cross 입력 모음(`pipelineCrossSource` · 진짜) → 새 상세(`draftSectionDetail` · 진짜) 대 갈아끼움(`swapCrossSections` · 진짜).
const fs = require("fs");
const path = require("path");
const ROOT = path.resolve(__dirname, "..", "..");
const ts = require(path.join(ROOT, "config", "node_modules", "typescript"));
const idOf = (m) => `station_${String(Math.round(m * 1000)).padStart(12, "0")}`;
const REAL = /(B05_Profile_Pipeline_Detail|B06_Section_Station_Swap|design_pipeline_cross)$/;
const STUBS = {
B05_Profile_Pipeline_Grade: { stationIdOf: idOf },
common_util_station: { stationLabel: (m) => String(m) },
B05_Profile_UI_Profile_Data: { toDesignProfile: () => ({}) },
b_page_state: { readState: () => null },
B06_Section_Section_Canon: { savedDesigns: () => null },
B06_Section_UI_Standard_Panel: {
effectiveStandardCross: () => ({ road_width_m: 3 }),
readRockBoundaryDefault: () => null,
},
};
const cache = new Map();
function load(full) {
if (cache.has(full)) return cache.get(full).exports;
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);
const req = (r) => {
const name = r.split("/").pop();
if (STUBS[name]) return STUBS[name];
if (REAL.test(r)) return load(path.resolve(path.dirname(full), r + ".ts"));
throw new Error(`stub 없음: ${r}`);
};
new Function("exports", "module", "require", js)(box.exports, box, req);
return box.exports;
}
const detailMod = load(path.join(ROOT, "B05_Profile/logic/B05_Profile_Pipeline_Detail.ts"));
const swapMod = load(path.join(ROOT, "B06_Section/logic/B06_Section_Station_Swap.ts"));
const crossMod = load(path.join(ROOT, "A00_Common/design/design_pipeline_cross.ts"));
const sec = (m, kind, extra = {}) => ({
station_id: idOf(m),
chainage_m: m,
label: "",
kind,
center_x: m,
center_y: 0,
samples: [],
design: { design_elevation_m: 100 },
...extra,
});
// 저장 상세: 일반 340 · 관 351(배수관) · 일반 360
const saved = {
longitudinal: { stations: [], design_profiles: [], length_m: 400, samples: [] },
cross_sections: [
sec(340, "regular"),
sec(351, "irregular", { culvert: { chainage_m: 351, diameter_m: 0.8 } }),
sec(360, "regular"),
],
};
const st = (key, m, kind) => ({
key,
chainageM: m,
kind,
x: m + 0.5,
y: 3,
left: [0, 1],
azimuthDeg: 0,
ground: null,
});
const savedStations = [
st("grid:340", 340, "grid"),
st("pipe:p35100", 351, "pipe"),
st("grid:360", 360, "grid"),
];
// 노선 초안: 교점 끌기 → 관이 좌표 따라 354 로(410) · 일반 측점은 같은 m
const draftStations = [
st("grid:340", 340, "grid"),
st("pipe:p35100", 354, "pipe"),
st("grid:360", 360, "grid"),
];
const oldKeys = savedStations.map((s) => s.key);
const source = crossMod.pipelineCrossSource("p1", saved, savedStations, null);
const draft = detailMod.draftSectionDetail(
saved,
{ stations: draftStations, longitudinal: { chainageM: [0, 400], z: [0, 0] } },
{},
null,
source.specs,
20,
);
const swapped = swapMod.swapCrossSections(saved, draftStations, oldKeys, 20).detail;
const ids = (detail) => detail.cross_sections.map((s) => s.station_id);
const swappedIds = new Set(ids(swapped));
const pipeCard = draft.cross_sections[1];
// 새 측점(초안에서 처음 생긴 일반 측점) = 누가거리 번호
const added = detailMod.draftSectionDetail(
saved,
{
stations: [...draftStations, st("grid:380", 380, "grid")],
longitudinal: { chainageM: [0, 400], z: [0, 0] },
},
{},
null,
source.specs,
20,
);
console.log(
JSON.stringify({
draftIds: ids(draft),
allFoundInSwapped: ids(draft).every((id) => swappedIds.has(id)),
sameOrder: JSON.stringify(ids(draft)) === JSON.stringify(ids(swapped)),
pipeCard: [
pipeCard.station_id,
pipeCard.chainage_m,
pipeCard.culvert && pipeCard.culvert.chainage_m,
],
longIds: draft.longitudinal.stations.map((s) => s.station_id),
addedId: added.cross_sections[3].station_id,
}),
);