From f70345e70405e05c998b6019cc1146a0ec41bdc2 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Fri, 9 Oct 2026 19:04:50 +0900 Subject: [PATCH] =?UTF-8?q?feat(B07):=20=ED=8F=89=EB=A9=B4=EB=8F=84=20IP?= =?UTF-8?q?=20=EA=B8=80=20=C2=B7=20=EC=A7=80=EC=8B=9C=EC=84=A0=20=EC=83=89?= =?UTF-8?q?=EC=9D=84=20=EB=85=B8=EC=84=A0=20=EC=A4=91=EC=8B=AC=EC=84=A0=20?= =?UTF-8?q?=EC=83=89=EC=9C=BC=EB=A1=9C(153-2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 실측 = IP 글 #4d7dff 와 교각선 · 원 #4d7dff 이미 같음 → 정함대로 중심선 #ff4d4d - IP 기호 · R 글 색 그대로 · test_141 색 단정 추가 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01TNMXVCZXMpHpVvqmFkeChL --- .../B07_DesignDetail_Engine_Cad_PlanKinds.py | 4 ++- resources/tester/test_141_b07_plan_labels.py | 29 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/B07_DesignDetail/B07_DesignDetail_Engine_Cad_PlanKinds.py b/B07_DesignDetail/B07_DesignDetail_Engine_Cad_PlanKinds.py index e3058d46a..25d6bbc54 100644 --- a/B07_DesignDetail/B07_DesignDetail_Engine_Cad_PlanKinds.py +++ b/B07_DesignDetail/B07_DesignDetail_Engine_Cad_PlanKinds.py @@ -146,6 +146,8 @@ _COLORS = { "emd": "#2f7d4f", "sgg": "#a63d3d", } +# 글 · 지시선만 조각 색과 다름 — IP 글 = 기준 형상(노선 중심선) 색(153-2) +_TEXT_COLORS = {"ip": _COLORS["centerline"]} # 행정 · 지적 경계 (선굵기, 파선) _BOUNDARY_STYLE: dict[str, tuple[int, list[int] | None]] = { "parcel": (1, None), @@ -274,7 +276,7 @@ def _piece_entities( "label": label, "size": size, "layer": layer, - "color": color, + "color": _TEXT_COLORS.get(piece, color), "anchor": anchor, "candidates": spots, } diff --git a/resources/tester/test_141_b07_plan_labels.py b/resources/tester/test_141_b07_plan_labels.py index 6e9c426f1..c57df105f 100644 --- a/resources/tester/test_141_b07_plan_labels.py +++ b/resources/tester/test_141_b07_plan_labels.py @@ -152,3 +152,32 @@ def test_blocked_spots_push_farther_with_leader() -> None: entities = label_entities("d", placed) assert [e["type"] for e in entities] == ["Text", "Text", "PolyLine"] + + +def test_ip_text_takes_centerline_color() -> None: + """153-2 — IP 글 · 지시선 = 노선 중심선 색 · 교각선 · 원 · R 글은 조각 색 그대로.""" + from B07_DesignDetail.B07_DesignDetail_Engine_Cad_PlanKinds import _COLORS, _piece_entities + from B07_DesignDetail.B07_DesignDetail_Engine_Cad_PlanLabels import label_entities + + item = {"name": "IP1", "apex": [100.0, 100.0], "start": [90.0, 100.0], "end": [100.0, 110.0]} + pieces = { + "ip": {"items": [item]}, + "radius": {"items": [{"label": "R=12", "middle": [100.0, 98.0], "dir": [0.0, -1.0]}]}, + } + drawing = build_plan_kind_drawing("plan_x", "시험", (0.0, 0.0, 300.0, 200.0), pieces) + texts = {e["shapeData"]["label"]: e for e in _texts(drawing)} + ip_text = texts["IP1"] + assert ip_text["lineColor"] == _COLORS["centerline"] + assert ip_text["shapeData"]["options"]["textColor"] == _COLORS["centerline"] + assert texts["R=12"]["shapeData"]["options"]["textColor"] == _COLORS["radius"] + marks = [ + e for e in drawing["entities"] if e["layerId"] == "b07-plan-ip" and e["type"] == "PolyLine" + ] + assert len(marks) == 2 # 교각선 · 원 + assert {e["lineColor"] for e in marks} == {_COLORS["ip"]} + + labels: list = [] + _piece_entities("d", "ip", {"items": [item]}, lambda p: (p[0], p[1]), labels=labels) + far = [{**labels[0], "spot": {"x": 0.0, "y": 0.0, "far": True}, "rect": (0, 0, 1, 1)}] + leader = label_entities("d", far)[1] + assert leader["lineColor"] == _COLORS["centerline"]