조정창에서 좌·우 끝을 따로 잡는다 — ◀▶는 구체 길이, ▲▼는 그 끝의 구체 표고를 0.1m씩 움직인다. 좌·우 표고가 달라지면 구체가 기울고, 날개벽 구간 바닥(에이프런)은 각 끝 표고에서 수평을 지킨다(2026-08-25 사용자). - `computeBoxLayout`이 좌·우를 따로 푼다: 끝 표고·길이·성토선·에이프런 - 성토선은 그쪽 표고 기준으로 물매 1:1.2를 지키므로 표고를 내리면 구체가 길어진다 - 조정창 `_Cross_Box_Panel.ts` + 제어 `createBoxControls` + `design.box_adjust` 저장 (세션 → 캐시 → 확정 payload, 세월교와 같은 체계) - 3D: 구체 밖(날개벽 구간)에 서 있던 벽을 없앴다 — 천장 없는 통로가 생기던 자리는 날개벽 몫이다. 이제 상판·구체 저판·측벽 2매·에이프런 2매 + 날개벽 4매로 나뉜다 - 카드 렌더러의 구체 배선(선택 토글·강조·조정창)을 `_Cross_View_Bodies.ts`로 분리, 연동 플래그 세션은 `_Page_Link_Session.ts`로 분리(700줄 제한) 검증(10+0.9): 구체 5.34m·수평 → ◀ 1회 5.44m → ▼ 2회 표고 −0.2m·물매 1:28.4, 에이프런 두 장 모두 수평 유지, ↺ 원복. 3D 솔리드 10개(측벽 링 0.2m). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
148 lines
6.4 KiB
Python
148 lines
6.4 KiB
Python
"""B06 라우터의 횡단 설계 파일 읽기와 프리뷰 계산."""
|
|
|
|
import json
|
|
from pathlib import Path
|
|
from typing import Any
|
|
|
|
from B05_Profile.B05_Profile_Engine_Sections import cross_filename
|
|
from B06_Section.B06_Section_Engine_Design import compute_cross_design
|
|
from common_util.common_util_route_profile import design_elevation_from_longitudinal
|
|
from config.config_system import STANDARD_ROCK_BOUNDARY_DEFAULT_OFFSET_M
|
|
|
|
PREVIEW_DESIGN_FIELDS = (
|
|
"ground_type",
|
|
"roadbed_width_m",
|
|
"cut_area_m2",
|
|
"cut_soil_area_m2",
|
|
"cut_rock_area_m2",
|
|
"cut_rock_kind",
|
|
"fill_area_m2",
|
|
"fill_ground_slope",
|
|
"design_elevation_m",
|
|
)
|
|
|
|
|
|
def pavement_suggestions(longitudinal: dict[str, Any]) -> dict[float, bool]:
|
|
mapping: dict[float, bool] = {}
|
|
stations = longitudinal.get("stations")
|
|
for station in stations if isinstance(stations, list) else []:
|
|
suggested = station.get("pavement_suggested")
|
|
if isinstance(suggested, bool):
|
|
mapping[round(float(station.get("chainage_m", 0.0)), 3)] = suggested
|
|
return mapping
|
|
|
|
|
|
def default_section_modes(longitudinal: dict[str, Any]) -> dict[float, str]:
|
|
mapping: dict[float, str] = {}
|
|
stations = longitudinal.get("stations")
|
|
for station in stations if isinstance(stations, list) else []:
|
|
side = station.get("uphill_side")
|
|
if side in ("left", "right"):
|
|
mapping[round(float(station.get("chainage_m", 0.0)), 3)] = f"{side}_cut"
|
|
return mapping
|
|
|
|
|
|
def read_cross_design_inputs(
|
|
project_root: Path, longitudinal_file_path: str, chainage_m: float
|
|
) -> tuple[list[dict], float | None, bool]:
|
|
root = project_root.resolve()
|
|
longitudinal_path = (root / longitudinal_file_path).resolve()
|
|
if root not in longitudinal_path.parents:
|
|
raise ValueError("종단면 파일 경로가 프로젝트 저장소를 벗어났습니다.")
|
|
if not longitudinal_path.is_file():
|
|
raise FileNotFoundError("종단면 상세 파일을 찾을 수 없습니다.")
|
|
longitudinal = json.loads(longitudinal_path.read_text(encoding="utf-8"))
|
|
design_elevation = design_elevation_from_longitudinal(longitudinal, chainage_m)
|
|
suggested = pavement_suggestions(longitudinal).get(round(chainage_m, 3), False)
|
|
cross_dir = longitudinal_path.parent.parent / "cross_sections"
|
|
cross_path = (cross_dir / cross_filename(chainage_m)).resolve()
|
|
if cross_dir.resolve() not in cross_path.parents or not cross_path.is_file():
|
|
raise FileNotFoundError("해당 측점의 횡단 상세 파일을 찾을 수 없습니다.")
|
|
cross = json.loads(cross_path.read_text(encoding="utf-8"))
|
|
samples = cross.get("samples") if isinstance(cross, dict) else None
|
|
if not isinstance(samples, list):
|
|
raise ValueError("횡단 상세 파일 형식이 올바르지 않습니다.")
|
|
return samples, design_elevation, suggested
|
|
|
|
|
|
def attach_default_designs(
|
|
longitudinal: dict[str, Any], cross_sections: list[dict[str, Any]]
|
|
) -> None:
|
|
modes = default_section_modes(longitudinal)
|
|
pavement = pavement_suggestions(longitudinal)
|
|
for section in cross_sections:
|
|
if section.get("design"):
|
|
continue
|
|
try:
|
|
chainage = float(section.get("chainage_m", 0.0))
|
|
suggested = pavement.get(round(chainage, 3), False)
|
|
design = compute_cross_design(
|
|
section.get("samples", []),
|
|
design_elevation_from_longitudinal(longitudinal, chainage),
|
|
ground_type="ripping_rock",
|
|
section_mode=modes.get(round(chainage, 3), "left_cut"),
|
|
paved=suggested,
|
|
rock_boundary_offset_m=STANDARD_ROCK_BOUNDARY_DEFAULT_OFFSET_M,
|
|
)
|
|
design.update(status="provisional", pavement_suggested=suggested)
|
|
section["design"] = design
|
|
except (ValueError, KeyError):
|
|
continue
|
|
|
|
|
|
def recompute_designs_for_alignment(
|
|
longitudinal: dict[str, Any],
|
|
cross_sections: list[dict[str, Any]],
|
|
stored_designs: list[dict[str, Any]],
|
|
standard: dict[str, Any] | None,
|
|
rock_boundary_offsets: dict[str, float] | None = None,
|
|
) -> None:
|
|
modes = default_section_modes(longitudinal)
|
|
pavement = pavement_suggestions(longitudinal)
|
|
stored_by_chainage = {
|
|
round(float(record["chainage_m"]), 3): (record.get("design") or {})
|
|
for record in stored_designs
|
|
}
|
|
session_offsets: dict[float, float] = {}
|
|
for raw_key, offset in (rock_boundary_offsets or {}).items():
|
|
try:
|
|
session_offsets[round(float(raw_key), 3)] = float(offset)
|
|
except (TypeError, ValueError):
|
|
continue
|
|
for section in cross_sections:
|
|
chainage = float(section.get("chainage_m", 0.0))
|
|
key = round(chainage, 3)
|
|
stored = stored_by_chainage.get(key) or {}
|
|
suggested = pavement.get(key, False)
|
|
try:
|
|
design = compute_cross_design(
|
|
section.get("samples", []),
|
|
design_elevation_from_longitudinal(longitudinal, chainage),
|
|
ground_type=str(stored.get("ground_type") or "ripping_rock"),
|
|
section_mode=str(stored.get("section_mode") or modes.get(key, "left_cut")),
|
|
ditch_side=stored.get("ditch_side"),
|
|
ditch_type=str(stored.get("ditch_type") or "standard"),
|
|
paved=bool(stored.get("paved", suggested)),
|
|
standard=standard,
|
|
rock_boundary_offset_m=session_offsets.get(
|
|
key,
|
|
stored.get("rock_boundary_offset_m", STANDARD_ROCK_BOUNDARY_DEFAULT_OFFSET_M),
|
|
),
|
|
two_stage_slope=bool(stored.get("two_stage_slope", True)),
|
|
ditch_enabled=stored.get("ditch_enabled"),
|
|
)
|
|
except (ValueError, KeyError):
|
|
continue
|
|
design.update(status="provisional", pavement_suggested=suggested)
|
|
if stored.get("display_half_width_m") is not None:
|
|
design["display_half_width_m"] = stored["display_half_width_m"]
|
|
if stored.get("inlet_structure") is not None:
|
|
design["inlet_structure"] = stored["inlet_structure"]
|
|
if stored.get("basin_adjust") is not None:
|
|
design["basin_adjust"] = stored["basin_adjust"]
|
|
if stored.get("ford_adjust") is not None:
|
|
design["ford_adjust"] = stored["ford_adjust"]
|
|
if stored.get("box_adjust") is not None:
|
|
design["box_adjust"] = stored["box_adjust"]
|
|
section["design"] = design
|