Implement story 2.2: coordinate projection and base map loading
Add MapBounds dataclass and equirectangular project() function in projection.py, basemap.load() forcing pixels into memory via .copy(), and full test coverage for both modules (4 new tests). All quality gates pass: 67 tests, ruff clean. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,2 +1,18 @@
|
||||
def test_placeholder() -> None:
|
||||
pass
|
||||
from __future__ import annotations
|
||||
|
||||
from planemapper.renderer.projection import MapBounds, project
|
||||
|
||||
|
||||
def test_home_projects_to_centre() -> None:
|
||||
bounds = MapBounds(home_lat=53.0, home_lon=-6.0, radius_nm=100.0)
|
||||
x, y = project(53.0, -6.0, bounds)
|
||||
assert abs(x - 400) <= 2
|
||||
assert abs(y - 240) <= 2
|
||||
|
||||
|
||||
def test_out_of_bounds_not_clamped() -> None:
|
||||
bounds = MapBounds(home_lat=53.0, home_lon=-6.0, radius_nm=100.0)
|
||||
# 10 degrees of lat north is far outside any 100nm bounds
|
||||
x, y = project(63.0, -6.0, bounds)
|
||||
# y should be well above display top (y < 0)
|
||||
assert y < 0 or y > 480 or x < 0 or x > 800
|
||||
|
||||
Reference in New Issue
Block a user