Files
Aislo/resources/tester/helper_54_14_balloon_lines.cjs
T
eomsangdonandClaude Opus 5.5 185e74646e feat(profile): 종단 알약 정보 라벨 — 맨 위 층 · ▲▼ 위로 비킴 · 이름 · 기준 측점 · 컨테이너마다 첫 값(54-14)
- 레인 쌓임 층 풂 · 라벨 z 6 — ▲▼ 단추층 · 고정 Y축 · 테이블 · 유토곡선 위
- 라벨을 그래프 바닥 ▼ 단추 높이만큼 위로 · 위가 잘리면 덜 잘리는 쪽(알약 아래)
- 줄 = 종류 이름 · 기준 측점 · 좌측 폼 컨테이너마다 첫 옵션 값 · 빈 값 (기본) · auto (자동) · 메모 뺌
- B05 · B06 공용 레인 한 곳 · 시험 test_54_14_balloon_lines · ORCA 시나리오 54-14_알약_라벨

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MPcuokNm1ZR2kqgGGDfaJA
2026-10-06 12:02:00 +09:00

122 lines
4.3 KiB
JavaScript

/* 54-14 종단 알약 정보 라벨 줄 단위검증 헬퍼 — TS 를 그 자리에서 트랜스파일해 Node 로 돌린다.
* 결과는 표준출력에 JSON 한 벌. 화면 그릇은 쓰지 않는다.
*
* ⚠ 확장자가 `.cjs` 인 까닭은 `helper_b05_structures_form_summary.cjs` 머리와 같다.
*/
const fs = require("fs");
const path = require("path");
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
const ROOT = path.join(__dirname, "..", "..");
const cache = new Map();
function loadTs(file) {
const full = path.resolve(file);
if (cache.has(full)) return cache.get(full);
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.exports);
const localRequire = (request) => {
if (request.startsWith(".")) return loadTs(path.join(path.dirname(full), `${request}.ts`));
return require(request);
};
new Function("exports", "module", "require", js)(box.exports, box, localRequire);
cache.set(full, box.exports);
return box.exports;
}
const { balloonLines } = loadTs(
path.join(ROOT, "B05_Profile", "B05_Profile_UI_Structures_Balloon.ts"),
);
const opt = (key, label, extra = {}) => ({ key, label, default: null, unit: null, ...extra });
const TYPES = {
pipe: {
type_id: "pipe",
name: "배관",
options: [
opt("pipe_diameter_mm", "관경", { default: "1000" }),
opt("inlet_type", "유입", { default: "기슭막이" }),
],
groups: [
{ id: "grv6lny", name: "관", options: [] },
{ id: "gnbf9m9", name: "관 보호공(유입)", options: [] },
{ id: "g9lq9uk", name: "관 보호공(유출)", options: [] },
],
spec_names: { soil_add: "흙막이 추가" },
},
box_culvert: {
type_id: "box_culvert",
name: "BOX암거",
options: [
opt("body_width_m", "폭", { default: 2 }),
opt("body_height_m", "높이", { default: 2 }),
],
groups: [],
},
cross_underdrain: {
type_id: "cross_underdrain",
name: "맹암거",
options: [
opt("culvert_height_m", "높이", { unit: "m" }),
opt("culvert_slope_pct", "기울기", { unit: "%" }),
],
groups: [
{ id: "gcrossud", name: "맹암거", options: ["culvert_height_m", "culvert_slope_pct"] },
],
},
retaining_wall: {
type_id: "retaining_wall",
name: "옹벽",
options: [
opt("height_m", "높이", { default: 2, unit: "m", visible: false }),
opt("length_m", "길이", { default: 10, unit: "m" }),
],
groups: [{ id: "gretaindetail", name: "상세 내용", options: ["height_m", "length_m"] }],
},
mirror: { type_id: "mirror", name: "반사경", options: [], groups: [] },
etc: { type_id: "etc", name: "기타", options: [opt("name", "이름")], groups: [] },
};
const point = (type_id, options = {}) => ({
structure_id: type_id,
type_id,
placement: "point",
chainage_m: 100,
options,
memo: "메모는 안 씀",
});
const head = (name) => ({ name, position: "5+0" });
const run = (structure, count) =>
balloonLines(structure, TYPES[structure.type_id], head("이름"), count);
const out = {
pipeFull: run(
point("pipe", {
pipe_diameter_mm: 1200,
inlet_type: "집수정",
inlet_structure: "L",
outlet_type: "기슭막이",
soil_add_1_structure: "기슭막이",
soil_add_1_form: "돌망태",
chute_add_1_structure: "도수로",
}),
),
pipeBlank: run(point("pipe")),
// 흙막이 개수 = 밖에서 정한 단 수(2) — 저장 1 벌 · 모자란 둘째는 빈 상자
pipeCount: run(point("pipe", { soil_add_1_structure: "기슭막이" }), (id) =>
id === "soil_add" ? 2 : undefined,
),
boxPreset: run(point("box_culvert", { body_width_m: 3, body_height_m: 3, wing_in: "있음" })),
boxBlank: run(point("box_culvert")),
underdrain: run(point("cross_underdrain", { culvert_height_m: 0.6 })),
underdrainBlank: run(point("cross_underdrain")),
wall: run(point("retaining_wall")),
wallAuto: run(point("retaining_wall", { length_m: "auto" })),
mirror: run(point("mirror", { anything: 1 })),
etcEmpty: run(point("etc", { name: "안내판" })),
etcNote: run(point("etc", { name: "안내판", etc_detail_1_note: "시험 비고" })),
};
process.stdout.write(JSON.stringify(out));