mirror of
https://github.com/enzet/map-machine.git
synced 2025-07-24 03:48:43 +02:00
Rename Röntgen to Map Machine.
This commit is contained in:
parent
38c4e00de3
commit
2bd89a6539
57 changed files with 252 additions and 236 deletions
73
map_machine/map_configuration.py
Normal file
73
map_machine/map_configuration.py
Normal file
|
@ -0,0 +1,73 @@
|
|||
"""
|
||||
Map drawing configuration.
|
||||
"""
|
||||
import argparse
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
||||
|
||||
class DrawingMode(Enum):
|
||||
"""
|
||||
Map drawing mode.
|
||||
"""
|
||||
|
||||
NORMAL: str = "normal"
|
||||
AUTHOR: str = "author"
|
||||
TIME: str = "time"
|
||||
|
||||
|
||||
class LabelMode(Enum):
|
||||
"""
|
||||
Label drawing mode.
|
||||
"""
|
||||
|
||||
NO: str = "no"
|
||||
MAIN: str = "main"
|
||||
ALL: str = "all"
|
||||
|
||||
|
||||
class BuildingMode(Enum):
|
||||
"""
|
||||
Building drawing mode.
|
||||
"""
|
||||
|
||||
FLAT: str = "flat"
|
||||
ISOMETRIC: str = "isometric"
|
||||
ISOMETRIC_NO_PARTS: str = "isometric-no-parts"
|
||||
|
||||
|
||||
@dataclass
|
||||
class MapConfiguration:
|
||||
"""
|
||||
Map drawing configuration.
|
||||
"""
|
||||
|
||||
drawing_mode: str = DrawingMode.NORMAL
|
||||
building_mode: str = BuildingMode.FLAT
|
||||
label_mode: str = LabelMode.MAIN
|
||||
zoom_level: float = 18.0
|
||||
overlap: int = 12
|
||||
level: str = "overground"
|
||||
seed: str = ""
|
||||
|
||||
@classmethod
|
||||
def from_options(
|
||||
cls, options: argparse.Namespace, zoom_level: int
|
||||
) -> "MapConfiguration":
|
||||
"""Initialize from command-line options."""
|
||||
return cls(
|
||||
DrawingMode(options.mode),
|
||||
BuildingMode(options.buildings),
|
||||
LabelMode(options.label_mode),
|
||||
zoom_level,
|
||||
options.overlap,
|
||||
options.level,
|
||||
options.seed,
|
||||
)
|
||||
|
||||
def is_wireframe(self) -> bool:
|
||||
"""Whether drawing mode is special."""
|
||||
return self.drawing_mode != DrawingMode.NORMAL
|
Loading…
Add table
Add a link
Reference in a new issue