diff --git a/doc/surveillance.png b/doc/surveillance.png index b488f91..37b419e 100644 Binary files a/doc/surveillance.png and b/doc/surveillance.png differ diff --git a/roentgen/constructor.py b/roentgen/constructor.py index 7033017..036d749 100644 --- a/roentgen/constructor.py +++ b/roentgen/constructor.py @@ -30,6 +30,12 @@ TIME_COLOR_SCALE: List[Color] = [ Color("#581845"), Color("#900C3F"), Color("#C70039"), Color("#FF5733"), Color("#FFC300"), Color("#DAF7A6") ] +ROAD_HIGHWAY_VALUES: List[str] = [ + "motorway", "trunk", "primary", "secondary", "tertiary", "unclassified", + "residential", "motorway_link", "trunk_link", "primary_link", + "secondary_link", "tertiary_link", "living_street", "service", + "pedestrian", "track", "bus_guideway", "escape", "raceway", "road", "busway" +] def is_clockwise(polygon: List[OSMNode]) -> bool: @@ -170,9 +176,10 @@ class Road(Figure): def __init__( self, tags: Dict[str, str], inners, outers, flinger: Flinger, - line_style: LineStyle + line_styles: List[LineStyle] ): - super().__init__(tags, inners, outers, line_style) + super().__init__(tags, inners, outers, None) + self.line_styles = line_styles def line_center(nodes: List[OSMNode], flinger: Flinger) -> np.array: @@ -380,6 +387,15 @@ class Constructor: Building(line.tags, inners, outers, self.flinger, self.scheme) ) + if ( + "highway" in line.tags + and line.tags["highway"] in ROAD_HIGHWAY_VALUES + ): + self.roads.append( + Road(line.tags, inners, outers, self.flinger, line_styles) + ) + return + for line_style in line_styles: # type: LineStyle self.figures.append( Figure(line.tags, inners, outers, line_style) diff --git a/roentgen/mapper.py b/roentgen/mapper.py index fafd198..a315e1a 100644 --- a/roentgen/mapper.py +++ b/roentgen/mapper.py @@ -74,6 +74,20 @@ class Painter: self.svg.add(path) ui.progress_bar(-1, 0, text="Drawing ways") + roads = sorted( + constructor.roads, key=lambda x: x.line_styles[0].priority + ) + for road in roads: + path_commands: str = road.get_path(self.flinger) + path = Path(d=path_commands) + path.update(road.line_styles[0].style) + self.svg.add(path) + for road in roads: + path_commands: str = road.get_path(self.flinger) + path = Path(d=path_commands) + path.update(road.line_styles[1].style) + self.svg.add(path) + # Trees for node in constructor.points: