refactor(476-1 ②): 측점 · 1차 계획선 셈과 파일 쓰기 나눔(동작 같음)
- Engine_Sections `build_sections`(측점 틀 · 지반 · 438 1차 계획선 · 포장 제안 · 파일 안 씀) · run_section_generation = 읽기 → 셈 → 쓰기 - 횡단 이름 규칙 → 새 `B05_Profile_Engine_Sections_Names`(700줄 · 다시 내보냄) - resolve_extra_stations 사본 칸(structures · plus) · 따라감 셈 몫 `followed_structures` · `followed_plus_rows` · `followed_pipes` · `section_seed` · `seat_base_pvi` 뗌 - 체인 · 추천 초기 종단이 같은 조각을 부를 자리 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -121,6 +121,26 @@ async def _route_xy(project_id: UUID, root: str) -> list[list[float]] | None:
|
||||
return None
|
||||
|
||||
|
||||
def followed_structures(
|
||||
project_root: Path,
|
||||
items: list[Any],
|
||||
old_route_data_path: str | None,
|
||||
new_xy: list[dict[str, float]],
|
||||
) -> list[Any]:
|
||||
"""구조물을 새 노선 땅 위 자리로 옮김(제자리 · 저장 안 함) — 노선 저장 체인 · 추천 초기
|
||||
종단(476) 한 벌. 좌표 없는 옛 자료는 옛 노선으로 먼저 채움."""
|
||||
from B05_Profile.B05_Profile_Engine_Sections import _load_route_polyline
|
||||
|
||||
if old_route_data_path:
|
||||
try:
|
||||
fill_structure_coordinates(
|
||||
items, _load_route_polyline(project_root, old_route_data_path), only_missing=True
|
||||
)
|
||||
except (OSError, ValueError):
|
||||
logger.warning("B05 구조물 따라감: 옛 노선을 못 읽어 좌표 없는 구조물은 그대로")
|
||||
return follow_structures(items, [(point["x"], point["y"]) for point in new_xy])
|
||||
|
||||
|
||||
def follow_structures_to_route(
|
||||
project_root: Path, old_route_data_path: str | None, new_xy: list[dict[str, float]]
|
||||
) -> dict[str, int]:
|
||||
@@ -129,21 +149,12 @@ def follow_structures_to_route(
|
||||
좌표가 없는 옛 자료는 옛 노선(아직 안 바뀐 경로 파일)으로 먼저 채운다. 실패는 비치명 —
|
||||
구조물은 옛 누가거리 그대로 남는다(지금까지와 같음).
|
||||
"""
|
||||
from B05_Profile.B05_Profile_Engine_Sections import _load_route_polyline
|
||||
|
||||
root = str(project_root)
|
||||
revision, items = load_structures(root)
|
||||
if not items:
|
||||
return {"moved": 0, "far": 0}
|
||||
if old_route_data_path:
|
||||
try:
|
||||
fill_structure_coordinates(
|
||||
items, _load_route_polyline(project_root, old_route_data_path), only_missing=True
|
||||
)
|
||||
except (OSError, ValueError):
|
||||
logger.warning("B05 구조물 따라감: 옛 노선을 못 읽어 좌표 없는 구조물은 그대로")
|
||||
before = [(item.chainage_m, item.start_m, item.end_m) for item in items]
|
||||
result = follow_structures(items, [(point["x"], point["y"]) for point in new_xy])
|
||||
result = followed_structures(project_root, items, old_route_data_path, new_xy)
|
||||
moved = sum(
|
||||
before[index] != (item.chainage_m, item.start_m, item.end_m)
|
||||
for index, item in enumerate(items)
|
||||
|
||||
Reference in New Issue
Block a user