- 화면 appendStructureEntities = 정본 상세 읽기 + placeStructureEntities 부름 · 동작 그대로 - 가짜 문서에 addEventListener · removeEventListener 빈 함수 — 화면 모듈이 불러올 때 거는 문서 이벤트로 덧그림 범위 Node 번들이 시작부터 멈추던 흠 (10-04 무렵부터 서버 장 배치가 덧그림 범위 없이 섬) - 시험 212 = 옮긴 자리에서 글 찾음 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013QyNXY2TUKXCFMwAca2APG
43 lines
2.2 KiB
TypeScript
43 lines
2.2 KiB
TypeScript
/* =============================================================================
|
|
* B07_DesignDetail_UI_Cad_Structures.ts
|
|
* 횡단도 **구조물 작도** — 배수관·기슭막이·세월교·BOX암거·물넘이포장.
|
|
*
|
|
* 산식은 새로 만들지 않는다. B06 화면이 쓰는 기하·그리기 함수를 **그대로** 불러
|
|
* 화면에 붙이지 않은 오프스크린 SVG에 그린 뒤, 그 도형을 CAD 엔티티로 옮긴다
|
|
* (2026-08-30 사용자 확정: 프론트에서 B06 산식 재사용 — 파이썬 포팅 금지).
|
|
* 앞으로 B06에 구조물·치수·글자가 붙으면 여기 손대지 않아도 도면에 따라온다.
|
|
*
|
|
* 자리 맞추기는 서버가 도면에 실어 보내는 `cross_placements`가 정한다:
|
|
* x_mm = offset*mm_per_m + ox, y_mm = (elev - dy)*mm_per_m + oy
|
|
* SVG는 y가 아래로 자라므로 그릴 때 부호를 뒤집고 수확할 때 되돌린다.
|
|
* ========================================================================== */
|
|
|
|
import type { CrossSection } from "../B06_Section/B06_Section_Api_Fetch";
|
|
import { loadSectionDetail } from "../B06_Section/B06_Section_Section_Store";
|
|
import { placeStructureEntities, type CrossPlacement } from "./B07_DesignDetail_Cross_Overlay";
|
|
|
|
export type { CrossPlacement };
|
|
|
|
/**
|
|
* 도면에 구조물 엔티티를 얹는다 (제자리 수정). 배치 메타가 없거나 자료를 못 읽으면
|
|
* 아무것도 하지 않는다 — 구조물이 빠져도 도면 자체는 열려야 한다.
|
|
*/
|
|
export async function appendStructureEntities(
|
|
projectId: string,
|
|
routeId: number,
|
|
drawing: { entities: Record<string, unknown>[]; cross_placements?: CrossPlacement[] },
|
|
): Promise<number> {
|
|
const placements = drawing.cross_placements ?? [];
|
|
if (!placements.length) return 0;
|
|
let sections: CrossSection[];
|
|
try {
|
|
// B05·B06과 같은 공유 캐시를 쓴다 — 도면마다 새로 받으면 장을 넘길 때마다
|
|
// 종횡단 상세를 다시 내려받아 0.2초씩 더 걸린다(2026-08-30 실측).
|
|
sections = (await loadSectionDetail(projectId, routeId)).cross_sections;
|
|
} catch {
|
|
return 0;
|
|
}
|
|
// 얹는 몸통 = `_Cross_Overlay.placeStructureEntities`(인쇄 Node 302-2 와 한 벌)
|
|
return placeStructureEntities(sections, drawing);
|
|
}
|