Merge remote-tracking branch 'origin/sub_laptop_2' into main_laptop_1

This commit is contained in:
2026-10-22 19:56:38 +09:00
11 changed files with 246 additions and 26 deletions
@@ -159,6 +159,8 @@ const state = {
scales: [1000, 1200],
default_scale: 1200,
watershed_scale: 6000,
contour_intervals: [5, 10], // 512-1 유역도 등고선 간격(서버 `_state` 와 같은 칸)
default_contour_interval: 5,
kinds: [
{ id: "k_terrain", name: "지형", pieces: ["terrain"], layout: "plan", scale: 1200 },
{ id: "k_route", name: "노선배치도", pieces: ["route"], layout: "plan", scale: 1200 },
@@ -0,0 +1,99 @@
# -*- coding: utf-8 -*-
"""512-1 B07 유역도 등고선 간격 5 m 기본 · 종류 옵션 10 m(임시 폴더 · DB · 실제 마스터 안 씀).
- 배경선 = 간격 배수 높이만(높이 없는 선은 남김 · None = 전부)
- 유역도 종류 = contour_interval_m 5 기본 · 10 고름 · 1 거절 · 평면도 양식엔 칸 없음
- 지문 = 간격 바꾸면 유역도만 · 기본 종류를 파일로 내려도 그대로 · 같은 값 = 같은 지문
./venv/Scripts/python.exe -m pytest resources/tester/test_512_1_b07_basin_contour.py -q
"""
from __future__ import annotations
import json
import sys
from pathlib import Path
from types import SimpleNamespace
import pytest
ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT))
from B07_DesignDetail import B07_DesignDetail_Router_Support_Fingerprint as fp # noqa: E402
from B07_DesignDetail.B07_DesignDetail_Router_Support_Basin import _metric_lines # noqa: E402
from B07_DesignDetail.B07_DesignDetail_Router_Support_Plan import ( # noqa: E402
list_kinds,
update_kind,
)
def _line(level: float | None, x: float) -> dict:
props = {} if level is None else {"등고수치": level}
coords = [[x, 0.0], [x, 1.0]]
return {"properties": props, "geometry": {"type": "LineString", "coordinates": coords}}
def test_간격_배수_높이만(tmp_path):
path = tmp_path / "contour.geojson"
features = [_line(775.0, 0), _line(780.0, 1), _line(785.0, 2), _line(None, 3)]
path.write_text(json.dumps({"type": "FeatureCollection", "features": features}), "utf-8")
xs = lambda lines: [line[0][0] for line in lines] # noqa: E731
assert xs(_metric_lines(path, "EPSG:4326")) == [0, 1, 2, 3]
assert xs(_metric_lines(path, "EPSG:4326", None, 5)) == [0, 1, 2, 3]
assert xs(_metric_lines(path, "EPSG:4326", None, 10)) == [1, 3]
assert xs(_metric_lines(path, "EPSG:4326", (-1, -1, 1.5, 2), 10)) == [1]
def _watershed(root: Path) -> dict:
return next(kind for kind in list_kinds(root) if kind["layout"] == "watershed")
def test_유역도_종류_간격(tmp_path):
root = tmp_path / "proj"
assert _watershed(root)["contour_interval_m"] == 5
assert all("contour_interval_m" not in k for k in list_kinds(root) if k["layout"] == "plan")
kind = _watershed(root)
update_kind(root, kind["id"], kind["name"], [], None, 10)
assert _watershed(root)["contour_interval_m"] == 10
update_kind(root, kind["id"], kind["name"], []) # 간격 안 보냄 = 지금 값
assert _watershed(root)["contour_interval_m"] == 10
with pytest.raises(ValueError):
update_kind(root, kind["id"], kind["name"], [], None, 1)
def test_지문_유역도만(tmp_path, monkeypatch):
monkeypatch.setattr(fp, "detail_basins_path", lambda stored: tmp_path / "basins.geojson")
root = tmp_path / "proj"
longitudinal = root / "B06_Section" / "longitudinal" / "longitudinal.json"
longitudinal.parent.mkdir(parents=True)
longitudinal.write_text(json.dumps({"stations": [{"chainage_m": 0}]}), encoding="utf-8")
context = SimpleNamespace(
vertices=[SimpleNamespace(x=0.0, y=0.0), SimpleNamespace(x=10.0, y=0.0)],
crs="EPSG:5186",
surface_params={},
stored_path="x",
)
items = [
SimpleNamespace(id="cover", kind="cover"),
SimpleNamespace(id="plan_route", kind="plan"),
SimpleNamespace(id="plan_watershed", kind="plan"),
]
sources = {"title": {}, "designs": {}, "context": context}
def prints() -> dict:
found = fp.compute_fingerprints(root, longitudinal, items, sources)
return {key: value["fingerprint"] for key, value in found.items()}
def changed(before: dict, after: dict) -> set:
return {key for key in before if before[key] != after[key]}
first = prints()
kind = _watershed(root)
update_kind(root, kind["id"], kind["name"], [], None, 5) # 기본 종류를 파일로 내림 · 같은 값
assert changed(first, prints()) == set()
update_kind(root, kind["id"], kind["name"], [], None, 10)
ten = prints()
assert changed(first, ten) == {"plan_watershed"}
update_kind(root, kind["id"], kind["name"], [], None, 5)
assert prints() == first
+1
View File
@@ -379,6 +379,7 @@ def test_watershed_kind_layout_one_sheet(tmp_path: Path) -> None:
"pieces": [],
"layout": "watershed",
"scale": 6000,
"contour_interval_m": 5, # 512-1 유역도 등고선 간격 칸(기본 5 m)
}
# 측점 0 ~ 2,000 m — 1/1,200 평면도는 여러 장 · 유역도는 한 장
stations = [
+4 -1
View File
@@ -238,7 +238,10 @@ def test_CAD_머리줄_없음_탭줄_빈자리_변수():
assert "--cad-title-height: 0px;" in css and ".cad-titlebar" not in css
assert ".cad-qtable" not in css and not (src / "components/QuantityPanel.tsx").exists()
assert "QuantityPanel" not in (src / "App.tsx").read_text("utf-8")
assert "html .cad-ribbon-tabs {" in (src / "integration/host-burger.css").read_text("utf-8")
# 508-1f — ☰ 자리 비움이 탭 줄 + 리본 도구 줄 한 묶음(같은 변수)
burger = (src / "integration/host-burger.css").read_text("utf-8")
assert "html .cad-ribbon-tabs,\nhtml .cad-ribbon-panels {" in burger
assert "var(--host-burger-pad, 0px)" in burger
def test_여러_장_문서_장_도번_백업_칸(got):