feat(B07): 평면도 축척 여덟 · 실거리 상수 축척화 · 막힌 글 먼 자리(141-2)

- 축척 = 1/500 · 600 · 1,000 · 1,200(기본) · 2,500 · 3,000 · 5,000 · 6,000(지식DB 근거)
- 비탈 눈금 간격 · 대피소 띄움 · 필지 버퍼 · 틈 = 1/1,200 실거리 × 축척 비(종이 거리 같게 · 1/6,000 눈금 10 m)
- 글 후보가 다 막히면 기호에서 2 · 3 배 먼 자리 + 지시선 — 검증_sub8 1/6,000 겹친 쌍 55 → 4
- 시험 test_119 · test_141 늘림

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STqEqztUthVFBmEP18wBSz
This commit is contained in:
2026-10-09 15:10:02 +09:00
co-authored by Claude Opus 5.5
parent d26b991fb3
commit f05d77d642
7 changed files with 94 additions and 19 deletions
@@ -15,6 +15,7 @@ from B07_DesignDetail.B07_DesignDetail_Engine_Cad import _text_entity, polyline_
PRIORITY = ("endpoints", "station", "ip", "radius", "drainage", "refuge")
_GAP_MM = 0.6 # 글 사이 틈(종이 mm)
_PUSH = (2.0, 3.0) # 먼 고리 — 후보 거리의 배수
Rect = tuple[float, float, float, float]
@@ -70,8 +71,9 @@ def place_labels(labels: list[dict[str, Any]], obstacles: list[Rect]) -> list[di
placed = []
rank = {piece: index for index, piece in enumerate(PRIORITY)}
for item in sorted(labels, key=lambda label: rank.get(label["piece"], len(PRIORITY))):
rects = [_rect(item, spot) for spot in item["candidates"]]
# ponytail: 후보가 모두 막히면 첫 후보 그대로(겹침 남음) — 더 필요하면 후보 고리를 늘림
spots = [*item["candidates"], *_pushed(item)]
rects = [_rect(item, spot) for spot in spots]
# ponytail: 먼 고리까지 모두 막히면 첫 후보 그대로(겹침 남음 · 작은 축척에 글이 몰린 장)
index = next(
(
i
@@ -81,10 +83,23 @@ def place_labels(labels: list[dict[str, Any]], obstacles: list[Rect]) -> list[di
0,
)
taken.append(rects[index])
placed.append({**item, "spot": item["candidates"][index], "rect": rects[index]})
placed.append({**item, "spot": spots[index], "rect": rects[index]})
return placed
def _pushed(item: dict[str, Any]) -> list[dict[str, Any]]:
"""후보가 다 막혔을 때 — 기호에서 후보 쪽으로 2 · 3 배 먼 자리(지시선 · 141-2 작은 축척)."""
anchor = item.get("anchor")
if not anchor:
return []
ax, ay = anchor
return [
{**spot, "x": ax + (spot["x"] - ax) * k, "y": ay + (spot["y"] - ay) * k, "far": True}
for k in _PUSH
for spot in item["candidates"]
]
def _nearest_on_rect(point: tuple[float, float], rect: Rect) -> tuple[float, float]:
return (min(max(point[0], rect[0]), rect[2]), min(max(point[1], rect[1]), rect[3]))