maps4fs 2.6.1__py3-none-any.whl → 2.7.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- maps4fs/generator/config.py +20 -28
- maps4fs/generator/map.py +15 -5
- maps4fs/generator/settings.py +3 -0
- {maps4fs-2.6.1.dist-info → maps4fs-2.7.0.dist-info}/METADATA +1 -1
- {maps4fs-2.6.1.dist-info → maps4fs-2.7.0.dist-info}/RECORD +8 -8
- {maps4fs-2.6.1.dist-info → maps4fs-2.7.0.dist-info}/WHEEL +0 -0
- {maps4fs-2.6.1.dist-info → maps4fs-2.7.0.dist-info}/licenses/LICENSE.md +0 -0
- {maps4fs-2.6.1.dist-info → maps4fs-2.7.0.dist-info}/top_level.txt +0 -0
maps4fs/generator/config.py
CHANGED
@@ -12,38 +12,30 @@ from maps4fs.logger import Logger
|
|
12
12
|
logger = Logger()
|
13
13
|
|
14
14
|
MFS_TEMPLATES_DIR = os.path.join(os.getcwd(), "templates")
|
15
|
+
|
15
16
|
MFS_DEFAULTS_DIR = os.path.join(os.getcwd(), "defaults")
|
16
17
|
MFS_DEM_DEFAULTS_DIR = os.path.join(MFS_DEFAULTS_DIR, "dem")
|
17
18
|
MFS_OSM_DEFAULTS_DIR = os.path.join(MFS_DEFAULTS_DIR, "osm")
|
18
|
-
os.
|
19
|
-
os.
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
"""Get the path to the default OSM file if it exists.
|
29
|
-
|
30
|
-
Returns:
|
31
|
-
str | None: The path to the default OSM file, or None if it doesn't exist.
|
32
|
-
"""
|
33
|
-
res = DEFAULT_OSM_PATH if os.path.isfile(DEFAULT_OSM_PATH) else None
|
34
|
-
logger.info("Default OSM in %s, result: %s", DEFAULT_OSM_PATH, res)
|
35
|
-
return res
|
19
|
+
MFS_MSETTINGS_DEFAULTS_DIR = os.path.join(MFS_DEFAULTS_DIR, "main_settings")
|
20
|
+
MFS_GSETTINGS_DEFAULTS_DIR = os.path.join(MFS_DEFAULTS_DIR, "generation_settings")
|
21
|
+
default_dirs = [
|
22
|
+
MFS_DEM_DEFAULTS_DIR,
|
23
|
+
MFS_OSM_DEFAULTS_DIR,
|
24
|
+
MFS_MSETTINGS_DEFAULTS_DIR,
|
25
|
+
MFS_GSETTINGS_DEFAULTS_DIR,
|
26
|
+
]
|
27
|
+
for directory in default_dirs:
|
28
|
+
os.makedirs(directory, exist_ok=True)
|
36
29
|
|
37
|
-
|
38
|
-
|
39
|
-
"
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
return res
|
30
|
+
logger.info("MFS_TEMPLATES_DIR: %s. MFS_DEFAULTS_DIR: %s.", MFS_TEMPLATES_DIR, MFS_DEFAULTS_DIR)
|
31
|
+
logger.info(
|
32
|
+
"MFS_DEM_DEFAULTS_DIR: %s. MFS_OSM_DEFAULTS_DIR: %s. "
|
33
|
+
"MFS_MSETTINGS_DEFAULTS_DIR: %s. MFS_GSETTINGS_DEFAULTS_DIR: %s.",
|
34
|
+
MFS_DEM_DEFAULTS_DIR,
|
35
|
+
MFS_OSM_DEFAULTS_DIR,
|
36
|
+
MFS_MSETTINGS_DEFAULTS_DIR,
|
37
|
+
MFS_GSETTINGS_DEFAULTS_DIR,
|
38
|
+
)
|
47
39
|
|
48
40
|
|
49
41
|
def ensure_templates():
|
maps4fs/generator/map.py
CHANGED
@@ -66,10 +66,23 @@ class Map:
|
|
66
66
|
# endregion
|
67
67
|
|
68
68
|
# region custom OSM properties
|
69
|
-
self.custom_osm = custom_osm or mfscfg.default_osm()
|
70
69
|
if custom_osm and not os.path.isfile(custom_osm):
|
71
70
|
raise FileNotFoundError(f"Custom OSM file {custom_osm} does not exist.")
|
72
|
-
mfsutils.check_and_fix_osm(
|
71
|
+
mfsutils.check_and_fix_osm(custom_osm, save_directory=self.map_directory)
|
72
|
+
self.custom_osm = custom_osm
|
73
|
+
# endregion
|
74
|
+
|
75
|
+
# region custom DEM handling
|
76
|
+
self.custom_background_path: str | None = None
|
77
|
+
custom_dem = kwargs.get("custom_background_path", None)
|
78
|
+
if custom_dem and not os.path.isfile(custom_dem):
|
79
|
+
raise FileNotFoundError(f"Custom DEM file {custom_dem} does not exist.")
|
80
|
+
|
81
|
+
# Make a copy of the custom DEM to the map directory.
|
82
|
+
if custom_dem:
|
83
|
+
save_path = os.path.join(self.map_directory, os.path.basename(custom_dem))
|
84
|
+
shutil.copyfile(custom_dem, save_path)
|
85
|
+
self.custom_background_path = save_path
|
73
86
|
# endregion
|
74
87
|
|
75
88
|
# region main settings
|
@@ -125,9 +138,6 @@ class Map:
|
|
125
138
|
|
126
139
|
self.shared_settings = SharedSettings()
|
127
140
|
self.components: list[Component] = []
|
128
|
-
custom_dem = kwargs.get("custom_background_path", None)
|
129
|
-
self.custom_background_path = custom_dem or mfscfg.default_dem()
|
130
|
-
self.logger.info("Custom DEM path: %s", self.custom_background_path)
|
131
141
|
|
132
142
|
def process_settings(self) -> None:
|
133
143
|
"""Checks the settings by predefined rules and updates them accordingly."""
|
maps4fs/generator/settings.py
CHANGED
@@ -323,6 +323,7 @@ class MainSettings(NamedTuple):
|
|
323
323
|
rotation: int
|
324
324
|
dtm_provider: str
|
325
325
|
custom_osm: bool
|
326
|
+
custom_dem: bool
|
326
327
|
is_public: bool
|
327
328
|
date: str
|
328
329
|
time: str
|
@@ -358,6 +359,7 @@ class MainSettings(NamedTuple):
|
|
358
359
|
"rotation": self.rotation,
|
359
360
|
"dtm_provider": self.dtm_provider,
|
360
361
|
"custom_osm": self.custom_osm,
|
362
|
+
"custom_dem": self.custom_dem,
|
361
363
|
"is_public": self.is_public,
|
362
364
|
"date": self.date,
|
363
365
|
"time": self.time,
|
@@ -388,6 +390,7 @@ class MainSettings(NamedTuple):
|
|
388
390
|
rotation=map.rotation,
|
389
391
|
dtm_provider=map.dtm_provider.name(),
|
390
392
|
custom_osm=bool(map.custom_osm),
|
393
|
+
custom_dem=bool(map.custom_background_path),
|
391
394
|
is_public=map.kwargs.get("is_public", False),
|
392
395
|
date=datetime.now().strftime("%Y-%m-%d"),
|
393
396
|
time=datetime.now().strftime("%H:%M:%S"),
|
@@ -1,11 +1,11 @@
|
|
1
1
|
maps4fs/__init__.py,sha256=5ixsCA5vgcIV0OrF9EJBm91Mmc_KfMiDRM-QyifMAvo,386
|
2
2
|
maps4fs/logger.py,sha256=6sem0aFKQqtVjQ_yNu9iGcc-hqzLQUhfxco05K6nqow,763
|
3
3
|
maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
|
4
|
-
maps4fs/generator/config.py,sha256=
|
4
|
+
maps4fs/generator/config.py,sha256=iCrxIRkETUwL-VVq8eskIekPnA8YD09b-I9gWPxsvqQ,6401
|
5
5
|
maps4fs/generator/game.py,sha256=nf6iuYNA5NJc-ir_WOgkw-MdJVgetVHeEtxbWJYt3Vo,14462
|
6
|
-
maps4fs/generator/map.py,sha256=
|
6
|
+
maps4fs/generator/map.py,sha256=T-oVU9aNSgFwqell_FglFlNu8EJJ1e8CQRtaSpznVAE,13315
|
7
7
|
maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
|
8
|
-
maps4fs/generator/settings.py,sha256=
|
8
|
+
maps4fs/generator/settings.py,sha256=oDs_bgvqHMJfKGK7uVVkm6MykAL3dVkvm5L3-hvZx2c,13044
|
9
9
|
maps4fs/generator/statistics.py,sha256=Dp1-NS-DWv0l0UdmhOoXeQs_N-Hs7svYUnmziSW5Z9I,2098
|
10
10
|
maps4fs/generator/utils.py,sha256=ugdQ8C22NeiZLIlldLoEKCc7ioOefz4W-8qF2eOy9qU,4834
|
11
11
|
maps4fs/generator/component/__init__.py,sha256=s01yVVVi8R2xxNvflu2D6wTd9I_g73AMM2x7vAC7GX4,490
|
@@ -22,8 +22,8 @@ maps4fs/generator/component/base/component.py,sha256=lf0V9CLUXMg88Nm2yI3rP5taVYY
|
|
22
22
|
maps4fs/generator/component/base/component_image.py,sha256=WTGC6v1KuS5sLNCC95Z48nCspvATKKNOuhTNYzTWXr4,8315
|
23
23
|
maps4fs/generator/component/base/component_mesh.py,sha256=3hC-qDT8Vde6SmRMqs9USAkrF-gL2dDTYW71ATpxUS4,9130
|
24
24
|
maps4fs/generator/component/base/component_xml.py,sha256=MT-VhU2dEckLFxAgmxg6V3gnv11di_94Qq6atfpOLdc,5342
|
25
|
-
maps4fs-2.
|
26
|
-
maps4fs-2.
|
27
|
-
maps4fs-2.
|
28
|
-
maps4fs-2.
|
29
|
-
maps4fs-2.
|
25
|
+
maps4fs-2.7.0.dist-info/licenses/LICENSE.md,sha256=Ptw8AkqJ60c4tRts6yuqGP_8B0dxwOGmJsp6YJ8dKqM,34328
|
26
|
+
maps4fs-2.7.0.dist-info/METADATA,sha256=AEnOvFzFIsBb4XmL1WJ4KM6d62KtCSKmE_T3diwNRxY,9452
|
27
|
+
maps4fs-2.7.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
28
|
+
maps4fs-2.7.0.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
|
29
|
+
maps4fs-2.7.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|