diff --git a/roentgen/raster.py b/roentgen/raster.py index ccac9c7..54e08cb 100644 --- a/roentgen/raster.py +++ b/roentgen/raster.py @@ -1,6 +1,7 @@ """ Rasterize vector graphics using Inkscape. """ +import logging import os import subprocess from pathlib import Path @@ -25,4 +26,5 @@ def rasterize(from_: Path, to_: Path, area: str = "", dpi: float = 90) -> None: commands += ["--export-area", area] commands += [from_.absolute()] + logging.info(f"Rasterize SVG file to {to_}...") subprocess.run(commands) diff --git a/roentgen/road.py b/roentgen/road.py index a78a132..f0b66a4 100644 --- a/roentgen/road.py +++ b/roentgen/road.py @@ -29,6 +29,9 @@ class Lane: change: Optional[str] = None # "not_left", "not_right" destination: Optional[str] = None # Lane destination + def set_forward(self, is_forward: bool) -> None: + self.is_forward = is_forward + def get_width(self, scale: float): """Get lane width. We use standard 3.7 m lane.""" if self.width is None: diff --git a/roentgen/tile.py b/roentgen/tile.py index 431c1f8..44025e2 100644 --- a/roentgen/tile.py +++ b/roentgen/tile.py @@ -78,10 +78,14 @@ class Tiles: file_path: Path = tile.get_file_name(directory) if not file_path.exists(): tile.draw_for_map(map_, directory) + else: + logging.info(f"File {file_path} already exists.") output_path: Path = file_path.with_suffix(".png") if not output_path.exists(): rasterize(file_path, output_path) + else: + logging.info(f"File {output_path} already exists.") def draw_image(self, cache_path: Path) -> None: """ @@ -130,12 +134,17 @@ class Tiles: ) painter.draw(constructor) + logging.info(f"Writing output SVG {output_path}...") with output_path.open("w+") as output_file: svg.write(output_file) + else: + logging.info(f"File {output_path} already exists.") png_path: Path = cache_path / f"{self.boundary_box.get_format()}.png" if not png_path.exists(): rasterize(output_path, png_path) + else: + logging.info(f"File {png_path} already exists.") @dataclass