Files
Aislo/resources/tester/test_635_5_b05_coords.py
T
eomsangdonandClaude Opus 5.5 dfba0e7b57 feat(755-1·755-2): B05 예정노선 수정 — 켠 동안 판만 고침 · 끌 때 한 번 추적 · 재기 · 받은 노선 색 · 설명 · 위치 칸 걷음
- 755-1 켠 동안 끊김 허용(가운데 묶음 지움) · 고칠 때마다 다시 추적 걷음 · 끌 때 끊김 = 알림하고 안 끔 · 바뀜 = 확인창 → /route/follow 한 걸음 · 켠 동안 되돌리기 = 예정노선 판 사진첩(Ctrl+Z · 도구줄 단추 · bindHistoryControls local) · [잇기] 기능 표 b05 사용
- 755-2 켠 동안 재기 = D03 재기 겹(createPlanMeasure · 선 따라 · 두 점) · 받은 노선 = 분홍 점선 + 검은 테(기존 --draw-map-route-3 · theme.css 안 고침) · 켬 설명 걷음 · 위치 칸 걷음(기능 표 site b05 숨김 · 칸 자리 그리기 하나 · 찾기 이동 · toPlan 걷음)
- 낡은 시험 고침: test_626_3(되돌리기 = 판 사진첩 · join b05 사용) · test_635_3(칸 하나 · 위치 숨김 · 끌 때 한 번 · RouteEdit 줄 한도 683 → 690) · test_635_5(찾기 이동 걷음) · 새 지킴 시험 test_755_expected_flow

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 23:11:21 +09:00

63 lines
2.7 KiB
Python

"""635-5 B05 경위도 ↔ 사업지 좌표 서버 변환(요구 546) — 속성 판 경위도(찾기 이동 = 755-2 걷음).
- 서버 `POST /route/coords` = 작업 좌표계(`resolve_project_crs` · WKT 그대로) pyproj 묶음 변환.
- 화면 = 노드 고름 때만 부름 · 같은 점 캐시 · 바탕 `tm_grid` 늘려 쓰기 걷음.
./venv/Scripts/python.exe -m pytest resources/tester/test_635_5_b05_coords.py -q
"""
from __future__ import annotations
from pathlib import Path
import pytest
from pyproj import Transformer
from B05_Profile.B05_Profile_Router_Coords import CoordsRequest, convert
ROOT = Path(__file__).resolve().parents[2]
B05 = ROOT / "B05_Profile"
# 서울 근처 · 50 km · 180 km 떨어진 점(경위도)
POINTS = [(127.0, 37.5), (127.5, 37.6), (129.0, 36.5)]
@pytest.mark.parametrize("crs", ["EPSG:5176", "EPSG:5186", "EPSG:5179"])
def test_묶음_변환_pyproj_대조_왕복(crs):
plan = convert(crs, "plan", POINTS)
want = Transformer.from_crs("EPSG:4326", crs, always_xy=True)
for (lon, lat), (x, y) in zip(POINTS, plan):
wx, wy = want.transform(lon, lat)
assert abs(x - wx) < 1e-6 and abs(y - wy) < 1e-6
back = convert(crs, "lonlat", [tuple(p) for p in plan])
for (lon, lat), (blon, blat) in zip(POINTS, back):
assert abs(lon - blon) < 1e-7 and abs(lat - blat) < 1e-7 # 1 cm 안(Bessel 왕복)
def test_빈_묶음_점_꼴():
assert convert("EPSG:5186", "plan", []) == []
with pytest.raises(ValueError):
CoordsRequest(to="plan", points=[[1.0]])
with pytest.raises(ValueError):
CoordsRequest(to="tm", points=[])
def test_라우터_등록():
main = (ROOT / "main.py").read_text(encoding="utf-8")
assert "app.include_router(b05_coords_router, dependencies=protected_with_company)" in main
router = (B05 / "B05_Profile_Router_Coords.py").read_text(encoding="utf-8")
assert '@router.post("/{project_id}/route/coords"' in router
assert "resolve_project_crs(root, route_crs_input=" in router
def test_화면_서버_변환_고름만():
panel = (B05 / "B05_Profile_UI_Panel_Plan.ts").read_text(encoding="utf-8")
assert "`/projects/${projectId}/route/coords`" in panel # requestJson 이 /api 를 붙임
assert "known.has(key)" in panel # 같은 점 캐시
ui = (B05 / "B05_Profile_UI_ExpectedDraw.ts").read_text(encoding="utf-8")
assert "lonLat: coords.lonLat," in ui and "toPlan" not in ui + panel
assert "normOfLonLat" not in ui and "tm_grid` 늘려" not in ui
# 끌기 중엔 판을 안 그림 — 속성 판은 고름 · 놓음(commit) 때만
kit = (ROOT / "D03_PlanAnalysis" / "D03_PlanAnalysis_UI_Kit.ts").read_text(encoding="utf-8")
assert "lonLat: params.lonLat," in kit