- M02 종류별 탭 [종류 더하기] = 본보기(구조물 정본 원본) 복사 — 키 자동 · 이름 「본보기 2」 · 옵션 · 표시 · 그룹 · 배치 · 규칙 · 종류 덧칸 · 반영 그대로 · 종류.{새}.본보기 · 관 지점 종류 · 복사본은 본보기 밖
- 구조물 표 = 본보기 처음값 이어받음(resolveCatalog · resolve_catalog 짝 · 줄 칸 base) · baseType/base_type · specFor(명세) · 덧단 · 길이 전후 풀기 · 옹벽 추가 단 콘크리트
- 검사(화면 = 서버 짝) — 본보기 = 원본 · 같은 군 · 자리꼴 · 정본 · 만든 뒤 고정 · 복사본은 본보기가 숨긴 칸 이어받음 · 서버 덧칸 본보기 받음
- 특수 동작 = 동작 이름 — 바로 안 놓기 · 포장 나누기 = 포장_물넘이_겹침 · 월류 높이 기다림 = 월류단면
- 정본 목록 = 표 — 파이썬 관 지점 종류 = catalog owner · B05 시설 서브폼 = 표 형상 · 안 쓰는 손 목록 걷음
- drawing_views — 스키마에서 빼고 읽을 때 버림 · M02 [저장] 때 빠짐(코드는 마스터 안 고침)
- 이관 = 지난 판 이름 대신 측점 계획 자리(planted)로 가름 · all_type_names 걷음
- 허용 거리 = common_util_structure_station.py 한 곳(SAME_STATION_M · EDGE_TOLERANCE_M · PIPE_MATCH_M) · TS 표는 station.ts 머리
- 시험: test_323_7_new_type(템플릿 · 일곱 갈래 · 그림 · 검사 짝 · 서버 읽기) · 322-0 유령 시험 = 자리 · 옛 도움 파일 동작 · 표 길 · 기대 글 고침
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ji4nuyLVHcxrXWHTdb5nRD
124 lines
4.5 KiB
JavaScript
124 lines
4.5 KiB
JavaScript
/* 54-14 종단 알약 정보 라벨 줄 단위검증 헬퍼 — TS 를 그 자리에서 트랜스파일해 Node 로 돌린다.
|
|
* 결과는 표준출력에 JSON 한 벌. 화면 그릇은 쓰지 않는다.
|
|
*
|
|
* ⚠ 확장자가 `.cjs` 인 까닭은 `helper_b05_structures_form_summary.cjs` 머리와 같다.
|
|
*/
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const CATALOG = require("./helper_322_catalog_module.cjs"); // 구조물 표(322-1)
|
|
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 (CATALOG.isCatalogRequest(request)) return CATALOG; // 구조물 표(본보기 · 323-7)
|
|
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));
|