- 433-4 갈아끼움이 curveMoves 거꾸로 맵으로 옛 MC 횡단을 이어 받음 — 설계 · 측점 id · moves 짝 남음 - 433-11 자리 · 축 같은 앞 단면은 지반 표본 · 상단측 · 중심고 그대로 — 덧 측점 넣기 · 빼기 뒤 누가토량 = 서버 - 433-19 Span_Control.update(culvertopt 큐) 걷음 — 구간 줄은 다단 벽만 - 433-20 표 위 CAD 요소 2000 넘음 = 초안에 안 씀 · 알림(서버 max_length 짝) - 시험 test_433_4 · test_433_11 · test_433_19_20 새로 · 346_2 단언 · 440 헬퍼 로더 맞춤 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
124 lines
4.2 KiB
JavaScript
124 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|common_util_station_key)$/;
|
|
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,
|
|
}),
|
|
);
|