Files
Aislo/resources/tester/helper_177_3_station_line_keep.cjs
T
eomsangdonandClaude Opus 5.5 dfd7427c46 feat(b06): 횡단도 바로 반영 — 새로 놓거나 옮긴 관 · 구조물의 횡단 카드를 [저장] 전에 보임 (273-2)
- 서버: 읽기 전용 미리 뜨기 POST /section/preview-stations — 로그인 · 회사 · 프로젝트 권한 그대로 · 한 번에 60곳 · 파일 · DB 안 씀 · 저장과 같은 길(sample_structure_sections · compute_default_designs crosses)
- 화면: 초안이 심는 자리 중 횡단 없는 곳만 묻고 한 번 뜬 자리는 기억(B06_Section_Section_Drafts) · 카드 이름 · 관 그림 얹음 · 늦은 옛 응답 무시 · 배수 재계산이 관경을 정하면 카드 다시 얹음 · B06 관 옮김도 카드 다시
- [저장]은 지금처럼 서버가 같은 계산으로 정본에 씀 — 미리 본 카드와 같은 값
- 알림 글: 횡단도는 바로 보이고 세부 배수유역만 저장 뒤 다시 셈
- 시험: test_273_2 새로 · 177-3 헬퍼에 revealPick 자리 채움

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LLCk2y5xE8YGVgjbTntWsY
2026-10-11 20:48:32 +09:00

66 lines
3.1 KiB
JavaScript

/* 177-3 횡단 카드 ↔ 종단 측점선 헬퍼 — 진짜 design_profile.ts 의 `setSelectedStation` · `setSelectedStructure`
* 본문을 떼어(TS 는 그 자리 트랜스파일) 측점 · 구조물 짝 흉내에 붙이고, B06 카드 고름 차례
* (showCard → setSelectedStation · 리스너 → selectMark → setSelectedStructure(mark, true))와 B05 기본 길을 돌려
* 남은 측점선 id 를 표준출력 JSON 한 벌로.
*/
const fs = require("fs");
const path = require("path");
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
const ROOT = path.join(__dirname, "..", "..");
const src = fs.readFileSync(path.join(ROOT, "A00_Common", "design", "design_profile.ts"), "utf8");
const method = (name) => {
const pattern = String.raw`\r?\n ${name}\([^\r\n]*\) \{\r?\n[\s\S]*?\r?\n \},`;
const match = src.match(new RegExp(pattern));
if (!match) throw new Error(`본문 없음: ${name}`);
return match[0];
};
const body = `
let selectedStationId = null;
let selectedStructureId = null;
// 관(pipe-80.17)만 측점선(irr-80)이 있음 — 벽 · 노면공은 선 없음(PST stationIdAtStructure)
const structureIdAtStation = (stationId) => (stationId === "irr-80" ? "pipe-80.17" : null);
const stationIdAtStructure = (structureId) => (structureId === "pipe-80.17" ? "irr-80" : null);
const draw = () => {};
const revealPick = () => {}; // 화면 밖이면 가운데로(273-1) — 이 시험 몫 아님
module.exports = {
line: () => selectedStationId,
${method("setSelectedStation")}
${method("setSelectedStructure")}
};`;
const js = ts.transpileModule(body, {
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
}).outputText;
const box = { exports: {} };
new Function("exports", "module", js)(box.exports, box);
const dp = box.exports;
/** B06 카드 고름 — showCard(카드 · 관 측점이면 관 선) 뒤 리스너가 selectMark(mark) = keepStation true. */
const b06Card = (lineId, mark) => {
dp.setSelectedStation(lineId);
dp.setSelectedStructure(mark, true);
return dp.line();
};
/** B05 목록 고름 — 기본값(keepStation 없음). */
const b05Pick = (lineId, structureId) => {
dp.setSelectedStation(lineId);
dp.setSelectedStructure(structureId);
return dp.line();
};
const out = {
plainCard: b06Card("s40", null), // 일반 카드 — 덮는 것 없음
wallCard: b06Card("s100", "wall"), // 벽(선 없는 구조물) 카드
paveCard: b06Card("s140", "pave"), // 노면공 범위 안 카드
pipeCard: b06Card("irr-80", "pipe-80.17"), // 관 카드 = 관 선
pipeFromPlain: b06Card("s60", "pipe-80.17"), // 관 알약 = 관 선으로 옮김
// 반대 길 — 종단 측점선 누름 → 카드 고름 → 같은 리스너(selectMark null)
profileClick: b06Card("s200", null),
// 카드 풂 = showCard(null) → 선 끔
release: (dp.setSelectedStation(null), dp.line()),
b05Wall: b05Pick("s100", "wall"), // B05 = 지금 그대로(선 없는 구조물 → 선 끔)
b05Pipe: b05Pick("s40", "pipe-80.17"),
b05Keep: b05Pick("irr-80", "pipe-80.17"),
};
process.stdout.write(JSON.stringify(out));