- 등록 모달 한 벌(추가 · 상자 고침 · 삭제) — 분류(기준위치 · 거래처) · 항목 고르기 · 거래처 이름 · 목적지 2열 · 큰 창 - 소재지 = 주소 찾기 · 다음 지도 누름 · 표지 끌기(직접 입력 없음) · 좌표 → VWorld 주소 서버 길 - 다이어그램 [기준점 +] 없앰 · 연결선 누름 = 도로 구분 · 거리 · 다음 지도 경로 · 끝점 끌기 = 다시 길찾기 - 시점 → 중점 = 손 입력만 · 자동 그림 = 거래처 쪽 구간 - 도로 구분 = 기준점 거침 2차 · 1차 · 비포장 · 그 밖 포장 · 비포장(파이썬 · TS 짝) · 표 열 기준점 따라 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01STqEqztUthVFBmEP18wBSz
66 lines
2.8 KiB
Python
66 lines
2.8 KiB
Python
"""244-5 B08 거리이정표 기준점 방위 칸 없앰 — 기준점 자리 = 주소 좌표 → 공사지 기준 방위각 ·
|
|
좌표 없으면 공사지 서쪽(견본) · 옛 저장 값의 방위(dir)는 무시.
|
|
"""
|
|
|
|
import json
|
|
import re
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
IMPORTS = re.compile(r"^import[^;]*;\n", re.MULTILINE)
|
|
|
|
|
|
def _read(rel):
|
|
return (ROOT / rel).read_text(encoding="utf-8")
|
|
|
|
|
|
def _layout(base, site):
|
|
data = {"site": {"mid_station_m": None, "mid_road": "비포장"}, "base": base, "routes": []}
|
|
src = IMPORTS.sub("", _read("B08_Quantity/B08_Quantity_Milestone_Layout.ts"))
|
|
expr = f"layoutMilestone({json.dumps(data)}, {json.dumps(site)}, 0)"
|
|
result = subprocess.run(
|
|
["node", "--experimental-strip-types", "--no-warnings",
|
|
"--input-type=module-typescript", "-e", src + f"\nconsole.log(JSON.stringify({expr}));"],
|
|
capture_output=True, text=True, encoding="utf-8", timeout=60,
|
|
) # fmt: skip
|
|
assert result.returncode == 0, result.stderr
|
|
lay = json.loads(result.stdout)
|
|
center = {b["id"]: (b["x"] + b["w"] / 2, b["y"] + b["h"] / 2) for b in lay["boxes"]}
|
|
return center["site"], center["base"]
|
|
|
|
|
|
BASE = {"enabled": True, "name": "기준", "address": "", "legs": []}
|
|
SITE = {"start_lonlat": [127.8, 35.7], "mid_lonlat": None}
|
|
|
|
|
|
def test_좌표_없음_서쪽_옛_방위_무시():
|
|
for site in (SITE, None):
|
|
(cx, cy), (bx, by) = _layout({**BASE, "dir": "E"}, site)
|
|
assert bx < cx - 200 and abs(by - cy) < 1 # 옛 「동」 무시 · 서(왼)
|
|
|
|
|
|
def test_좌표_있음_공사지_기준_방위각():
|
|
(cx, cy), (bx, by) = _layout({**BASE, "dir": "W", "lon": 127.8, "lat": 35.8}, SITE)
|
|
assert abs(bx - cx) < 1 and by < cy - 200 # 북 = 위(옛 「서」 무시)
|
|
(cx, cy), (bx, by) = _layout({**BASE, "dir": None, "lon": 127.9, "lat": 35.7}, SITE)
|
|
assert bx > cx + 200 and abs(by - cy) < 1 # 동 = 오른
|
|
# 시점 좌표 모름 = 서쪽 기본
|
|
(cx, cy), (bx, by) = _layout({**BASE, "lon": 127.9, "lat": 35.7}, None)
|
|
assert bx < cx - 200
|
|
|
|
|
|
def test_좌측_패널_방위_칸_없음_모달_안내():
|
|
state = _read("B08_Quantity/B08_Quantity_UI_Milestone_State.ts")
|
|
assert "공사지에서 본 방위" not in state and "dirOptions" not in state
|
|
assert "d.base.dir" not in state # 244-6 — 기준점 칸은 다이어그램 기준점 모달로
|
|
modal = _read("B08_Quantity/B08_Quantity_UI_Milestone_Modal.ts")
|
|
base = modal[
|
|
modal.index("export function openPlaceModal") : modal.index("interface SiteAddress")
|
|
]
|
|
assert "방위는 이 자리로 자동" in base # 244-13 — 기준점 = 등록 모달 분류 기준위치
|
|
layout = _read("B08_Quantity/B08_Quantity_Milestone_Layout.ts")
|
|
assert (
|
|
"placeDeg({ dir: null, lon: data.base.lon, lat: data.base.lat }, startLL) ?? 270" in layout
|
|
)
|