- 등고선·세류선: 종이 0.1 mm(펜 굵기) 아래 굴곡 점 제거 — 294,339점 → 약 95,600점 - 배경선 캐시: 파이썬 튜플 → numpy 배열 + 선마다 범위 · 도곽 밖 선은 자르기 전에 거름 · 투영 한 줄씩 묶어 처리 - HatchEntity: 경계·무늬가 그대로면 줌·이동 때 패턴 선분 다시 계산 안 함 - 검증_sub4 유역도: 응답 75 MB → 24 MB · 서버 최고 1,304 MB → 595 MB · 끝 489 MB → 288 MB - 브라우저: 전 = 힙 289 MB 넘다 페이지 죽음 · 후 = 최고 203 MB 열림 · 줌 20번 275~281 MB 고정 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013rJwJMVL4EE31y77TB11AP
38 lines
1.4 KiB
Python
38 lines
1.4 KiB
Python
"""B07 유역도 메모리 — 배경선 배열 캐시 · 도곽 밖 선 거름 · 종이 0.1 mm 솎기 (59-4)."""
|
|
|
|
import json
|
|
|
|
from B07_DesignDetail.B07_DesignDetail_Engine_Cad_Basin import _thinned
|
|
from B07_DesignDetail.B07_DesignDetail_Router_Support_Basin import _metric_lines
|
|
|
|
|
|
def test_metric_lines_filters_by_box(tmp_path) -> None:
|
|
path = tmp_path / "lines.geojson"
|
|
inside = [[0.0, 0.0], [1.0, 1.0], [2.0, 0.5]]
|
|
outside = [[50.0, 50.0], [51.0, 51.0]]
|
|
path.write_text(
|
|
json.dumps(
|
|
{
|
|
"type": "FeatureCollection",
|
|
"features": [
|
|
{"geometry": {"type": "LineString", "coordinates": inside}},
|
|
{"geometry": {"type": "LineString", "coordinates": outside}},
|
|
],
|
|
}
|
|
),
|
|
encoding="utf-8",
|
|
)
|
|
every = _metric_lines(path, "EPSG:4326")
|
|
assert every == [[tuple(p) for p in inside], [tuple(p) for p in outside]]
|
|
assert _metric_lines(path, "EPSG:4326", (-1.0, -1.0, 5.0, 5.0)) == every[:1]
|
|
assert _metric_lines(tmp_path / "none.geojson", "EPSG:4326") == []
|
|
|
|
|
|
def test_thinned_drops_sub_pen_wiggles() -> None:
|
|
points = [(x * 0.5, 0.02 if x % 2 else 0.0) for x in range(21)]
|
|
thinned = _thinned(points)
|
|
assert thinned[0] == points[0] and thinned[-1] == points[-1]
|
|
assert len(thinned) == 2
|
|
bend = [(0.0, 0.0), (5.0, 1.0), (10.0, 0.0)]
|
|
assert _thinned(bend) == bend
|