- 54-39 고르기 칸 빈 보기 「선택 안 함」 · 「(기본)」 꼬리 · 숫자 칸 「(기본)」 자리표시 · 알약 라벨 「(기본)」 걷음 - 54-39 엔진 짝(파이썬 · TS): 배관 구조 · 형태 · 관종 · 기초 · 길이 · 전 · 후 · 집수정 높이 빈 값 = 값 없음(정의 기본값으로 안 읽음) · 관경 빈 값 = 관 없음 · 집수정 모양(basin_form) 실음 - 54-39 횡단 기하: 구조 · 집수정 모양 안 고름 = 집수정 없음 · 구조 · 형태 안 고른 배관 벽 = 그리지 않음 · patch 형식이 없으면 폼 모양 - 54-39 새로 놓기 · 종류 바꾸기 · 자동 배치 = 집수정 모양 L 도 실제 값 - 54-40 [연동] [경사] = 유입 · 유출 구조 흙막이일 때만 · 집수정 「내공」 줄 화면에서 숨김(값 · 그림 그대로) - 54-41 상자 안 단추(연동 · 경사 · 선택 · 해제) 높이 = 숫자 칸 묶음 26 · 상자 밖 단추 그대로 - 시험: 새 규칙 기대값(culvert_set · culvert_sets_mirror · structure_span · new_structure_defaults) 화면 확인(sub5_검증): 새 배관 = 1000 · 집수정 L형 1.5 · 흙막이 찰 10 · 1.5 · 5 · 5 실제 값 · (기본) 0 · 유입 집수정 0 ↔ 흙막이 1 단추 줄 · 횡단 eval 형태 빈 값 = 집수정 · 벽 0 · 상자 안 단추 26 · 상자 밖 35.3 · 내공 줄 0 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BVPp2o6Mh2FZJr72yW3ofZ
89 lines
3.9 KiB
Python
89 lines
3.9 KiB
Python
"""새 구조물 기본값 — 「제안값 넣기」 걷음 · 생길 때 등록부 기본값을 칸에 실제 값으로 (PLAN 46-7).
|
|
|
|
못박는 것
|
|
- 자동 배치로 새로 놓인 관 = 등록부 기본값을 빈 키에 채움 · 추천 관경이 기본값을 이김.
|
|
- 이미 있던 관(원본에 있던 자리)의 빈 칸은 그대로(옛 프로젝트 빈칸 = 미확정 유지).
|
|
- 월류 폭 기본값(세월교 10 · 물넘이 5)은 등록부에 · 엔진 상수와 같음.
|
|
- 화면: 제안값 단추 · 「제안 …」 글이 없음 · 값 없이 그리면 등록부 기본값(`newDefaults`).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from B04_PreProcess import B04_PreProcess_Router_Basins as basins
|
|
from B05_Profile.B05_Profile_Structures_Schema import structure_type_map
|
|
from B06_Section.B06_Section_Engine_Culvert import (
|
|
FORD_DEFAULT_WIDTH_M,
|
|
FORD_PAVEMENT_DEFAULT_WIDTH_M,
|
|
)
|
|
from common_util.common_util_drainage_pipes import PipePoint
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def _defaults(type_id: str) -> dict:
|
|
return {
|
|
o.key: o.default
|
|
for o in structure_type_map()[type_id].options
|
|
if o.default not in (None, "")
|
|
}
|
|
|
|
|
|
def test_새_관만_기본값_빈_키에만():
|
|
fresh = PipePoint(chainage_m=10.0, source="stream", options={"pipe_diameter_mm": 800})
|
|
basins._apply_new_defaults([fresh])
|
|
# 추천(먼저 들어간 값)이 이김 · 집수정 모양 L 도 실제 값(54-39)
|
|
expected = {**_defaults("pipe"), "pipe_diameter_mm": 800, "inlet_structure": "L"}
|
|
assert fresh.options == expected
|
|
assert fresh.options["pipe_kind"] == "파형강관" and fresh.options["inlet_type"] == "집수정"
|
|
box = PipePoint(chainage_m=20.0, source="stream", facility="box_culvert")
|
|
basins._apply_new_defaults([box])
|
|
assert box.options["body_width_m"] == 2.0 and box.options["wing_in"] == "날개벽"
|
|
|
|
|
|
def test_원본에_있던_관은_빈칸_그대로(monkeypatch):
|
|
"""`_build` — 원본 목록에 있던 자리는 기본값을 안 받고, 새 자리만 받음."""
|
|
|
|
class Pipe:
|
|
def __init__(self, chainage_m: float, reason: str) -> None:
|
|
self.chainage_m, self.reason = chainage_m, reason
|
|
|
|
class Detail:
|
|
pipes = [Pipe(100.0, "stream"), Pipe(300.0, "spacing")]
|
|
basins: list = []
|
|
|
|
monkeypatch.setattr(basins, "build_detail", lambda *_: Detail())
|
|
monkeypatch.setattr(basins, "drainage_dir", lambda _: "x")
|
|
|
|
class Ctx:
|
|
vertices: list = []
|
|
|
|
old = PipePoint(chainage_m=100.0, source="stream") # 옛 관 — 옵션 없음
|
|
_, points = basins._build("p", Ctx(), [old])
|
|
by = {p.chainage_m: p for p in points}
|
|
assert by[100.0].options is None # 옛 빈칸 그대로
|
|
# 새로 보충된 관 = 기본값 + 집수정 모양 L(54-39)
|
|
assert by[300.0].options == {**_defaults("pipe"), "inlet_structure": "L"}
|
|
|
|
|
|
def test_월류_폭_기본값은_등록부_엔진과_같음():
|
|
assert _defaults("ford_bridge")["ford_width_m"] == FORD_DEFAULT_WIDTH_M
|
|
assert _defaults("ford_pavement")["ford_width_m"] == FORD_PAVEMENT_DEFAULT_WIDTH_M
|
|
|
|
|
|
def test_화면에_제안값_단추_제안_글이_없음():
|
|
files = [
|
|
"B05_Profile/B05_Profile_UI_Drainage_Facility.ts",
|
|
"B05_Profile/B05_Profile_UI_Drainage_Facility_Fields.ts",
|
|
"B05_Profile/B05_Profile_UI_Drainage_Facility_Ford.ts",
|
|
"B05_Profile/B05_Profile_UI_Structures_Fields.ts",
|
|
"B05_Profile/B05_Profile_UI_Structures_Panel_Options.ts",
|
|
]
|
|
for name in files:
|
|
text = (ROOT / name).read_text(encoding="utf-8")
|
|
assert "제안값 넣기" not in text and "b05-structure__suggest" not in text, name
|
|
assert "`제안 " not in text and '"제안 ' not in text and "(제안 " not in text, name
|
|
panel = (ROOT / "B05_Profile/B05_Profile_UI_Structures_Panel.ts").read_text(encoding="utf-8")
|
|
assert "values ?? newDefaults()" in panel and "options ?? newDefaults()" in panel
|