refactor(346-3): 노선 저장 횡단 이월 측점 열쇠 = common_util_station_key 한 벌
- station_keys 가 station_key(sub2 짝)를 부름 · 관 pipe:<id>(id 없으면 at:<0.01 m>) · 구조물 structure:<id> · 같은 열쇠 둘째는 at:(B06 stationKeysOf 와 같음) - 파일 차례 관 열쇠 없앰 · 시험 test_346_3_route_save 고쳐 씀 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ji4nuyLVHcxrXWHTdb5nRD
This commit is contained in:
@@ -131,31 +131,36 @@ def _structure(sid, type_id, anchor, start=None, end=None):
|
||||
|
||||
|
||||
def test_측점_열쇠_규칙():
|
||||
stations = [{"chainage_m": s} for s in (0.0, 20.0, 40.0, 50.0, 60.0, 77.0, 80.0, 95.5)]
|
||||
pipes = [(3, PipePoint(chainage_m=50.0))]
|
||||
"""`common_util_station_key` 한 벌 — 관 · 구조물 id · id 없으면 at: · 같은 열쇠 둘째는 at:."""
|
||||
stations = [{"chainage_m": s} for s in (0.0, 20.0, 33.3, 40.0, 50.0, 60.0, 77.0, 80.0, 95.5)]
|
||||
with_id = PipePoint(chainage_m=50.0)
|
||||
with_id.id = "p-7" # sub3 이 넣는 관 id
|
||||
no_id = PipePoint(chainage_m=33.3)
|
||||
structures = [_structure("w1", "retaining_wall", 77.0, 60.0, 80.0)]
|
||||
keys = station_keys(stations, pipes, structures, 20.0)
|
||||
keys = station_keys(stations, [with_id, no_id], structures, 20.0)
|
||||
assert keys == {
|
||||
"end:BP": 0.0,
|
||||
"grid:1": 20.0,
|
||||
"at:33.30": 33.3, # id 없는 관
|
||||
"grid:2": 40.0,
|
||||
"pipe:3": 50.0,
|
||||
"structure:w1:start": 60.0,
|
||||
"structure:w1": 77.0,
|
||||
"structure:w1:end": 80.0,
|
||||
"pipe:p-7": 50.0,
|
||||
"structure:w1": 60.0, # 구간 시작 측점이 먼저 열쇠를 가짐
|
||||
"at:77.00": 77.0, # 같은 구조물 열쇠 둘째 — at:
|
||||
"at:80.00": 80.0,
|
||||
"end:EP": 95.5,
|
||||
}
|
||||
assert "pipe:0" not in keys and "pipe:1" not in keys # 파일 차례 열쇠 없음
|
||||
|
||||
|
||||
def test_이월은_열쇠로_누가거리가_밀려도():
|
||||
old_keys = {
|
||||
"end:BP": 0.0,
|
||||
"grid:1": 20.0,
|
||||
"pipe:0": 50.0,
|
||||
"pipe:p-7": 50.0,
|
||||
"structure:w1": 77.0,
|
||||
"grid:5": 100.0,
|
||||
}
|
||||
new_keys = {"end:BP": 0.0, "grid:1": 20.0, "pipe:0": 57.0, "structure:w1": 84.0}
|
||||
new_keys = {"end:BP": 0.0, "grid:1": 20.0, "pipe:p-7": 57.0, "structure:w1": 84.0}
|
||||
designs = {
|
||||
0.0: {"ground_type": "soil"},
|
||||
20.0: {"ground_type": "rock", "berm": {"on": True}, "cut_area_m2": 9.0},
|
||||
|
||||
Reference in New Issue
Block a user