- `design_pipe_ids.ts` — 장부(세션 pipe-ids) · pipe-s{차례} · 자리 → id(찾는 거리 안 가장 가까운 것) · followMovedPipe 가 id 를 새 자리로(고름 id 그대로 · 순환 import 없게 design_selection 에서 옮김) · 설계 페이지가 프로젝트를 정함(usePipeIds) · 자리 이름 만들기 열 곳 · 되읽기 둘 걷음 · 측점 계획 주인 = 세션 id(withPipeIds)
- `design_pick_match.ts` — pickLights(① id ② 같은 자리 ③ 고른 부분) · paintPicked(카드 통째 형상 · 부분 · 관 계열 · 포장층은 제 손잡이) · tagShape — 관 세트 벽 · 집수정 · 관 · 세월교 측벽 · 몸체 · BOX 끝 · C군 벽 · 물넘이 콘크리트에 신원표 · 형상 판정면은 통째 형상 · 콘크리트만
- 3D — 부재 맞춤 = pickLights(옛 0.01 걷음) · C군 벽 솔리드 = 구조물 id(덮는 측점 어디서 골라도 한 번 스윕한 벽이 켜짐)
- 322-0 이 깬 것 고침 — 노면공 흐름 도움 파일(165 · 231-1) 정의 판 확인 흉내 · design_view_profile 700줄(322-0 이 704)
- 시험: test_323_5_pick(세션 id · 옮김 · 강조 규칙 · 칠하기) · 옛 시험 도움 파일 흉내 · 기대 글 고침
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ji4nuyLVHcxrXWHTdb5nRD
120 lines
5.0 KiB
JavaScript
120 lines
5.0 KiB
JavaScript
/* 270-1 횡단 보기 배수유역도 = 고름 한 칸에서 파생 — 진짜 TS 를 Node 로 돌림.
|
|
* `bindCrossPick`(B06_Section_UI_Page_Pick_Sync) + 진짜 `paintMapPick`(design_pick_profile) + 지도 흉내.
|
|
* 표준출력 JSON 한 벌 · 짝 = test_270_1_cross_map.py.
|
|
*/
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const ROOT = path.join(__dirname, "..", "..");
|
|
const NM = path.join(ROOT, "config", "node_modules");
|
|
const ts = require(path.join(NM, "typescript"));
|
|
|
|
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}`);
|
|
};
|
|
new Function("exports", "module", "require", js)(box.exports, box, localRequire);
|
|
return box.exports;
|
|
}
|
|
|
|
globalThis.window = { addEventListener() {}, removeEventListener() {} };
|
|
globalThis.document = { addEventListener() {}, removeEventListener() {} };
|
|
|
|
const store = new Map();
|
|
const DSel = loadTs("A00_Common/design/design_selection.ts", {
|
|
"../b_page_state": {
|
|
readState: (key, pid) => store.get(`${key}:${pid}`) ?? null,
|
|
writeState: (key, value, pid) => store.set(`${key}:${pid}`, value),
|
|
},
|
|
});
|
|
const ESC = loadTs("A00_Common/design/design_pick_escape.ts", { "./design_selection": DSel });
|
|
const IRR = {
|
|
irregularStationId: (id) => `irregular:${id}`,
|
|
isPipeStation: (s) => s.origin === "pipe",
|
|
};
|
|
const SY = loadTs("B05_Profile/B05_Profile_UI_Selection.ts", {
|
|
"../A00_Common/design/design_selection": DSel,
|
|
"./B05_Profile_UI_IrregularStations": IRR,
|
|
});
|
|
const PP = loadTs("A00_Common/design/design_pick_profile.ts", {
|
|
"./design_selection": DSel,
|
|
"./design_pipe_ids": { pipeIdAt: (at) => `pipe-${at.toFixed(2)}` }, // 프로젝트 없음 = 옛 자리 이름(323-5)
|
|
"./design_pick_escape": ESC,
|
|
"../../B05_Profile/B05_Profile_UI_Selection": SY,
|
|
"../../B05_Profile/B05_Profile_UI_IrregularStations": IRR,
|
|
});
|
|
const SYNC = loadTs("B06_Section/B06_Section_UI_Page_Pick_Sync.ts", {
|
|
"../A00_Common/design/design_selection": DSel,
|
|
"../A00_Common/design/design_pick_escape": ESC,
|
|
});
|
|
|
|
const PID = "p270";
|
|
/* 지도 흉내 — 관 셋(95.38 · 195.3 · 292.22) · 고른 관 = 찾는 폭 안 관(배수유역도 `selectPipeAtChainage` 꼴) */
|
|
const PIPES = [95.38, 195.3, 292.22];
|
|
const map = {
|
|
calls: [],
|
|
pipe: null,
|
|
station: null,
|
|
selectPipeAtChainage(at, notify = true) {
|
|
this.calls.push(["pipe", at, notify]);
|
|
this.pipe =
|
|
at === null ? null : (PIPES.find((c) => Math.abs(c - at) < DSel.PIPE_MATCH_M) ?? null);
|
|
},
|
|
markStation(at) {
|
|
this.calls.push(["mark", at]);
|
|
this.station = at;
|
|
},
|
|
};
|
|
let visible = true;
|
|
let reapplied = 0;
|
|
const disposers = [];
|
|
const host = { visible: () => visible, onDispose: (fn) => disposers.push(fn) };
|
|
const deps = {
|
|
sections: () => [],
|
|
controls: {
|
|
revetOffset: { highlightFor: () => false, selectedFor: () => false, select() {} },
|
|
ford: { selectedFor: () => false, select() {} },
|
|
box: { selectedFor: () => false, select() {} },
|
|
},
|
|
releaseForm() {},
|
|
view: { focusStation() {}, refreshCards() {}, selectMark() {} },
|
|
reapply: () => reapplied++,
|
|
paintMap: (selection) => PP.paintMapPick(map, selection),
|
|
};
|
|
const pick = SYNC.bindCrossPick(PID, host, deps);
|
|
const snap = () => ({ pipe: map.pipe, station: map.station, reapplied, calls: map.calls.length });
|
|
const out = {};
|
|
|
|
// ① 횡단 보기 안 누름(from b06) — 지도는 칠하고 넘김 적용은 안 함
|
|
DSel.selectDesign(PID, { chainageM: 95.38, structureId: null }, { from: "b06" });
|
|
out.b06Pipe = { ...snap(), notify: map.calls[0]?.[2] };
|
|
// ② 일반 측점 카드(관 없음) — 옛 관 강조가 풀리고 마름모만
|
|
DSel.selectDesign(PID, { chainageM: 80, structureId: null }, { from: "b06" });
|
|
out.b06Card = snap();
|
|
// ③ 지도에서 고름(from map) — 지도 칠함 + 넘김 적용(카드 · 폼 · 알약 · 표 열)
|
|
DSel.selectDesign(PID, { chainageM: 292.22, structureId: null }, { from: "map" });
|
|
out.fromMap = snap();
|
|
// ④ 노면공(범위 · 기준 30) — 관 없음 · 넘김 적용
|
|
DSel.selectDesign(PID, { chainageM: 30, structureId: "pave" }, { from: "b05" });
|
|
out.pave = snap();
|
|
// ⑤ 풀기(from b06) — 지도 풂
|
|
DSel.selectDesign(PID, DSel.NO_SELECTION, { from: "b06" });
|
|
out.release = snap();
|
|
// ⑥ 숨은 보기 — 안 칠함 · 안 적용
|
|
visible = false;
|
|
const before = map.calls.length;
|
|
DSel.selectDesign(PID, { chainageM: 195.3, structureId: null }, { from: "map" });
|
|
out.hidden = { calls: map.calls.length - before, reapplied };
|
|
// ⑦ 다시 보임 뒤 다른 곳(종단 보기)이 바꾼 값 = 칠함 + 넘김 적용
|
|
visible = true;
|
|
DSel.selectDesign(PID, { chainageM: 95.38, structureId: null }, { from: "b05" });
|
|
out.show = snap();
|
|
pick.release(); // 풀기 길은 그대로(값은 부르는 쪽이 비움)
|
|
out.releaseKeepsMap = map.pipe;
|
|
|
|
process.stdout.write(JSON.stringify(out));
|