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.
"""
NO: str = "no"
FLAT: str = "flat"
ISOMETRIC: str = "isometric"
ISOMETRIC_NO_PARTS: str = "isometric-no-parts"
@ -55,6 +56,7 @@ class MapConfiguration:
show_tooltips: bool = False
country: str = "world"
ignore_level_matching: bool = False
draw_roofs: bool = True
@classmethod
def from_options(
@ -72,6 +74,7 @@ class MapConfiguration:
options.show_tooltips,
options.country,
options.ignore_level_matching,
options.draw_roofs,
)
def is_wireframe(self) -> bool:

View file

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

View file

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