- 옛 노선 지문 관 파일(옛 누가거리 394 · 좌표 351) — 측점 계획 · 관 지점 GET · 화면 · 상세 얹기는 351 인데 세월교 노면 하강(ford_surface_drops) · 물넘이포장 구간(ford_pavement_ranges · tilt_ranges) · 카드 이름 (relabel_pipe_stations) · B07 관 글 재료(load_note_sources) · 옛 비정규 측점 이관 심는 자리만 394 로 읽음 → [저장] 재계산 · [확정] · 상세 값이 화면과 갈림 - B05_Profile_Engine_Sections.route_pipe_points — 관 지점 정본을 지금 노선에 얹어 읽음(_load_pipe_points 이월) · 노선 경로 안 줌 = 노선 파일 하나(ROUTE_DATA_FILE · 노선 풀기도 같은 이름을 씀) · 노선 못 읽으면 저장분 그대로 - load_culvert_sets · attach_saved_shapes(saved_pipes 걷음) · relabel_pipe_stations(상세 GET 은 노선 경로 넘김) · B07 load_note_sources · Structures_Router 이관 심는 자리 = 이 한 벌 - 시험 test_472_d_route_pipe_readers(옛 코드 빨강 2) · test_472_d_pipe_route_attach 「노선 모름 = 파일 누가거리」 단언은 옛 동작이라 「노선 파일 하나 = 351」로 고침 · 위키 rules · calculations 줄 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
88 lines
3.3 KiB
Python
88 lines
3.3 KiB
Python
"""PLAN 472 덧 (요구 272) — 서버 상세 읽기 관 세트 = 측점 계획 · 화면과 같은 관 자리.
|
|
|
|
관 지점 정본의 노선 지문이 지금 노선과 어긋남(옛 노선 누가거리 394 · 좌표는 지금 노선 351) —
|
|
측점 계획(`_load_pipe_points`) · 관 지점 GET · 화면은 좌표로 351 에 얹는데 서버 상세 읽기
|
|
(`attach_saved_shapes`)만 파일 누가거리 394 로 찾아 351 측점에 관 세트를 못 붙였음(새로고침 =
|
|
관 세트 없음 · 관 지우기 ↶ = 화면이 다시 얹어 관 세트 있음 → 누가토량 갈림).
|
|
|
|
./venv/Scripts/python.exe -m pytest resources/tester/test_472_d_pipe_route_attach.py -q
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
from B05_Profile.B05_Profile_Engine_Sections import ( # noqa: E402
|
|
_load_pipe_points,
|
|
_load_route_polyline,
|
|
)
|
|
from B06_Section.B06_Section_Engine_Attach import attach_saved_shapes # noqa: E402
|
|
|
|
ROUTE = "B05_Profile/route/route_main.geojson"
|
|
|
|
|
|
def _project(root: Path) -> None:
|
|
route = root / ROUTE
|
|
route.parent.mkdir(parents=True)
|
|
route.write_text(
|
|
json.dumps(
|
|
{
|
|
"type": "Feature",
|
|
"geometry": {"type": "LineString", "coordinates": [[0, 0, 0], [1000, 0, 0]]},
|
|
}
|
|
),
|
|
encoding="utf-8",
|
|
)
|
|
edits = root / "B04_PreProcess" / "drainage" / "edits"
|
|
edits.mkdir(parents=True)
|
|
pipe = {
|
|
"id": "p35100",
|
|
"chainage_m": 394.0, # 옛 노선 누가거리
|
|
"x": 351.0,
|
|
"y": 0.3,
|
|
"options": {"pipe_kind": "파형강관", "pipe_diameter_mm": "1000"},
|
|
}
|
|
(edits / "pipe_points.json").write_text(
|
|
json.dumps({"route_signature": "옛-노선", "points": [pipe]}), encoding="utf-8"
|
|
)
|
|
|
|
|
|
def _sections() -> list[dict]:
|
|
return [
|
|
{"chainage_m": at, "center_x": at, "center_y": 0.0, "structure": None}
|
|
for at in (340.0, 351.0, 360.0, 380.0, 400.0)
|
|
]
|
|
|
|
|
|
def test_상세_읽기_관_세트_자리_측점_계획과_같음(tmp_path: Path) -> None:
|
|
_project(tmp_path)
|
|
planned = _load_pipe_points(tmp_path, _load_route_polyline(tmp_path, ROUTE))
|
|
assert [round(p.chainage_m, 2) for p in planned] == [351.0] # 측점 계획 = 351 측점
|
|
|
|
sections = _sections()
|
|
attach_saved_shapes(tmp_path, sections, ROUTE)
|
|
owners = {s["chainage_m"]: s["culvert"]["chainage_m"] for s in sections if "culvert" in s}
|
|
assert owners == {351.0: 351.0}
|
|
|
|
|
|
def test_노선_경로_안_줌_노선_파일_하나(tmp_path: Path) -> None:
|
|
# 472 덧(관 파일 누가거리 남은 자리) — 경로 안 줌 = 노선 파일 하나(`ROUTE_DATA_FILE`) · 옛 단언
|
|
# 「파일 누가거리 394」는 측점 계획과 갈리던 옛 동작이라 고침
|
|
_project(tmp_path)
|
|
sections = _sections()
|
|
attach_saved_shapes(tmp_path, sections)
|
|
owners = {s["chainage_m"]: s["culvert"]["chainage_m"] for s in sections if "culvert" in s}
|
|
assert owners == {351.0: 351.0}
|
|
|
|
|
|
def test_노선_파일_없음_저장분_그대로(tmp_path: Path) -> None:
|
|
_project(tmp_path)
|
|
sections = _sections()
|
|
attach_saved_shapes(tmp_path, sections, "B05_Profile/route/없음.geojson")
|
|
assert not any("culvert" in s for s in sections)
|