feat(extract): Minimap zeichnet Parkwege, Felder, Plätze, Pool und Parkplatz
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0e11c54338
commit
e675e62a16
2 files changed
+41
-4
No files matched your search
@@ -150,3 +150,33 @@ def test_committed_map_files_match_the_committed_chunks(tmp_path):
|
||||
assert (fresh.size, fresh.mode) == (committed.size, committed.mode), name
|
||||
assert fresh.tobytes() == committed.tobytes(), f"{name} ist veraltet: cd tools/extract && uv run python overview.py"
|
||||
assert json.loads((tmp_path / "map.json").read_text()) == json.loads((shipped / "map.json").read_text())
|
||||
|
||||
|
||||
def test_map_picture_draws_paths_and_the_new_surface_kinds(tmp_path):
|
||||
src = tmp_path / "chunks"
|
||||
src.mkdir()
|
||||
chunk = {
|
||||
"chunk": [0, 0],
|
||||
"origin": [SLICE["x0"], -SLICE["y1"]],
|
||||
"land": [[_ring(0, 0, 250, 250)]],
|
||||
"surfaces": [{"poly": [_ring(0, 0, 40, 40)], "kind": "field"},
|
||||
{"poly": [_ring(50, 0, 90, 40)], "kind": "court"},
|
||||
{"poly": [_ring(0, 50, 40, 90)], "kind": "pool"},
|
||||
{"poly": [_ring(50, 50, 90, 90)], "kind": "parking"}],
|
||||
"roads": [],
|
||||
"centerlines": [],
|
||||
"buildings": [],
|
||||
"palms": [],
|
||||
"paths": [{"poly": [_ring(100, 0, 104, 250)]}],
|
||||
}
|
||||
(src / "chunk_0_0.json").write_text(json.dumps(chunk))
|
||||
(src / "manifest.json").write_text('{"slice": "vice-a"}\n')
|
||||
dst = tmp_path / "out"
|
||||
overview.render_map(src, dst)
|
||||
picture = Image.open(dst / "map.png")
|
||||
assert picture.getpixel((20, 20)) == overview.SURFACE["field"]
|
||||
assert picture.getpixel((70, 20)) == overview.SURFACE["court"]
|
||||
assert picture.getpixel((20, 70)) == overview.SURFACE["pool"]
|
||||
assert picture.getpixel((70, 70)) == overview.ROAD # Parkplatz in Straßenfarbe
|
||||
assert picture.getpixel((102, 125)) == overview.PATH
|
||||
assert Image.open(dst / "map-walkable.png").getpixel((25, 31)) == overview.WALKABLE # Weg auf Land
|
||||
Reference in new issue
Block a user