- POST /route/replan = 노선 저장 체인(B05_Profile_Route_Save) — 풀기 → 구조물 · 관 좌표 따라감 → 새 세류선 교차점 기본 관 · 옛 노선 밖 오목 지점 보충 → 종횡단 한 번 → 계획고 옮김(바뀐 구간만 새 지반) → 횡단 이월(측점 열쇠 grid · pipe · structure · end · CARRY 일곱 + 구조물 조정) → B06 확정 · 3D - 관 정본 안 지움 · 배수유역 체인에서 뗌(관 정본 새 노선 지문 → B04 분석 낡음) - 요청에 노선 초안(RouteDraft 모양 draft) · as_initial · 응답에 관 · 구조물 · 버린 횡단 수 · 초기값 여부 · 시간 - 초기값 = 자동설계 + 추천 [적용](as_initial)만 · 손 편집 저장은 안 바꿈 - 실패 = 노선 · 관 · 구조물 · 종횡단 파일 · 새 노선 행 · stage 2 params 되살림 - 시험 test_346_3_route_save · test_133_2 새 체인으로 · 시간 재기 도구 run_346_3_route_save_timing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ji4nuyLVHcxrXWHTdb5nRD
58 lines
2.0 KiB
Python
58 lines
2.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""346-3 노선 저장 실경로 시간 — 검증 프로젝트의 지금 노드 · 곡선 그대로 저장 한 번(수동 실행).
|
|
|
|
같은 노선이라 값은 그대로(새 노선 행 번호만 바뀜) · 초기값은 안 건드림(`as_initial` 끔).
|
|
쓰는 법: `./venv/Scripts/python.exe resources/tester/run_346_3_route_save_timing.py <project_id>`
|
|
"""
|
|
|
|
import asyncio
|
|
import json
|
|
import logging
|
|
import sys
|
|
import time
|
|
from pathlib import Path
|
|
from uuid import UUID
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
from config.config_db import close_db_pool, init_db_pool # noqa: E402
|
|
|
|
|
|
async def main(project_id: UUID) -> None:
|
|
from B05_Profile import B05_Profile_Router_Replan as replan
|
|
from B05_Profile.B05_Profile_Route_Save import RouteSaveRequest
|
|
|
|
logging.basicConfig(level=logging.INFO, format="%(message)s")
|
|
await init_db_pool()
|
|
try:
|
|
plan = await replan.read_route_plan(project_id)
|
|
nodes = plan["nodes"]
|
|
radii: dict[int, float] = {}
|
|
for curve in plan["curves"]:
|
|
if curve.get("node_first") == curve.get("node_last"):
|
|
radii[int(curve["node_first"])] = float(curve["radius_m"])
|
|
body = RouteSaveRequest(
|
|
vertices=[
|
|
{
|
|
"x": node["x"],
|
|
"y": node["y"],
|
|
"curve": index in radii,
|
|
"radius_m": radii.get(index),
|
|
}
|
|
for index, node in enumerate(nodes)
|
|
],
|
|
station_snap=bool(plan.get("station_snap")),
|
|
)
|
|
started = time.perf_counter()
|
|
result = await replan.replan_route(project_id, body)
|
|
seconds = time.perf_counter() - started
|
|
body_text = getattr(result, "body", None)
|
|
print(json.dumps(json.loads(body_text) if body_text else result, ensure_ascii=False))
|
|
print(f"[시간] 노선 저장 전체 {seconds:.1f}s")
|
|
finally:
|
|
await close_db_pool()
|
|
|
|
|
|
asyncio.run(main(UUID(sys.argv[1])))
|