Merge remote-tracking branch 'origin/sub_laptop_4' into main_laptop_1

This commit is contained in:
2026-10-18 23:36:54 +09:00
18 changed files with 230 additions and 42 deletions
@@ -91,6 +91,19 @@ const out = cases.map((item) => {
return carry.carryBase(xy(item.oldXy), xy(item.newXy), item.oldBase, item.groundPvi);
case "rebase":
return follow.rebaseStructureDraft(item.draft, item.before, item.after);
case "outside": {
// 노선 밖 판정 · 따라감 표시 · 측점 계획에서 뺌(459 덧)
const line = xy(item.line);
const station = loadTs("common_util/common_util_structure_station.ts");
const pipes = follow.projectPipePoints(item.pipes, line);
const structures = follow.followStructures(item.structures, line).map(({ item: s }) => s);
return {
flags: item.points.map(([x, y]) => follow.routeOutside(line, { x, y })),
pipes: pipes.map((p) => [p.id, p.chainage_m, p.outside ?? false]),
structures: structures.map((s) => [s.structure_id, s.chainage_m, s.outside ?? false]),
planned: station.planStations(pipes, structures, []).map((m) => m.chainage_m),
};
}
case "plus":
return follow.followPlusStations(item.list, xy(item.from), xy(item.to));
default:
+1 -1
View File
@@ -329,7 +329,7 @@ def test_노선_확인_때_구조물_정본이_따라감(tmp_path, monkeypatch):
# 새 노선 = 앞쪽 10 m 늘림(같은 땅 자리는 누가거리 +10)
new_xy = [{"x": -10.0, "y": 0.0}, {"x": 100.0, "y": 0.0}]
result = structures_router.follow_structures_to_route(tmp_path, "route.geojson", new_xy)
assert result == {"moved": 2, "far": 0}
assert result == {"moved": 2, "far": 0, "outside": 0}
assert saved["revision"] == 4
assert [(i.chainage_m, i.start_m, i.end_m) for i in items] == [
(40.0, None, None),
+1 -1
View File
@@ -395,7 +395,7 @@ def test_차례와_배수유역_뗌(chain_world):
]
assert result["cross_dropped"] == 2 and result["drainage_stale"] is True
# 456 m 노선 · 관 하나 — 100 m 간격 보충 없음(369)
assert result["pipes"] == {"kept": 1, "crossing": 0}
assert result["pipes"] == {"kept": 1, "crossing": 0, "outside": 0}
# 관 정본 = 새 노선 지문 · 배수유역 분석 지문(옛) 과 달라 B04 가 「낡음」
saved = json.loads(chain_world.pipes_file.read_text("utf-8"))
assert saved["route_signature"] == route_signature(vertices_of(NEW))
@@ -48,6 +48,7 @@ from B05_Profile.B05_Profile_Route_Save_Parts import ( # noqa: E402
)
from B05_Profile.B05_Profile_Router_Confirm import _seat_born_nodes # noqa: E402
from common_util.common_util_drainage_pipes import PipePoint # noqa: E402
from common_util.common_util_route_follow import route_outside # noqa: E402
OLD_XY = [[0.0, 0.0], [200.0, 0.0], [400.0, 0.0]]
NEW_XY = [[0.0, 0.0], [200.0, 0.0], [300.0, 60.0], [420.0, 60.0]]
@@ -354,3 +355,46 @@ def test_관_따라감_선은_사용_범위_자른_points_좌표_없는_옛_관
pairs, _ = asyncio.run(route_save._place_pipes("p", "s", old, old_xy, points))
assert [pipe.chainage_m for _, pipe in pairs] == [110.0, 210.0]
assert [pipe.chainage_m for pipe in saved[0]] == [110.0, 210.0]
def test_노선_밖_시설_측점_안_세움_좌표_그대로(tmp_path: Path) -> None:
"""시점 앞 · 종점 뒤 0.51 m 넘게 나간 관 · 구조물 = 노선 밖(TS ↔ 파이썬) · 측점 계획에서 뺌."""
from B05_Profile.B05_Profile_Engine_Sections import resolve_extra_stations
line = [[0.0, 0.0], [100.0, 0.0], [200.0, 50.0]]
end = (
200.0 + 0.6 * 100.0 / math.hypot(100.0, 50.0),
50.0 + 0.6 * 50.0 / math.hypot(100.0, 50.0),
)
points = [(-0.6, 0.0), (-0.4, 0.0), (-0.3, 9.0), (50.0, 30.0), end, (200.0, 50.3)]
pipes = [
{"id": "in", "chainage_m": 50.0, "facility": "pipe", "x": 50.0, "y": 3.0},
{"id": "before", "chainage_m": 3.0, "facility": "pipe", "x": -7.0, "y": 0.0},
]
structures = [
{"structure_id": "after", "type_id": "x", "chainage_m": 200.0, "x": 210.0, "y": 55.0},
]
[ts] = _ts(
tmp_path,
[
{
"op": "outside",
"line": line,
"points": points,
"pipes": pipes,
"structures": structures,
}
],
)
py = [route_outside(x, y, line) for x, y in points]
assert ts["flags"] == py == [True, False, False, False, True, False]
assert ts["pipes"] == [["before", 0.0, True], ["in", 50.0, False]] # 좌표 그대로 · 표시만
assert ts["structures"][0][2] is True
assert ts["planned"] == [50.0]
# 서버 — 측점 세울 때 노선 좌표로 그때그때(정본에 안 씀)
extras = resolve_extra_stations(
tmp_path,
[PipePoint(chainage_m=50.0, x=50.0, y=3.0), PipePoint(chainage_m=0.0, x=-7.0, y=0.0)],
line,
)
assert [at for at, _ in extras] == [50.0]