- 짝 `common_util_structure_attach.ts` attachShapes ↔ `B06_Section_Engine_Attach.py` attach_shapes — 열쇠 걷고 관 세트 → 벽 → 포장 → 맹암거 → 빈칸 경고(측점 계획 자리 · 「옹벽 높이」 · 「배관 관경」 · 「맹암거 암거 높이」 · 「물넘이포장 월류 높이」) - 서버 `_read_section_detail` · 재생성 응답 = attach_saved_shapes 하나 · 화면 `withDraftShapes`(현황 = 초안 ?? 저장분 · 초안 없어지면 저장분으로 한 번) — decorate 관 세트 · withDraftPipeKinds · 맹암거 · 포장 · 벽 블록 걷음 · 구조물 초안 없을 때 미리 뜬 횡단에 포장 · 벽 · 맹암거 빠지던 것 · 반폭 넓힘 뒤 날 상세(초안 빠짐) 고침 - 파이썬 얹기 = 목록 함수(culvert_sets_from · attach_culvert_specs · wall_specs_from · attach_wall_specs · underdrains_from · attach_underdrain_specs) + 옛 파일 함수는 감쌈 - 3D 지문 = SHAPE_KEYS(`common_util_structure_shape_keys.ts`) + 조작값 통째(손 해시 걷음 · 벽 기초 · 단 · 포장 · 맹암거 빠짐) · C군 벽 = 기준 측점과 가장 가까운 측점에서만 시작 ~ 끝 스윕(`wallSweepAt`) - 소단 = 표 형상 berm(BERM_TYPE_ID 걷음 · 화면 isBermType · 서버 catalog_row) - 시험: test_323_4_attach_mirror(42종 + 빈칸 · 서버 = 화면 · 옛 자리 걷힘 · 벽 한 번 · 지문) · 전수 표 ★ 둘(물넘이포장 걸친 격자 100 = 서버와 같음 · STAGE 4) · 옛 도움 파일 = 측점 → 형상 차례 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ji4nuyLVHcxrXWHTdb5nRD
65 lines
3.2 KiB
JavaScript
65 lines
3.2 KiB
JavaScript
/* PLAN 323-4 형상 얹기 한 벌 헬퍼 — 진짜 `common_util_structure_attach.ts`(attachShapes) · 3D 지문 ·
|
|
* 벽 한 번(`B05_Profile_UI_Corridor_Structures_Hash.ts`)을 그 자리에서 트랜스파일해 Node 로 돌림 · 결과 = 표준출력 JSON.
|
|
* 입력 = argv[2] JSON `{definition, types, cases: {이름: {sections, pipes, structures}}}`. 짝 = `test_323_4_attach_mirror.py`.
|
|
*/
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const ROOT = path.join(__dirname, "..", "..");
|
|
const ts = require(path.join(ROOT, "config", "node_modules", "typescript"));
|
|
|
|
const cache = new Map();
|
|
function load(file) {
|
|
const full = path.resolve(file);
|
|
if (cache.has(full)) return cache.get(full);
|
|
if (full.endsWith(".json")) return JSON.parse(fs.readFileSync(full, "utf8"));
|
|
const js = ts.transpileModule(fs.readFileSync(full, "utf8"), {
|
|
compilerOptions: {
|
|
module: ts.ModuleKind.CommonJS,
|
|
target: ts.ScriptTarget.ES2020,
|
|
esModuleInterop: true,
|
|
},
|
|
}).outputText;
|
|
const box = { exports: {} };
|
|
cache.set(full, box.exports);
|
|
const need = (spec) => {
|
|
const base = path.join(path.dirname(full), spec);
|
|
const hit = [`${base}.ts`, base.replace(/\.js$/, ".ts"), base].find(
|
|
(p) => fs.existsSync(p) && fs.statSync(p).isFile(),
|
|
);
|
|
if (!hit) throw new Error(`모름: ${spec} (${full})`);
|
|
return load(hit);
|
|
};
|
|
new Function("exports", "module", "require", js)(box.exports, box, need);
|
|
return box.exports;
|
|
}
|
|
|
|
const input = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
|
|
const catalog = load(path.join(ROOT, "common_util", "common_util_structure_catalog.ts"));
|
|
const attach = load(path.join(ROOT, "common_util", "common_util_structure_attach.ts"));
|
|
const hash = load(path.join(ROOT, "B05_Profile", "B05_Profile_UI_Corridor_Structures_Hash.ts"));
|
|
catalog.useCatalogDefinition({ types: input.types, ...input.definition });
|
|
|
|
const out = { cases: {} };
|
|
for (const [name, { sections, pipes, structures }] of Object.entries(input.cases)) {
|
|
attach.attachShapes(sections, pipes, structures, input.types);
|
|
out.cases[name] = sections;
|
|
}
|
|
|
|
// 3D 벽 한 번 — 옹벽 93 ~ 113(기준 101)이 덮는 측점 넷 중 기준 측점만 · 스윕 = 시작 ~ 끝
|
|
const wall = { structure_id: "w1", start_m: 93, anchor_m: 101, end_m: 113 };
|
|
const covered = [93, 100, 101, 113].map((at) => ({ chainage_m: at, revetment: { ...wall } }));
|
|
out.sweep = covered.map((section) => hash.wallSweepAt(section, covered));
|
|
|
|
// 3D 지문 — 손 해시가 빠뜨린 칸(벽 기초 · 포장 · 맹암거)도 바뀌면 다름 · 구조물 없는 측점 = 빈 목록
|
|
const base = { chainage_m: 0, revetment: { ...wall, foundation: null } };
|
|
const fp = (section) => JSON.stringify(hash.structureHashParts(section));
|
|
out.fingerprint = {
|
|
same: fp(base) === fp({ chainage_m: 0, revetment: { ...wall, foundation: null } }),
|
|
foundation: fp(base) !== fp({ ...base, revetment: { ...wall, foundation: "기초유" } }),
|
|
pavement: fp(base) !== fp({ ...base, pavement: [{ type_id: "pavement_concrete" }] }),
|
|
underdrain: fp(base) !== fp({ ...base, underdrain: { height_m: 0.5 } }),
|
|
adjust: fp(base) !== fp({ ...base, design: { revet_adjust: { own: { x: 1 } } } }),
|
|
plain: hash.structureHashParts({ chainage_m: 0 }).length === 0,
|
|
};
|
|
process.stdout.write(JSON.stringify(out));
|