"""노드마다 넣은 편집값(430) — 곡선 켬끔 · 넣은 R · 고정(R | 길이) · 고정 길이 → 곡선표 `edits`. ⚠ 짝: `logic/B05_Profile_UI_RouteEdit_Edits.ts` `flattenServerPlan`(`RouteNodeEdit`)이 읽음 · 거울 시험 `resources/tester/test_430_route_edit_rules.py`. 곡선표 `curves` 는 **그린** R(접선 자리에 눌린 값)만 있어, 그것으로 다시 열면 눌린 R 이 넣은 값으로 굳고 R · 길이 고정이 [저장] 뒤 사라짐 — 넣은 값을 따로 둠. 자리 = 저장 노드 (앞 노드에서 0.5 m 안인 점은 `build_planned_polyline` 과 같이 거름). """ from __future__ import annotations import math from typing import Any from common_util.common_util_route_polyline import DUPLICATE_TOLERANCE_M _LOCKS = ("radius", "arc") def node_edits( points: list[tuple[float, float]], flags: list[bool] | None, radii: list[float | None] | None, locks: list[str | None] | None = None, arcs: list[float | None] | None = None, ) -> list[dict[str, Any]]: """점마다의 편집값 — 겹친 점은 빼고 저장 노드와 같은 자리로. 칸이 짧으면 기본값(켬 · 자동).""" def at(values: list | None, index: int, default: Any = None) -> Any: return values[index] if values is not None and index < len(values) else default kept: list[tuple[float, float]] = [] edits: list[dict[str, Any]] = [] for index, point in enumerate(points): if kept and math.dist(kept[-1], point) <= DUPLICATE_TOLERANCE_M: continue kept.append(point) lock = at(locks, index) edits.append( { "curve": bool(at(flags, index, True)), "radius_m": at(radii, index), "lock": lock if lock in _LOCKS else None, "arc_m": at(arcs, index), } ) return edits