maps4fs 2.6.1__tar.gz → 2.7.0__tar.gz

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.
Files changed (35) hide show
  1. {maps4fs-2.6.1 → maps4fs-2.7.0}/PKG-INFO +1 -1
  2. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/config.py +20 -28
  3. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/map.py +15 -5
  4. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/settings.py +3 -0
  5. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs.egg-info/PKG-INFO +1 -1
  6. {maps4fs-2.6.1 → maps4fs-2.7.0}/pyproject.toml +1 -1
  7. {maps4fs-2.6.1 → maps4fs-2.7.0}/LICENSE.md +0 -0
  8. {maps4fs-2.6.1 → maps4fs-2.7.0}/README.md +0 -0
  9. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/__init__.py +0 -0
  10. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/__init__.py +0 -0
  11. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/component/__init__.py +0 -0
  12. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/component/background.py +0 -0
  13. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/component/base/__init__.py +0 -0
  14. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/component/base/component.py +0 -0
  15. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/component/base/component_image.py +0 -0
  16. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/component/base/component_mesh.py +0 -0
  17. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/component/base/component_xml.py +0 -0
  18. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/component/config.py +0 -0
  19. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/component/dem.py +0 -0
  20. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/component/grle.py +0 -0
  21. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/component/i3d.py +0 -0
  22. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/component/layer.py +0 -0
  23. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/component/satellite.py +0 -0
  24. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/component/texture.py +0 -0
  25. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/game.py +0 -0
  26. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/qgis.py +0 -0
  27. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/statistics.py +0 -0
  28. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/generator/utils.py +0 -0
  29. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs/logger.py +0 -0
  30. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs.egg-info/SOURCES.txt +0 -0
  31. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs.egg-info/dependency_links.txt +0 -0
  32. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs.egg-info/requires.txt +0 -0
  33. {maps4fs-2.6.1 → maps4fs-2.7.0}/maps4fs.egg-info/top_level.txt +0 -0
  34. {maps4fs-2.6.1 → maps4fs-2.7.0}/setup.cfg +0 -0
  35. {maps4fs-2.6.1 → maps4fs-2.7.0}/tests/test_generator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maps4fs
3
- Version: 2.6.1
3
+ Version: 2.7.0
4
4
  Summary: Generate map templates for Farming Simulator from real places.
5
5
  Author-email: iwatkot <iwatkot@gmail.com>
6
6
  License: GNU Affero General Public License v3.0
@@ -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.makedirs(MFS_OSM_DEFAULTS_DIR, exist_ok=True)
19
- os.makedirs(MFS_DEM_DEFAULTS_DIR, exist_ok=True)
20
- logger.info("MFS_TEMPLATES_DIR: %s. MFS_DEFAULTS_DIR: %s.", MFS_TEMPLATES_DIR, MFS_DEFAULTS_DIR)
21
-
22
- DEFAULT_OSM_PATH = os.path.join(MFS_OSM_DEFAULTS_DIR, "custom_osm.osm")
23
- DEFAULT_DEM_PATH = os.path.join(MFS_DEM_DEFAULTS_DIR, "custom_dem.png")
24
- logger.info("DEFAULT_OSM_PATH: %s. DEFAULT_DEM_PATH: %s.", DEFAULT_OSM_PATH, DEFAULT_DEM_PATH)
25
-
26
-
27
- def default_osm() -> str | None:
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
- def default_dem() -> str | None:
39
- """Get the path to the default DEM file if it exists.
40
-
41
- Returns:
42
- str | None: The path to the default DEM file, or None if it doesn't exist.
43
- """
44
- res = DEFAULT_DEM_PATH if os.path.isfile(DEFAULT_DEM_PATH) else None
45
- logger.info("Default DEM in %s, result: %s", DEFAULT_DEM_PATH, res)
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():
@@ -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(self.custom_osm, save_directory=self.map_directory)
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."""
@@ -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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maps4fs
3
- Version: 2.6.1
3
+ Version: 2.7.0
4
4
  Summary: Generate map templates for Farming Simulator from real places.
5
5
  Author-email: iwatkot <iwatkot@gmail.com>
6
6
  License: GNU Affero General Public License v3.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "maps4fs"
7
- version = "2.6.1"
7
+ version = "2.7.0"
8
8
  description = "Generate map templates for Farming Simulator from real places."
9
9
  authors = [{name = "iwatkot", email = "iwatkot@gmail.com"}]
10
10
  license = {text = "GNU Affero General Public License v3.0"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes