- 필터 = 업체 분류 · 점진 TIN · 둘의 다듬기 판만 · 분석 허용 목록 = Ground 등록부(available_filters) 한 벌 - 표현 = DTM · implicit 만 · 평활 = DTM 만 · config 기본 목록 · PRECOMPUTE · 설정 사전 맞춤(설정 지문 바뀜 — 768 에서 다시 지음) - 등고선 = 격자 · 굳힌 격자만(삼각망 굽기 · 외곽 맞춤 · implicit RBF 폴백 걷음) · 표본기 · 경로 찾기 tin · nurbs · meshfree 갈래 걷음 - 수치지형도 = 라플라스만(TIN 둘 · TPS · ANUDEM형 · 다중해상도 걷음) · B04 단추 하나 - 안 부르는 길 — B04 JSON 점군 GET · ground-stats GET + TS · B07 옛 계획평면도(라이다) 짓기 · lidar_source · LIDAR_ID · plan_lidar 종류 이름 · SOURCE_FILTER_LABELS · MODEL_METHODS(py) · MESH_* 설정 - 옛 manifest 의 지운 갈래 줄은 DB 로 되살리지 않음 · 옛 csf 행은 미리보기 · 등고선 그대로 열림 · 지운 이름 요청 = 400 - 낡은 글 — Ground · Pipeline 머리 · WF1 「없으면 csf」 · B07 음영 기본 「csf」 → 빈 값 · 등고선 폴백 「csf」 → 404 · B04 3D 보기 처음값 · B05 Schema · B06 Prebuild · 씨닝 설명 - 시험 지움 2 — test_b04_contour_raster · test_b04_contour_equivalence(지운 삼각망 굽기 · 없는 프로젝트를 봐 건너뛰던 것) - 시험 덜어냄 — test_b04_ground_filters CSF · 격자 최저 네 경우(지운 필터) - 시험 고침 — 허용 목록 · 형 검사에 걸린 csf · tin · grid_min_z · meshfree · tin_sheet 견본을 ptd · implicit · laplace 로(54_22 · 238_1 · 443 · 342_2 · 346_3 · 351_1 · 442_2 · 271 + helper · 344_1 · 133_1 · 343_2 · 637 · 754_1 · 763_1 깨진 tin → 깨진 implicit · 763_3 · b05 둘 · b06 · sheet_surface TIN(도엽선) 경우 지움) · 이름만 바꿈(273_2 · 343_1 · 343_3 · 624_1) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
132 lines
5.2 KiB
Python
132 lines
5.2 KiB
Python
"""273-2 B06 횡단도 바로 반영 — 초안 자리 횡단 미리 뜨기(요구 168).
|
|
|
|
- 미리 뜨기(`sample_structure_sections`)는 파일을 안 쓰고, [저장] 때 정본 쓰기
|
|
(`generate_irregular_sections`)와 같은 횡단을 낸다(같은 길 · 화면이 본 값 = 저장 값).
|
|
- 기본 설계(`compute_default_designs`)는 파일 대신 받은 횡단으로도 셈.
|
|
- 화면 쪽: 옛 자리 숨김 · 새 자리는 안 물음(415 M4 · 계산 묶음 갈아끼움이 얹음) · 관 그림 · 늦게 끝난 옛
|
|
맞춤이 새 것을 안 덮음(`helper_273_2_preview_stations.cjs`).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import numpy as np
|
|
import pytest
|
|
|
|
import B05_Profile.B05_Profile_Engine_Sections as sections
|
|
from B06_Section.B06_Section_Router_Design import compute_default_designs
|
|
from common_util.common_util_drainage_pipes import route_signature
|
|
from common_util.common_util_route_geometry import RouteVertex
|
|
|
|
HERE = Path(__file__).resolve().parent
|
|
ROOT = HERE.parents[1]
|
|
LINE = [[0.0, 0.0, 100.0], [350.0, 0.0, 100.0]]
|
|
ROUTE = "B05_Profile/route/route.geojson"
|
|
|
|
|
|
class _Slope:
|
|
"""옆으로 기운 지표 — 왼쪽이 높음(상단측 = left)."""
|
|
|
|
def sample_xy(self, xy):
|
|
points = np.asarray(xy, dtype=np.float64).reshape(-1, 2)
|
|
return 100.0 + 0.2 * points[:, 1], np.ones(len(points), dtype=bool)
|
|
|
|
|
|
def _write(root: Path, rel: str, data) -> None:
|
|
path = root / rel
|
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
path.write_text(json.dumps(data, ensure_ascii=False), encoding="utf-8")
|
|
|
|
|
|
def _project(root: Path) -> None:
|
|
_write(root, ROUTE, {"geometry": {"type": "LineString", "coordinates": LINE}})
|
|
vertices = [RouteVertex(x=p[0], y=p[1], z=p[2], chainage_m=0.0) for p in LINE]
|
|
_write(
|
|
root,
|
|
"B04_PreProcess/drainage/edits/pipe_points.json",
|
|
{"route_signature": route_signature(vertices), "points": []},
|
|
)
|
|
|
|
|
|
def _files(root: Path) -> list[str]:
|
|
return sorted(str(p.relative_to(root)) for p in root.rglob("*") if p.is_file())
|
|
|
|
|
|
def test_미리_뜨기는_안_쓰고_저장과_같은_횡단(tmp_path: Path, monkeypatch) -> None:
|
|
_project(tmp_path)
|
|
monkeypatch.setattr(sections, "build_surface_sampler", lambda *_a, **_k: _Slope())
|
|
before = _files(tmp_path)
|
|
stations, crosses = sections.sample_structure_sections(
|
|
tmp_path, ROUTE, "ptd", "implicit", False, extra_stations=((130.0, ""),)
|
|
)
|
|
assert _files(tmp_path) == before # 파일 · 폴더 하나도 안 생김
|
|
assert [c["chainage_m"] for c in crosses] == [130.0] and len(stations) == 1
|
|
sections.generate_irregular_sections(
|
|
tmp_path, ROUTE, "ptd", "implicit", False, extra_stations=((130.0, "파형강관 D800"),)
|
|
)
|
|
written = json.loads(
|
|
(tmp_path / "B06_Section/cross_sections/cross_00130m.json").read_text(encoding="utf-8")
|
|
)
|
|
assert written["samples"] == crosses[0]["samples"]
|
|
assert written["frame"] == crosses[0]["frame"]
|
|
|
|
|
|
def test_기본_설계는_받은_횡단으로도_셈(tmp_path: Path) -> None:
|
|
rel = "B06_Section/longitudinal/longitudinal.json"
|
|
plan = [{"chainage_m": c, "elevation_m": 851.0} for c in (0.0, 1000.0)]
|
|
_write(tmp_path, rel, {"stations": [], "design_profiles": [{"samples": plan}]})
|
|
offsets = np.arange(-20.0, 20.5, 0.5)
|
|
cross = {
|
|
"chainage_m": 610.0,
|
|
"uphill_side": "right",
|
|
"samples": [
|
|
{"offset_m": float(o), "elevation_m": 852.0 - 0.1 * float(o), "valid": True}
|
|
for o in offsets
|
|
],
|
|
}
|
|
designs = compute_default_designs(tmp_path, rel, [610.0], crosses={610.0: cross})
|
|
assert [chainage for chainage, _ in designs] == [610.0]
|
|
design = designs[0][1]
|
|
assert design["status"] == "provisional" and design.get("section_mode")
|
|
# 파일에도 없고 받은 횡단에도 없는 자리는 건너뜀
|
|
assert compute_default_designs(tmp_path, rel, [611.0], crosses={610.0: cross}) == []
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def ts() -> dict:
|
|
if not (ROOT / "config" / "node_modules" / "typescript").is_dir():
|
|
pytest.skip("프론트엔드 의존성 미설치")
|
|
proc = subprocess.run( # noqa: S603 — 고정 실행 파일
|
|
["node", str(HERE / "helper_273_2_preview_stations.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
cwd=str(ROOT),
|
|
check=False,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
def test_화면_옛_자리_숨기고_새_자리_안_물음(ts) -> None:
|
|
# 415 M4 — 새 자리 서버 미리보기 걷음(브라우저 계산 줄 하나) · 옛 95.38 숨김 · 미리보기 요청 0
|
|
assert ts["moved"]["chainages"] == [0, 20, 40, 100]
|
|
assert ts["moved"]["asked"] == []
|
|
|
|
|
|
def test_묶음이_얹은_새_자리는_그대로_관_그림(ts) -> None:
|
|
assert ts["again"]["asked"] == []
|
|
assert ts["again"]["chainages"] == [0, 20, 40, 95, 100]
|
|
assert ts["again"]["swapped"] == {"preview": False, "culvert": True}
|
|
|
|
|
|
def test_초안이_없으면_서버_목록_그대로(ts) -> None:
|
|
assert ts["cleared"]["chainages"] == [0, 20, 40, 95, 95.38, 100]
|
|
|
|
|
|
def test_늦게_끝난_옛_맞춤이_새_것을_안_덮음(ts) -> None:
|
|
assert ts["race"]["chainages"] == [0, 20, 40, 100]
|