Fix enum values.

This commit is contained in:
Sergey Vartanov 2021-10-20 23:49:34 +03:00
parent 15ab5e7d62
commit a5910786e2
13 changed files with 31 additions and 35 deletions

3
.gitignore vendored
View file

@ -24,3 +24,6 @@ precommit.py
.idea .idea
temp temp
venv venv
compare.html
taginfo

View file

@ -6,6 +6,7 @@
<w>betula</w> <w>betula</w>
<w>carto</w> <w>carto</w>
<w>changeset</w> <w>changeset</w>
<w>cladr</w>
<w>dasharray</w> <w>dasharray</w>
<w>defs</w> <w>defs</w>
<w>dharmachakra</w> <w>dharmachakra</w>

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 2.6 MiB

After

Width:  |  Height:  |  Size: 2.6 MiB

Before After
Before After

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 7.7 MiB

After

Width:  |  Height:  |  Size: 7.7 MiB

Before After
Before After

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 315 KiB

After

Width:  |  Height:  |  Size: 319 KiB

Before After
Before After

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 347 KiB

After

Width:  |  Height:  |  Size: 348 KiB

Before After
Before After

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 199 KiB

After

Width:  |  Height:  |  Size: 199 KiB

Before After
Before After

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 1.6 MiB

Before After
Before After

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 206 KiB

After

Width:  |  Height:  |  Size: 207 KiB

Before After
Before After

View file

@ -241,7 +241,7 @@ class Constructor:
if not line.tags: if not line.tags:
return return
building_mode: str = self.configuration.building_mode building_mode: BuildingMode = self.configuration.building_mode
if "building" in line.tags or ( if "building" in line.tags or (
building_mode == BuildingMode.ISOMETRIC building_mode == BuildingMode.ISOMETRIC
and "building:part" in line.tags and "building:part" in line.tags

View file

@ -10,45 +10,37 @@ __email__ = "me@enzet.ru"
class DrawingMode(Enum): class DrawingMode(Enum):
""" """Map drawing mode."""
Map drawing mode.
"""
NORMAL: str = "normal" NORMAL = "normal"
AUTHOR: str = "author" AUTHOR = "author"
TIME: str = "time" TIME = "time"
class LabelMode(Enum): class LabelMode(Enum):
""" """Label drawing mode."""
Label drawing mode.
"""
NO: str = "no" NO = "no"
MAIN: str = "main" MAIN = "main"
ALL: str = "all" ALL = "all"
class BuildingMode(Enum): class BuildingMode(Enum):
""" """Building drawing mode."""
Building drawing mode.
"""
NO: str = "no" NO = "no"
FLAT: str = "flat" FLAT = "flat"
ISOMETRIC: str = "isometric" ISOMETRIC = "isometric"
ISOMETRIC_NO_PARTS: str = "isometric-no-parts" ISOMETRIC_NO_PARTS = "isometric-no-parts"
@dataclass @dataclass
class MapConfiguration: class MapConfiguration:
""" """Map drawing configuration."""
Map drawing configuration.
"""
drawing_mode: str = DrawingMode.NORMAL drawing_mode: DrawingMode = DrawingMode.NORMAL
building_mode: str = BuildingMode.FLAT building_mode: BuildingMode = BuildingMode.FLAT
label_mode: str = LabelMode.MAIN label_mode: LabelMode = LabelMode.MAIN
zoom_level: float = 18.0 zoom_level: float = 18.0
overlap: int = 12 overlap: int = 12
level: str = "overground" level: str = "overground"

View file

@ -163,7 +163,7 @@ class Point(Tagged):
self, self,
svg: svgwrite.Drawing, svg: svgwrite.Drawing,
occupied: Optional[Occupied] = None, occupied: Optional[Occupied] = None,
label_mode: str = LabelMode.MAIN, label_mode: LabelMode = LabelMode.MAIN,
) -> None: ) -> None:
"""Draw all labels.""" """Draw all labels."""
labels: list[Label] labels: list[Label]

View file

@ -635,7 +635,7 @@ class Scheme:
texts.append(Label(f"{tags['height']} m")) texts.append(Label(f"{tags['height']} m"))
processed.add("height") processed.add("height")
for tag in tags: for tag in tags:
if self.is_writable(tag) and tag not in processed: if self.is_writable(tag, tags[tag]) and tag not in processed:
texts.append(Label(tags[tag])) texts.append(Label(tags[tag]))
return texts return texts