feat(512-1 B07 유역도 등고선 간격): 유역도 등고선 5 m 기본 · 평면도 관리 모달에서 10 m 고름(1 m 없음 · B05 · B06 전용) — 요구 326

- 원인 확인: 유역도 23 MB = 1 m 아님 · 도엽 N3L 5 m 주곡선 그대로(등고선 층이 응답 대부분)
- 유역도 종류 파일 contour_interval_m(5 · 10) · 배경선 = 간격 배수 높이만 · 10 m = 23.17 → 11.91 MB
- 지문: 종류 목록 지문에서 간격 뺌 → 간격 바꾸면 유역도만 다시 받음 · 기본 종류 조각 차례 맞춤(파일로 내려도 지문 그대로)
- 시험: test_512_1_b07_basin_contour 새로 · test_b07_plan_kinds · helper_130 새 칸 · test_cad_host_tabs 508-1f 뒤 ☰ 자리 단언 고침

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 19:56:06 +09:00
co-authored by Claude Opus 5.5
parent 35a8ac9bac
commit c2ed0fad54
11 changed files with 246 additions and 26 deletions
@@ -2,6 +2,7 @@
저장 자리(프로젝트 저장소 `B07_DesignDetail/`):
plan_kinds/{종류 id}.json 종류 하나 = {name, pieces, order, layout, scale} — 파일 하나씩
(유역도 양식은 + contour_interval_m 등고선 간격 5 · 10 m)
plan_pieces/{장}/{조각}.json 정보 조각 하나 = 그 장 범위의 기하(사업지 좌표 m)
plan_marks.json 사용자가 정한 대피소 · 사토장 자리
@@ -73,6 +74,8 @@ from B07_DesignDetail.B07_DesignDetail_Router_Support_Landuse import (
from common_util.common_util_json import atomic_write_json
from common_util.common_util_route_profile import design_elevation_from_longitudinal
from config.config_system import (
BASIN_CONTOUR_INTERVAL_CHOICES,
BASIN_CONTOUR_INTERVAL_M,
DRAWING_SCALE_BASIN,
DRAWING_SCALE_PLAN,
DRAWING_SCALE_PLAN_CHOICES,
@@ -109,6 +112,14 @@ def _scale(layout: str, value: Any) -> int:
return value if value in DRAWING_SCALE_PLAN_CHOICES else DRAWING_SCALE_PLAN
def _contour(layout: str, value: Any) -> dict[str, int]:
"""유역도 양식만 등고선 간격(m) 칸 — 없거나 목록 밖이면 5 m(옛 파일)."""
if layout != WATERSHED_LAYOUT:
return {}
chosen = value if value in BASIN_CONTOUR_INTERVAL_CHOICES else BASIN_CONTOUR_INTERVAL_M
return {"contour_interval_m": chosen}
def _document(kind: dict[str, Any], order: int) -> dict[str, Any]:
layout = kind.get("layout", "plan")
return {
@@ -117,6 +128,7 @@ def _document(kind: dict[str, Any], order: int) -> dict[str, Any]:
"order": order,
"layout": layout,
"scale": _scale(layout, kind.get("scale")),
**_contour(layout, kind.get("contour_interval_m")),
}
@@ -149,8 +161,10 @@ def list_kinds(project_root: Path) -> list[dict[str, Any]]:
{
"layout": "plan",
**kind,
"pieces": list(kind["pieces"]),
# 조각 차례 = 파일로 내린 뒤와 같게(지문이 안 흔들림)
"pieces": [piece for piece in PIECE_IDS if piece in kind["pieces"]],
"scale": _scale(kind.get("layout", "plan"), None),
**_contour(kind.get("layout", "plan"), None),
}
for kind in DEFAULT_KINDS
]
@@ -178,6 +192,7 @@ def list_kinds(project_root: Path) -> list[dict[str, Any]]:
"pieces": pieces,
"layout": layout,
"scale": _scale(layout, document.get("scale")),
**_contour(layout, document.get("contour_interval_m")),
},
)
)
@@ -221,15 +236,26 @@ def _checked_scale(layout: str, scale: int | None, current: int = DRAWING_SCALE_
return scale
def _checked_contour(contour: int | None, current: int = BASIN_CONTOUR_INTERVAL_M) -> int:
"""고른 유역도 등고선 간격 — 없으면 지금 값 · 목록 밖이면 거절(1 m = B05 · B06 전용)."""
if contour is None:
return current
if contour not in BASIN_CONTOUR_INTERVAL_CHOICES:
raise ValueError("고를 수 없는 등고선 간격입니다.")
return contour
def add_kind(
project_root: Path,
name: str,
pieces: list[str],
layout: str = "plan",
scale: int | None = None,
contour: int | None = None,
) -> dict[str, Any]:
text, chosen = _checked(name, pieces, layout)
chosen_scale = _checked_scale(layout, scale)
chosen_contour = _checked_contour(contour)
kinds = _materialize(project_root)
if any(kind["name"] == text for kind in kinds):
raise ValueError(f"같은 이름의 종류가 이미 있습니다: {text}")
@@ -239,15 +265,22 @@ def add_kind(
"pieces": chosen,
"layout": layout,
"scale": chosen_scale,
**_contour(layout, chosen_contour),
}
atomic_write_json(_kinds_dir(project_root) / f"{kind['id']}.json", _document(kind, len(kinds)))
return kind
def update_kind(
project_root: Path, kind_id: str, name: str, pieces: list[str], scale: int | None = None
project_root: Path,
kind_id: str,
name: str,
pieces: list[str],
scale: int | None = None,
contour: int | None = None,
) -> dict[str, Any]:
"""종류 이름 · 조각 · 축척을 고친다(차례 · 양식은 그대로). 그 종류 확정본은 풀어 다시 그린다."""
"""종류 이름 · 조각 · 축척 · 유역도 등고선 간격을 고친다(차례 · 양식은 그대로).
그 종류 확정본은 풀어 다시 그린다."""
if not KIND_ID.fullmatch(kind_id):
raise ValueError("올바르지 않은 종류 id 입니다.")
kinds = _materialize(project_root)
@@ -257,6 +290,9 @@ def update_kind(
raise FileNotFoundError("고칠 종류를 찾을 수 없습니다.")
text, chosen = _checked(name, pieces, current["layout"])
chosen_scale = _checked_scale(current["layout"], scale, current["scale"])
chosen_contour = _checked_contour(
contour, current.get("contour_interval_m", BASIN_CONTOUR_INTERVAL_M)
)
if any(kind["name"] == text and kind["id"] != kind_id for kind in kinds):
raise ValueError(f"같은 이름의 종류가 이미 있습니다: {text}")
order = int(_read_json(path).get("order") or 0)
@@ -266,6 +302,7 @@ def update_kind(
"pieces": chosen,
"layout": current["layout"],
"scale": chosen_scale,
**_contour(current["layout"], chosen_contour),
}
atomic_write_json(path, _document(kind, order))
_release_kinds(project_root, {kind_id})
@@ -609,7 +646,11 @@ def plan_kind_source(
raise FileNotFoundError("계획평면도 종류를 찾을 수 없습니다.")
if kind["layout"] == WATERSHED_LAYOUT:
# 유역도 양식 — B04 배수유역 산출물 + 도엽 배경(사업지 CRS) 한 장.
return {"layout": WATERSHED_LAYOUT, "label": kind["name"], **watershed_source(context)}
return {
"layout": WATERSHED_LAYOUT,
"label": kind["name"],
**watershed_source(context, kind["contour_interval_m"]),
}
number = int(match.group(2)) if match.group(2) else 1
pieces, box, chunk, total = build_pieces(
context, longitudinal, longitudinal_path, designs, number, kind["pieces"], kind["scale"]