fix(b05,b06): 측점 한 벌 — 정수 m · 같은 m 측점 하나 · 목록 전체 다시 맞춤 (272)
- 규칙: 구조물 · 관 기준 측점 = 정수 m 사사오입(일반 측점 1 m 붙기 뺌) · 측점 심는 자리 TS 짝(plantedChainages ↔ resolve_extra_stations) · 같은 m 면 구조물 측점 하나(격자 자리 grid) · 떠나면 일반 측점(oneStationList ↔ _merge_irregular_into_longitudinal) - 서버: B05 [저장] · B06 저장 · [측점 만들기]가 목록 전체 다시 맞춤(빈 목록도 · 옛 글 · 횡단 파일 글) · 계획선 측점 줄 다시 셈 · 정본에 없는 횡단 행은 0.5 m 안 새 측점으로 옮기고 나머지 지움 · 옛 소수 측점 꼭짓점 · 편집은 정수 자리로 · 맞춤 실패는 저장을 안 막음 - 화면: 종단 그래프 · 3D · 표 · ▲▼ 한 목록(초안 반영) · C군 구간형 · 독립 기슭막이 시작 · 끝 측점 · B06 카드는 초안에 없는 옛 구조물 측점 숨김 · 고름은 같은 m 구조물 측점 먼저 · 폼 거리 칸 정수 표기 · C군 계산 구간 · 포장 나눔 경계 정수 - 옛 자료: [정수 맞춤] 단추 없앰 · 종단 보기 열 때 한 번 자동 정수 · 알림 한 줄 · [저장]하면 남음 - 시험: test_272_1 · test_272_2 새로 · 234_1 · 238_1 · b05_extra_stations_supplier · b06_patch_station · b05_station_roundtrip · b05_b06_save_roundtrip 맞춤 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LLCk2y5xE8YGVgjbTntWsY
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
"""구조물 · 관 기준 측점 = 정수 m · 일반 측점 1 m 안이면 그 측점에 붙음(234-1).
|
||||
"""구조물 · 관 기준 측점 = 정수 m(반올림 · .5 는 올림) · 노선 끝 안쪽(요구 167 · 272).
|
||||
|
||||
TS 짝 = `common_util/common_util_structure_station.ts`(화면 입력 · 끌기 · 방향키 · 정수 맞춤 단추).
|
||||
측점 값(측점 + 거리 · 누가거리)에 소수를 안 씀 — 일반 측점(격자)과 같은 m 면 서버 측점
|
||||
만들기가 한 측점으로 합침(구조물 측점이 위 · `B05_Profile_Engine_Sections_Core`).
|
||||
234-1 의 「일반 측점 1 m 안 붙기」는 뺌(그냥 정수 · 사용자 167).
|
||||
TS 짝 = `common_util/common_util_structure_station.ts`
|
||||
(화면 입력 · 끌기 · 방향키 · 옛 자료 정수 옮김).
|
||||
거울 시험 = `resources/tester/test_234_1_structure_station.py`.
|
||||
일반 측점 = 격자(간격) · 시종점 — 서버 자동 배치 · 노선 재투영이 쓴다.
|
||||
일반 측점 = 격자(간격) · 시종점 — 끝(노선 길이)을 넘지 않게 자르는 데만 씀.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -17,8 +21,6 @@ from config.config_system_design import SECTION_STATION_INTERVAL_M
|
||||
|
||||
_Candidate = TypeVar("_Candidate")
|
||||
|
||||
# 일반 측점에 붙는 폭(m) — 이 안이면 그 측점 값(끝 측점처럼 정수가 아니어도).
|
||||
GENERAL_SNAP_M = 1.0
|
||||
_EPS = 1e-6
|
||||
|
||||
|
||||
@@ -32,27 +34,14 @@ def general_stations(total_m: float, interval_m: float) -> list[float]:
|
||||
return values
|
||||
|
||||
|
||||
def _near_general(value: float, stations: Sequence[float]) -> float | None:
|
||||
best: float | None = None
|
||||
for station in stations:
|
||||
gap = abs(station - value)
|
||||
if gap < GENERAL_SNAP_M - _EPS and (best is None or gap < abs(best - value)):
|
||||
best = float(station)
|
||||
return best
|
||||
|
||||
|
||||
def snap_structure_station(chainage_m: float, stations: Sequence[float]) -> float:
|
||||
"""기준 측점 맞춤 — 일반 측점 1 m 안이면 그 측점 · 아니면 정수 m(.5 는 올림) · 정수가 일반
|
||||
측점 1 m 안이면 그 측점. 두 번 맞춰도 같다."""
|
||||
"""기준 측점 = 정수 m(.5 는 올림) · 0 ~ 노선 끝(소수 끝은 그 아래 정수) 안 · 멱등."""
|
||||
value = float(chainage_m)
|
||||
if not math.isfinite(value):
|
||||
return value
|
||||
direct = _near_general(value, stations)
|
||||
if direct is not None:
|
||||
return direct
|
||||
end = max(stations) if stations else math.inf
|
||||
whole = float(math.floor(value + 0.5))
|
||||
near = _near_general(whole, stations)
|
||||
return whole if near is None else near
|
||||
return max(0.0, min(whole, float(math.floor(end + _EPS))))
|
||||
|
||||
|
||||
def route_general_stations(total_m: float) -> list[float]:
|
||||
@@ -71,7 +60,7 @@ def snap_candidates(
|
||||
snapped: list[_Candidate] = []
|
||||
taken: set[float] = set()
|
||||
for candidate in candidates:
|
||||
at = min(snap_structure_station(candidate.chainage_m, stations), total_m)
|
||||
at = snap_structure_station(candidate.chainage_m, stations)
|
||||
if at in taken:
|
||||
continue
|
||||
taken.add(at)
|
||||
|
||||
Reference in New Issue
Block a user