mirror of
https://github.com/enzet/map-machine.git
synced 2025-08-03 08:40:11 +02:00
Refactor way test.
This commit is contained in:
parent
4c0f9d60ba
commit
7a56d0df87
1 changed files with 12 additions and 12 deletions
|
@ -11,7 +11,7 @@ from map_machine.figure import Figure
|
|||
from map_machine.geometry.boundary_box import BoundaryBox
|
||||
from map_machine.geometry.flinger import Flinger
|
||||
from map_machine.map_configuration import MapConfiguration
|
||||
from map_machine.osm.osm_reader import OSMData, OSMWay, OSMNode
|
||||
from map_machine.osm.osm_reader import OSMData, OSMWay, OSMNode, Tags
|
||||
from tests import SCHEME, SHAPE_EXTRACTOR
|
||||
|
||||
|
||||
|
@ -26,24 +26,24 @@ def get_constructor(osm_data: OSMData) -> Constructor:
|
|||
return constructor
|
||||
|
||||
|
||||
def create_way(tags: Tags, index: int) -> OSMWay:
|
||||
"""Create simple OSM way with two arbitrary nodes."""
|
||||
nodes: list[OSMNode] = [
|
||||
OSMNode({}, 1, np.array((-0.01, -0.01))),
|
||||
OSMNode({}, 2, np.array((0.01, 0.01))),
|
||||
]
|
||||
return OSMWay(tags, index, nodes)
|
||||
|
||||
|
||||
def test_river_and_wood() -> None:
|
||||
"""
|
||||
Check that river is above the wood.
|
||||
|
||||
See https://github.com/enzet/map-machine/issues/126
|
||||
"""
|
||||
nodes_1: list[OSMNode] = [
|
||||
OSMNode({}, 1, np.array((-0.01, -0.01))),
|
||||
OSMNode({}, 2, np.array((0.01, 0.01))),
|
||||
]
|
||||
nodes_2: list[OSMNode] = [
|
||||
OSMNode({}, 3, np.array((-0.01, -0.01))),
|
||||
OSMNode({}, 4, np.array((0.01, 0.01))),
|
||||
]
|
||||
|
||||
osm_data: OSMData = OSMData()
|
||||
osm_data.add_way(OSMWay({"natural": "wood"}, 1, nodes_1))
|
||||
osm_data.add_way(OSMWay({"waterway": "river"}, 2, nodes_2))
|
||||
osm_data.add_way(create_way({"natural": "wood"}, 1))
|
||||
osm_data.add_way(create_way({"waterway": "river"}, 2))
|
||||
|
||||
figures: list[Figure] = get_constructor(osm_data).get_sorted_figures()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue