- 측점 계획 짝 planStations(plus) ↔ plan_stations(plus=) — 주인 plus-{m} · 이름 "" · 같은 m 은 관 · 구조물이 이김
- 정본 B05_Profile/route/plus_stations.json(x · y) · GET/PUT /section/plus-stations · PUT 뒤 측점 맞춤
- 초안 plus-stations(설계 가게 plusStations) · [저장] 차례 구조물 뒤 · 계획고 앞
- 노선 저장 = 좌표로 따라감 · 되살림 대상 · B05 종단 · B06 목록 바뀜 신호
- 종단 세로선 plus 표시(점선 · 끌기 없음 자리)
- 거울 시험 272_1 · 322_3 · 344_3 에 추가 측점 경우 · 322_3 관 id 고정(347) 맞춤
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013QyNXY2TUKXCFMwAca2APG
40 lines
1.5 KiB
Python
40 lines
1.5 KiB
Python
"""368-2 추가 측점 정본(`plus_stations.json`) — 정수 m · 좌표 · 노선 바뀌면 좌표로 따라감 · 저장 차례."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from B05_Profile.B05_Profile_Plus_Stations import (
|
|
follow_plus_stations,
|
|
load_plus_stations,
|
|
plus_chainages,
|
|
save_plus_stations,
|
|
)
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
LINE = [(0.0, 0.0, 0.0), (100.0, 0.0, 0.0)]
|
|
|
|
|
|
def test_저장_정수_m_좌표_노선_안(tmp_path: Path) -> None:
|
|
saved = save_plus_stations(tmp_path, [12.4, 47.0, 47.2, -3.0, 140.0], LINE)
|
|
assert saved == [12.0, 47.0] # 반올림 · 같은 m 하나 · 노선 밖 버림
|
|
rows = load_plus_stations(tmp_path)
|
|
assert [(r["chainage_m"], r["x"], r["y"]) for r in rows] == [
|
|
(12.0, 12.0, 0.0),
|
|
(47.0, 47.0, 0.0),
|
|
]
|
|
assert save_plus_stations(tmp_path, [], LINE) == [] and plus_chainages(tmp_path) == []
|
|
|
|
|
|
def test_노선이_바뀌면_좌표로_따라감(tmp_path: Path) -> None:
|
|
save_plus_stations(tmp_path, [12.0, 47.0], LINE)
|
|
# 시점을 10 m 앞으로 늘린 새 노선 — 같은 땅 자리 = 누가거리 +10
|
|
moved = follow_plus_stations(tmp_path, [(-10.0, 0.0), (100.0, 0.0)])
|
|
assert moved == 2 and plus_chainages(tmp_path) == [22.0, 57.0]
|
|
|
|
|
|
def test_저장_차례_계획고_앞() -> None:
|
|
save = (ROOT / "A00_Common/design/design_save.ts").read_text(encoding="utf-8")
|
|
order = save[save.index("DESIGN_SAVE_ORDER = [") :]
|
|
assert order.index('"structures"') < order.index('"plusStations"') < order.index('"alignment"')
|