Files
Aislo/resources/tester/test_514_3_b07_basin_light.py
T
eomsangdonandClaude Opus 5.5 c316dbb106 feat(514-3 B07 유역도 등고선 가볍게): 유역도 등고선 · 계류 = 폴리선 하나 + 꼭짓점 목록(자식 Line · 선분마다 UUID 없음) — 요구 328-4
- 엔진: Engine_Cad_Basin 배경선만 꼭짓점 목록 폴리선(id 는 옛 폴리선과 같음) · 노선 · 유역 · 표 · 도각은 옛 꼴 그대로 · B05 · B06 길 손대지 않음
- CAD 앱: PolyLineEntity.fromJson 이 자식 없고 꼭짓점 목록이면 선분으로 펼침(색 · 굵기 · 층 = 부모) · 다시 내보내면 옛 꼴
- DXF 내보내기 · B09 도면 인쇄 PDF: 꼭짓점 목록 폴리선 = 열린 선(해치만 닫음)
- 검증_sub2 유역도 5 m 23.17 → 3.22 MB · 10 m 11.91 → 1.77 MB · 좌표 · id · 색 해시 전후 같음 · B05 · B06 등고선 · 배수 응답 해시 같음
- 시험: test_514_3_b07_basin_light 새로 · vitest cad/polyline-points-514-3 새로

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 21:10:01 +09:00

51 lines
1.8 KiB
Python

"""514-3 — B07 유역도 배경선(등고선 · 계류) = 폴리선 하나 + 꼭짓점 목록(자식 Line 없음).
CAD 읽기(꼭짓점 → 선분)는 vitest `cad/polyline-points-514-3`.
"""
import io
from ezdxf import recover
from B07_DesignDetail.B07_DesignDetail_Engine_Cad_Basin import (
CONTOUR_LAYER_ID,
ROUTE_LAYER_ID,
STREAM_LAYER_ID,
build_watershed_drawing,
)
from B07_DesignDetail.B07_DesignDetail_Engine_Frame_Export import drawing_to_dxf
ROUTE = [(0.0, 0.0), (300.0, 0.0)]
CONTOUR = [(0.0, 50.0), (100.0, 80.0), (200.0, 40.0), (300.0, 90.0)]
STREAM = [(50.0, -100.0), (60.0, 100.0)]
def _drawing() -> dict:
return build_watershed_drawing("plan_watershed", ROUTE, [], [CONTOUR], [STREAM])
def _on(drawing: dict, layer: str) -> list[dict]:
return [e for e in drawing["entities"] if e.get("layerId") == layer]
def test_background_is_point_list_polyline() -> None:
drawing = _drawing()
(contour,) = _on(drawing, CONTOUR_LAYER_ID)
(stream,) = _on(drawing, STREAM_LAYER_ID)
for entity in (contour, stream):
assert entity["type"] == "PolyLine" and "children" not in entity
assert all(set(p) == {"x", "y"} for p in entity["shapeData"]["points"])
assert len(contour["shapeData"]["points"]) == 4
assert len(stream["shapeData"]["points"]) == 2
# 주제선(노선)은 옛 꼴 그대로
(route,) = _on(drawing, ROUTE_LAYER_ID)
assert len(route["children"]) == 1
def test_dxf_keeps_background_open() -> None:
data, _skipped = drawing_to_dxf(_drawing())
doc, _auditor = recover.read(io.BytesIO(data))
polylines = [p for p in doc.modelspace().query("LWPOLYLINE") if p.dxf.layer.endswith("contour")]
assert len(polylines) == 1
assert not polylines[0].closed and len(polylines[0]) == 4