mirror of
https://github.com/enzet/map-machine.git
synced 2025-06-07 05:11:53 +02:00
Fix area detection.
This commit is contained in:
parent
918e9a7022
commit
3ee56a2f6d
2 changed files with 8 additions and 4 deletions
|
@ -269,9 +269,10 @@ class Constructor:
|
|||
|
||||
road_matcher: RoadMatcher = self.scheme.get_road(line.tags)
|
||||
if road_matcher:
|
||||
self.roads.append(
|
||||
Road(line.tags, outers[0], road_matcher, self.flinger)
|
||||
road: Road = Road(
|
||||
line.tags, outers[0], road_matcher, self.flinger, self.scheme
|
||||
)
|
||||
self.roads.append(road)
|
||||
return
|
||||
|
||||
processed: set[str] = set()
|
||||
|
|
|
@ -24,7 +24,7 @@ from map_machine.geometry.vector import (
|
|||
turn_by_angle,
|
||||
)
|
||||
from map_machine.osm.osm_reader import OSMNode, Tagged
|
||||
from map_machine.scheme import RoadMatcher
|
||||
from map_machine.scheme import RoadMatcher, Scheme
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
@ -372,6 +372,7 @@ class Road(Tagged):
|
|||
nodes: list[OSMNode],
|
||||
matcher: RoadMatcher,
|
||||
flinger: Flinger,
|
||||
scheme: Scheme,
|
||||
) -> None:
|
||||
super().__init__(tags)
|
||||
self.nodes: list[OSMNode] = nodes
|
||||
|
@ -385,6 +386,8 @@ class Road(Tagged):
|
|||
|
||||
self.scale: float = flinger.get_scale(self.nodes[0].coordinates)
|
||||
|
||||
self.is_area = scheme.is_area(tags) and nodes[0] == nodes[-1]
|
||||
|
||||
if "lanes" in tags:
|
||||
try:
|
||||
self.width = int(tags["lanes"]) * DEFAULT_LANE_WIDTH
|
||||
|
@ -483,7 +486,7 @@ class Road(Tagged):
|
|||
extra_width = 4.0
|
||||
|
||||
fill: str = "none"
|
||||
if self.tags.get("area") == "yes":
|
||||
if self.is_area:
|
||||
fill = color.hex
|
||||
|
||||
style: dict[str, Union[int, float, str]] = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue