diff --git a/B05_Profile/B05_Profile_Api_Replan.ts b/B05_Profile/B05_Profile_Api_Replan.ts index b1690721..1b49d5d6 100644 --- a/B05_Profile/B05_Profile_Api_Replan.ts +++ b/B05_Profile/B05_Profile_Api_Replan.ts @@ -68,6 +68,8 @@ export interface RoutePlanResponse { edited: boolean; /** 현재 초기값 — 서버가 [확인] 때 프로젝트에 적어 둔 초기노선 갈래(계획서 20). */ current_initial?: { logic: string; weights: Record | null }; + /** 전처리가 만든 초기 노선(예상노선 추적)의 노드 · 곡선 — [초기화]가 재계산 없이 놓는다. */ + initial_route?: { nodes: RoutePlanNode[]; curves: RoutePlanCurve[] }; } export interface RouteReplanResponse { diff --git a/B05_Profile/B05_Profile_Api_RouteInitial.ts b/B05_Profile/B05_Profile_Api_RouteInitial.ts index 7f8b6653..b846d9e9 100644 --- a/B05_Profile/B05_Profile_Api_RouteInitial.ts +++ b/B05_Profile/B05_Profile_Api_RouteInitial.ts @@ -14,7 +14,7 @@ import { requestJson } from "./B05_Profile_Api_Replan"; /** 갈래 셈 대기 상한 — 노선 여러 벌을 셈해 견주므로 넉넉히 잡는다. */ const INITIAL_TIMEOUT_MS = 5 * 60 * 1000; -/** 로직 이름 — 서버와 같은 낱말을 쓴다. `follow` 는 예상노선 추종(처음 초기값). */ +/** 로직 이름 — 서버와 같은 낱말을 쓴다. `follow` 는 예상노선 추적(처음 초기값). */ export type RouteInitialLogic = "follow" | "earthwork" | "gentle" | "weighted"; /** 비중 계산의 세 비중(%) — 합 100. */ diff --git a/B05_Profile/B05_Profile_Router_Replan.py b/B05_Profile/B05_Profile_Router_Replan.py index 42edf351..1a3e0ac8 100644 --- a/B05_Profile/B05_Profile_Router_Replan.py +++ b/B05_Profile/B05_Profile_Router_Replan.py @@ -267,6 +267,24 @@ def _read_curves(path: Path) -> list[dict]: return curves if isinstance(curves, list) else [] +def _initial_shape(project_root: Path, fallback: list, radius_m: float) -> dict[str, list]: + """전처리가 만든 **초기 노선**의 노드 · 곡선 — 화면 [초기화]가 재계산 없이 놓는 자리. + + 수정본이 있어도 초기 폴리라인 파일은 그대로라 항상 같은 노선이 나온다. + """ + path = planned_route_initial_path(project_root) + saved_nodes = _vertices_of(_nodes_path(path)) + outline = build_planned_polyline( + [(x, y) for x, y in (saved_nodes or _vertices_of(path) or fallback)], + min_radius_m=radius_m, + simplify=not saved_nodes, + ) + return { + "nodes": [node.as_dict() for node in outline.nodes], + "curves": _read_curves(path) or [curve.as_dict() for curve in outline.curves], + } + + def _write_planned_polyline( path: Path, points: list[tuple[float, float]], @@ -516,6 +534,7 @@ async def read_route_plan(project_id: UUID) -> dict[str, Any] | JSONResponse: "violation_count": outline.violation_count, "edited": bool(working), "current_initial": await asyncio.to_thread(read_initial_choice, project_root), + "initial_route": await asyncio.to_thread(_initial_shape, project_root, expected, radius_m), } diff --git a/B05_Profile/B05_Profile_UI_RouteEdit_Chrome.ts b/B05_Profile/B05_Profile_UI_RouteEdit_Chrome.ts index c830b3bb..cbeeee06 100644 --- a/B05_Profile/B05_Profile_UI_RouteEdit_Chrome.ts +++ b/B05_Profile/B05_Profile_UI_RouteEdit_Chrome.ts @@ -40,7 +40,11 @@ export function createRouteEditChrome(): RouteEditChrome {