mirror of
https://github.com/enzet/map-machine.git
synced 2025-05-01 11:17:48 +02:00
Issue #137: support layers for ways.
First check layer value and then priority.
This commit is contained in:
parent
1a719fca2a
commit
697fee5c87
2 changed files with 22 additions and 1 deletions
|
@ -525,7 +525,7 @@ class Constructor:
|
||||||
|
|
||||||
def get_sorted_figures(self) -> list[StyledFigure]:
|
def get_sorted_figures(self) -> list[StyledFigure]:
|
||||||
"""Get all figures sorted by priority."""
|
"""Get all figures sorted by priority."""
|
||||||
return sorted(self.figures, key=lambda x: x.line_style.priority)
|
return sorted(self.figures)
|
||||||
|
|
||||||
|
|
||||||
def check_level_number(tags: Tags, level: float) -> bool:
|
def check_level_number(tags: Tags, level: float) -> bool:
|
||||||
|
|
|
@ -91,6 +91,27 @@ class StyledFigure(Figure):
|
||||||
|
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
def get_layer(self) -> float:
|
||||||
|
"""
|
||||||
|
Get figure layer value or 0 if it is not specified.
|
||||||
|
|
||||||
|
TODO: support values separated by "," or ";".
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
if "layer" in self.tags:
|
||||||
|
return float(self.tags["layer"])
|
||||||
|
except ValueError:
|
||||||
|
return 0.0
|
||||||
|
return 0.0
|
||||||
|
|
||||||
|
def __lt__(self, other: "StyledFigure") -> bool:
|
||||||
|
"""Compare figures based on priority and layer."""
|
||||||
|
if self.get_layer() != other.get_layer():
|
||||||
|
print(self.get_layer() < other.get_layer())
|
||||||
|
return self.get_layer() < other.get_layer()
|
||||||
|
|
||||||
|
return self.line_style.priority < other.line_style.priority
|
||||||
|
|
||||||
|
|
||||||
def is_clockwise(polygon: list[OSMNode]) -> bool:
|
def is_clockwise(polygon: list[OSMNode]) -> bool:
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Reference in a new issue