feat(extract): Flamingo Park in run.py, Parkwege in der Chunk-Ausgabe
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2ef9e6774a
commit
442f5b2ada
5 files changed
+64
-12
No files matched your search
@@ -1,10 +1,13 @@
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
from shapely.geometry import LineString, Point, box
|
||||
from shapely.geometry import LineString, Point, Polygon, box
|
||||
|
||||
from leonida.heights import PALM_CLEARANCE
|
||||
from leonida.park import ParkError, ParkLayout, World, apply_park, check_corners
|
||||
from leonida.park import ParkError, ParkLayout, World, apply_flamingo_park, apply_park, check_corners, load_park
|
||||
|
||||
DATA = Path(__file__).resolve().parents[1] / "data"
|
||||
|
||||
QUAD = box(0, 0, 100, 200)
|
||||
SERVICE = box(60, 0, 66, 30)
|
||||
@@ -75,3 +78,17 @@ def test_corners_must_lie_at_a_road():
|
||||
far = SimpleNamespace(game={"sw": (0.0, 0.0), "se": (100.0, 0.0), "ne": (100.0, 200.0), "nw": (30.0, 200.0)})
|
||||
with pytest.raises(ParkError, match="Spielecke nw"):
|
||||
check_corners(far, roads)
|
||||
|
||||
|
||||
def test_flamingo_park_goes_into_a_world_with_roads_around_the_park():
|
||||
config = load_park(DATA / "flamingo-park.toml")
|
||||
park = Polygon([config.game[key] for key in ("sw", "se", "ne", "nw")])
|
||||
ring = park.buffer(15, join_style="mitre").difference(park)
|
||||
start = World(land=[park.buffer(400)], surfaces=[], roads=[(ring, False)], centerlines=[], buildings=[], palms=[])
|
||||
result, messages = apply_flamingo_park(start, DATA / "flamingo-park.toml", seed=20260912)
|
||||
assert {"park", "field", "court", "pool", "parking", "sand"} <= {kind for _, kind in result.surfaces}
|
||||
assert len([b for b in result.buildings if b[1]["source"] == "osm"]) == 11
|
||||
assert result.paths and result.palms
|
||||
assert LineString([config.street.start, config.street.end]) in result.centerlines
|
||||
assert not any(message.startswith("Warnung") for message in messages)
|
||||
assert any(message.startswith("Flamingo Park:") for message in messages)
|
||||
Reference in new issue
Block a user