- 부품 상자 common_util_structure_parts.json(갈래마다 부품 · 읽는 칸 · 자리꼴 · 정본 · 42종 처음값) · 표 읽기 common_util_structure_catalog.ts / .py 짝(정의 반영 ⊕ 처음값 ⊕ 부품 끔) · 거울 시험 test_322_1_catalog_mirror - 목록: pickGroups 군 차례 = 구조물군 열쇠 · 페이지 거르기 listPick(B05 both · B06 both + b06) · HIDDEN_PICK_GROUPS · HIDDEN_PICK_TYPES · pickable 걷음(옛 대피 셋 asRoad 그대로) - 측점: structureStationMarks · pipeStationMarks · is_station_planting_type · resolve_extra_stations = 표 횡단도(anchor · span3 · none) - 카드 이름: cardTitle / card_title 한 공식(빈칸 = 그 종류 정의 기본값) · 표시 이름이 정의 관종도 앎 - 형상: 벽 = shape wall(형태 = 형상칸.form · 물빼기 = 형상칸.weep) · 포장 = shape pavement(「사용 중」 거르기 없앰) · 맹암거 · 사토 · 관 지점 시설 세트 = shape - 3D 몸체 = 그림 자료 주인 종류의 표 3D 부품 · 알약 띠 = 표 자리꼴 구간(관 지점 시설은 알약만) - ★1 노출형 · 개거 횡단도 none · ★2 쇄석 화면에서도 포장층 · ★3 기슭막이 표 자리꼴 interval(정의 파일 그대로) · ★4 코드 숨김 10종 list hidden · ★5 관 빈칸 D800 → 정의 기본 D1000 - 옛 시험: 도움 파일 로더 27개가 표 모듈 공용 한 벌(helper_322_catalog_module) 씀 · 기대값 고침(272_1 · b05_extra_stations · roundtrip · 314 · 52_7 · walls 거울 · wall_drain_pipe) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ji4nuyLVHcxrXWHTdb5nRD
111 lines
4.3 KiB
JavaScript
111 lines
4.3 KiB
JavaScript
/* 284 알약 고름 헬퍼 — 진짜 `B05_Profile_UI_Profile_Structures.ts`(plantsStation · stationIdAtStructure ·
|
|
* structureIdKeeping)를 Node 로 돌려 표준출력 JSON 한 벌로(요구 178 · 179-1).
|
|
* 등록부 꼴 = 구조물정의.json 의 group · placement · managed_by 그대로.
|
|
*/
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
|
|
const CATALOG = require("./helper_322_catalog_module.cjs"); // 구조물 표(322-1)
|
|
|
|
const ROOT = path.join(__dirname, "..", "..");
|
|
|
|
function loadTs(file, stubs = {}) {
|
|
const js = ts.transpileModule(fs.readFileSync(file, "utf8"), {
|
|
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
|
|
}).outputText;
|
|
const box = { exports: {} };
|
|
const localRequire = (request) => {
|
|
if (CATALOG.isCatalogRequest(request)) return CATALOG;
|
|
if (stubs[request]) return stubs[request];
|
|
throw new Error(`stub 없음: ${request}`);
|
|
};
|
|
new Function("exports", "module", "require", js)(box.exports, box, localRequire);
|
|
return box.exports;
|
|
}
|
|
|
|
const selection = loadTs(path.join(ROOT, "A00_Common", "design", "design_selection.ts"), {
|
|
"../b_page_state": { readState: () => null, writeState() {} },
|
|
});
|
|
const PREFIX = "irregular:";
|
|
const rule = loadTs(path.join(ROOT, "B05_Profile", "B05_Profile_UI_Profile_Structures.ts"), {
|
|
"../A00_Common/touch_bridge": { pickPx: (px) => px }, // 기기대응 4-4 — 마우스 반경 그대로
|
|
"@ui/ui_template_context_menu": { createMapContextMenu() {} },
|
|
"./B05_Profile_UI_IrregularStations": {
|
|
irregularStationId: (id) => `${PREFIX}${id}`,
|
|
isPipeStation: (station) => station.origin === "pipe",
|
|
},
|
|
"./B05_Profile_Api_Structures": {
|
|
structureAnchorM: (s) => s.chainage_m ?? s.start_m ?? 0,
|
|
},
|
|
"../A00_Common/design/design_selection": selection,
|
|
"../common_util/common_util_structure_station": loadTs(
|
|
path.join(ROOT, "common_util", "common_util_structure_station.ts"),
|
|
),
|
|
});
|
|
|
|
const TYPES = [
|
|
{ type_id: "cross_underdrain", group: "A", placement: "point", managed_by: null },
|
|
{ type_id: "retaining_wall", group: "C", placement: "interval", managed_by: null },
|
|
{ type_id: "ditch_side", group: "B", placement: "interval", managed_by: null },
|
|
{ type_id: "hazard_sign", group: "E", placement: "point", managed_by: null },
|
|
{ type_id: "bed_sill", group: "D", placement: "point", managed_by: null },
|
|
];
|
|
const S = (id, type, at, extra = {}) => ({
|
|
structure_id: id,
|
|
type_id: type,
|
|
chainage_m: at,
|
|
...extra,
|
|
});
|
|
const STRUCTURES = [
|
|
S("drain", "cross_underdrain", 40),
|
|
S("wall", "retaining_wall", 100, { start_m: 90, end_m: 110 }),
|
|
S("ditch", "ditch_side", 80, { start_m: 60, end_m: 100 }),
|
|
S("sign", "hazard_sign", 80), // 관 측점(80)과 같은 m — 측점 없는 구조물
|
|
S("sill", "bed_sill", 140),
|
|
S("unknown", "legacy_x", 160),
|
|
S("pipe-80.00", "pipe", 80),
|
|
S("pipe-120.00", "ford_pavement", 120),
|
|
];
|
|
// 종단도 구조물 측점(관 투영 + 심은 구조물) — 물넘이포장도 측점 심음(286-1)
|
|
const STATIONS = [
|
|
{ id: "drain", chainage_m: 40, origin: "structure" },
|
|
{ id: "pipe-80.00", chainage_m: 80, origin: "pipe" },
|
|
{ id: "wall", chainage_m: 100, origin: "structure" },
|
|
{ id: "pipe-120.00", chainage_m: 120, origin: "pipe" },
|
|
];
|
|
const byId = (id) => STRUCTURES.find((s) => s.structure_id === id);
|
|
|
|
const plants = Object.fromEntries(
|
|
STRUCTURES.map((s) => [s.structure_id, rule.plantsStation(s, TYPES)]),
|
|
);
|
|
const line = Object.fromEntries(
|
|
STRUCTURES.map((s) => [
|
|
s.structure_id,
|
|
rule.stationIdAtStructure(s.structure_id, STATIONS, STRUCTURES, TYPES),
|
|
]),
|
|
);
|
|
// 종류 없이 부르면(옛 부름) 구조물은 옛 길 — 같은 자리 측점선
|
|
const lineNoTypes = rule.stationIdAtStructure("sign", STATIONS, STRUCTURES);
|
|
// 관 측점선(80)을 다시 누름 — 고른 것이 측점 없는 표지면 관 알약으로(표지는 선 짝 아님)
|
|
const keepSign = rule.structureIdKeeping(
|
|
`${PREFIX}pipe-80.00`,
|
|
"sign",
|
|
STATIONS,
|
|
STRUCTURES,
|
|
null,
|
|
TYPES,
|
|
);
|
|
// 고른 것이 관이면 그대로
|
|
const keepPipe = rule.structureIdKeeping(
|
|
`${PREFIX}pipe-80.00`,
|
|
"pipe-80.00",
|
|
STATIONS,
|
|
STRUCTURES,
|
|
null,
|
|
TYPES,
|
|
);
|
|
|
|
process.stdout.write(
|
|
JSON.stringify({ plants, line, lineNoTypes, keepSign, keepPipe, sample: byId("sign") }),
|
|
);
|