feat(485-1 B07 축척): 도면 X · Y 축척 서버 — 프로젝트마다 drawing_scales.json · GET/PUT /api/projects/{id}/drawing-scales · 엔진 drawing_scale(kind) 문맥 변수 · 종단 · 횡단(X ≠ Y) · 토적 · 전개도 · 바뀐 종류 저장본 풂 · 덧그림 mm_per_m_x · _y · 범위 밖 400 · 시험 test_280_5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-19 22:23:02 +09:00
co-authored by Claude Opus 5.5
parent afe6e4a799
commit 8c53124348
15 changed files with 732 additions and 58 deletions
@@ -19,6 +19,7 @@ from typing import Any
from uuid import UUID
from B05_Profile.B05_Profile_Engine_Sections import cross_station
from B07_DesignDetail.B07_DesignDetail_Engine_Cad import cross_mm
from common_util.common_util_node_bundle import bundle_stale, run_bundle_json
logger = logging.getLogger(__name__)
@@ -60,14 +61,16 @@ async def cross_overlay_extents(project_id: UUID | str, route_id: int) -> dict[i
dump = getattr(response, "model_dump", None)
if dump is None: # JSONResponse = 실패
return {}
detail = dump(mode="json")
# 종이 mm 글자 폭이 m 로 바뀌는 몫이 축척에 기댐 — 프로젝트 횡단 축척을 같이 넘김(485)
mm_x, mm_y = cross_mm()
payload = {"detail": dump(mode="json"), "mm_per_m_x": mm_x, "mm_per_m_y": mm_y}
key = hashlib.sha1(
json.dumps(detail, sort_keys=True, default=str).encode("utf-8")
json.dumps(payload, sort_keys=True, default=str).encode("utf-8")
).hexdigest()
# 번들이 낡았으면(화면 TS 가 바뀜) 기억을 버리고 다시 잰다 — 다시 빌드도 함께.
if key in _CACHE and not await asyncio.to_thread(bundle_stale, BUNDLE):
return _CACHE[key]
output = await asyncio.to_thread(run_bundle_json, BUNDLE, _NPM_SCRIPT, {"detail": detail})
output = await asyncio.to_thread(run_bundle_json, BUNDLE, _NPM_SCRIPT, payload)
except Exception:
logger.warning("B07 덧그림 범위 계산 실패 — 서버 그림만으로 배치", exc_info=True)
return {}