Files
Aislo/resources/tester/helper_384_4_adjusts.cjs
T
eomsangdonandClaude Opus 5.5 d3315da993 refactor(472-3 B06 벽 · 기슭막이 · 배치): 구조물 기하 logic 분리 · 그림 파일은 그리기만
- logic 새 파일 다섯 — Cross_Wall_Geom(벽 1매) · Cross_Wall_Hatch_Geom(무늬 띠 · 물빼기 · 도수로 띠 · 원지반선) · Cross_Excavation_Geom(벽 터파기) · Cross_Design_Surface_Geom(암선 · 포장층) · Cross_Revetment_Geom(독립 기슭막이 배치)
- logic 으로 옮김 — Body_Guard → Cross_Body_Guard · Structure_Layouts · Route_Carry_Patch(내용 그대로 · import 경로만)
- inferStationInterval → common_util_station(글자표 없는 자리 · common_util_svg 는 다시 내보냄) — Node 묶음 ui_template_locale 끌림 끊음
- 부르는 쪽 import 줄 · 등록부 ts 경로 · 시험 · 도우미 경로
- test_472_3 GEOMETRY_PULLS 다섯 줄 걷음 · Wall_Hatch · Excavation · Design_Surface 세 줄은 Culvert · Box · Ford 그림 파일(518-2)이 그리기 함수로 부르는 동안 남김

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 19:22:27 +09:00

78 lines
3.2 KiB
JavaScript

/* 387-4 헬퍼 — 저장 안 한 조정창 값(세션)을 상세 가게가 얹는지(`B06_Section_Section_Adjusts`) · 얹은 뒤 구조물
* 면적(`structureAreaRows`)이 그 값으로 바뀌는지 · 다른 노선 칸은 안 얹는지. 짝 = `test_384_4_cross_window.py`.
*/
const fs = require("fs");
const path = require("path");
const { makeLoader } = require("./helper_ts_stub_loader.cjs");
const CATALOG = require("./helper_322_catalog_module.cjs"); // 구조물 표(322-1)
const ROOT = path.join(__dirname, "..", "..");
const STUBS = { "@ui/ui_template_toast": { showToast: () => undefined } };
const { loadTs } = makeLoader({
root: ROOT,
interop: true,
requireFor: (full) => (request) => {
if (CATALOG.isCatalogRequest(request)) return CATALOG;
if (STUBS[request]) return STUBS[request];
const alias = { "@util/": "common_util", "@ui/": "ui_template", "@config/": "config" };
for (const [prefix, dir] of Object.entries(alias))
if (request.startsWith(prefix))
return loadTs(resolve(path.join(ROOT, dir, request.slice(prefix.length))));
return loadTs(resolve(path.join(path.dirname(full), request)));
},
});
const resolve = (base) =>
[base, `${base}.ts`, path.join(base, "index.ts")].find(
(p) => fs.existsSync(p) && fs.statSync(p).isFile(),
) ?? `${base}.ts`;
function memoryStorage() {
const map = new Map();
return {
getItem: (k) => (map.has(k) ? map.get(k) : null),
setItem: (k, v) => map.set(k, String(v)),
removeItem: (k) => map.delete(k),
key: (i) => [...map.keys()][i] ?? null,
get length() {
return map.size;
},
};
}
globalThis.window = { sessionStorage: memoryStorage(), localStorage: memoryStorage() };
const B06 = (f) => path.join(ROOT, "B06_Section", `${f}.ts`);
const { structureAreaRows } = loadTs(B06("logic/B06_Section_Structure_Layouts"));
const { withDraftAdjusts } = loadTs(B06("B06_Section_Section_Adjusts"));
const { writeState } = loadTs(path.join(ROOT, "A00_Common", "b_page_state.ts"));
const sections = JSON.parse(
fs.readFileSync(path.join(__dirname, "fixtures", "b06_186_1_pipe_292.json"), "utf8"),
).cross_sections;
const detail = { cross_sections: sections };
const section = sections.find((s) => s.culvert);
const at = section.chainage_m.toFixed(2);
const area = () => {
const row = structureAreaRows(sections).find((r) => r.chainage_m === section.chainage_m);
return row ? [row.cut_area_m2, row.fill_area_m2] : null;
};
const out = { before: area() };
// 다른 노선 칸 — 안 얹음
writeState("revetx", { [`${at}:outlet`]: { x: 3, d: null, h: null, m: null } }, "p", 8);
withDraftAdjusts(detail, "p", 7);
out.otherRoute = section.design.revet_adjust?.outlet ?? null;
// 이 노선 — 유출 벽 4축 · 유입 형식 · 다단 수
writeState("revetx", { [`${at}:outlet`]: { x: 1.5, d: 0, h: null, m: null } }, "p", 7);
writeState("inletstruct", { [at]: "L" }, "p", 7);
writeState("extrawall", { [at]: 2 }, "p", 7);
withDraftAdjusts(detail, "p", 7);
out.laid = {
revet: section.design.revet_adjust.outlet,
inlet: section.design.inlet_structure,
extra: section.design.extra_wall_counts,
};
out.after = area();
withDraftAdjusts(detail, "p", 7);
out.again = area();
process.stdout.write(JSON.stringify(out));