Add --roofs argument; rename argument.

Rename --show-tooltips to --tooltips.
This commit is contained in:
Sergey Vartanov 2021-09-23 05:56:25 +03:00
parent d5847a8cf7
commit fca08ab279
3 changed files with 17 additions and 5 deletions

View file

@ -34,6 +34,7 @@ class BuildingMode(Enum):
Building drawing mode. Building drawing mode.
""" """
NO: str = "no"
FLAT: str = "flat" FLAT: str = "flat"
ISOMETRIC: str = "isometric" ISOMETRIC: str = "isometric"
ISOMETRIC_NO_PARTS: str = "isometric-no-parts" ISOMETRIC_NO_PARTS: str = "isometric-no-parts"
@ -55,6 +56,7 @@ class MapConfiguration:
show_tooltips: bool = False show_tooltips: bool = False
country: str = "world" country: str = "world"
ignore_level_matching: bool = False ignore_level_matching: bool = False
draw_roofs: bool = True
@classmethod @classmethod
def from_options( def from_options(
@ -72,6 +74,7 @@ class MapConfiguration:
options.show_tooltips, options.show_tooltips,
options.country, options.country,
options.ignore_level_matching, options.ignore_level_matching,
options.draw_roofs,
) )
def is_wireframe(self) -> bool: def is_wireframe(self) -> bool:

View file

@ -125,6 +125,8 @@ class Map:
def draw_buildings(self, constructor: Constructor) -> None: def draw_buildings(self, constructor: Constructor) -> None:
"""Draw buildings: shade, walls, and roof.""" """Draw buildings: shade, walls, and roof."""
if self.configuration.building_mode == BuildingMode.NO:
return
if self.configuration.building_mode == BuildingMode.FLAT: if self.configuration.building_mode == BuildingMode.FLAT:
for building in constructor.buildings: for building in constructor.buildings:
building.draw(self.svg, self.flinger) building.draw(self.svg, self.flinger)
@ -146,9 +148,10 @@ class Map:
continue continue
building.draw_walls(self.svg, height, previous_height, scale) building.draw_walls(self.svg, height, previous_height, scale)
for building in constructor.buildings: if self.configuration.draw_roofs:
if building.height == height: for building in constructor.buildings:
building.draw_roof(self.svg, self.flinger, scale) if building.height == height:
building.draw_roof(self.svg, self.flinger, scale)
previous_height = height previous_height = height

View file

@ -20,7 +20,7 @@ COMMANDS: dict[str, list[str]] = {
"render", "render",
"-b", "-b",
"10.000,20.000,10.001,20.001", "10.000,20.000,10.001,20.001",
"--show-tooltips", "--tooltips",
], ],
"icons": ["icons"], "icons": ["icons"],
"mapcss": ["mapcss"], "mapcss": ["mapcss"],
@ -115,7 +115,7 @@ def add_map_arguments(parser: argparse.ArgumentParser) -> None:
metavar="<string>", metavar="<string>",
) )
parser.add_argument( parser.add_argument(
"--show-tooltips", "--tooltips",
help="add tooltips with tags for icons in SVG files", help="add tooltips with tags for icons in SVG files",
action=argparse.BooleanOptionalAction, action=argparse.BooleanOptionalAction,
default=False, default=False,
@ -132,6 +132,12 @@ def add_map_arguments(parser: argparse.ArgumentParser) -> None:
action=argparse.BooleanOptionalAction, action=argparse.BooleanOptionalAction,
default=False, default=False,
) )
parser.add_argument(
"--roofs",
help="draw building roofs",
action=argparse.BooleanOptionalAction,
default=True,
)
def add_tile_arguments(parser: argparse.ArgumentParser) -> None: def add_tile_arguments(parser: argparse.ArgumentParser) -> None: