maps4fs 1.8.197__tar.gz → 1.8.199__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 (64) hide show
  1. {maps4fs-1.8.197 → maps4fs-1.8.199}/PKG-INFO +1 -1
  2. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/component/background.py +1 -0
  3. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/component/base/component_mesh.py +15 -6
  4. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/dtm.py +11 -1
  5. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs.egg-info/PKG-INFO +1 -1
  6. {maps4fs-1.8.197 → maps4fs-1.8.199}/pyproject.toml +1 -1
  7. {maps4fs-1.8.197 → maps4fs-1.8.199}/LICENSE.md +0 -0
  8. {maps4fs-1.8.197 → maps4fs-1.8.199}/README.md +0 -0
  9. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/__init__.py +0 -0
  10. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/__init__.py +0 -0
  11. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/component/__init__.py +0 -0
  12. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/component/base/__init__.py +0 -0
  13. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/component/base/component.py +0 -0
  14. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/component/base/component_image.py +0 -0
  15. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/component/base/component_xml.py +0 -0
  16. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/component/config.py +0 -0
  17. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/component/grle.py +0 -0
  18. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/component/i3d.py +0 -0
  19. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/component/layer.py +0 -0
  20. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/component/satellite.py +0 -0
  21. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/component/texture.py +0 -0
  22. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dem.py +0 -0
  23. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/__init__.py +0 -0
  24. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/arctic.py +0 -0
  25. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/baden.py +0 -0
  26. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/base/wcs.py +0 -0
  27. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/base/wms.py +0 -0
  28. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/bavaria.py +0 -0
  29. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/canada.py +0 -0
  30. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/czech.py +0 -0
  31. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/denmark.py +0 -0
  32. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/england.py +0 -0
  33. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/finland.py +0 -0
  34. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/flanders.py +0 -0
  35. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/france.py +0 -0
  36. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/hessen.py +0 -0
  37. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/italy.py +0 -0
  38. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/mv.py +0 -0
  39. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/niedersachsen.py +0 -0
  40. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/norway.py +0 -0
  41. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/nrw.py +0 -0
  42. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/rema.py +0 -0
  43. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/sachsenanhalt.py +0 -0
  44. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/scotland.py +0 -0
  45. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/spain.py +0 -0
  46. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/srtm.py +0 -0
  47. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/switzerland.py +0 -0
  48. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/usgs_wcs.py +0 -0
  49. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/dtm/utils.py +0 -0
  50. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/game.py +0 -0
  51. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/map.py +0 -0
  52. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/qgis.py +0 -0
  53. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/generator/settings.py +0 -0
  54. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/logger.py +0 -0
  55. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/toolbox/__init__.py +0 -0
  56. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/toolbox/background.py +0 -0
  57. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/toolbox/custom_osm.py +0 -0
  58. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs/toolbox/dem.py +0 -0
  59. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs.egg-info/SOURCES.txt +0 -0
  60. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs.egg-info/dependency_links.txt +0 -0
  61. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs.egg-info/requires.txt +0 -0
  62. {maps4fs-1.8.197 → maps4fs-1.8.199}/maps4fs.egg-info/top_level.txt +0 -0
  63. {maps4fs-1.8.197 → maps4fs-1.8.199}/setup.cfg +0 -0
  64. {maps4fs-1.8.197 → maps4fs-1.8.199}/tests/test_generator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: maps4fs
3
- Version: 1.8.197
3
+ Version: 1.8.199
4
4
  Summary: Generate map templates for Farming Simulator from real places.
5
5
  Author-email: iwatkot <iwatkot@gmail.com>
6
6
  License: MIT License
@@ -84,6 +84,7 @@ class Background(MeshComponent, ImageComponent):
84
84
 
85
85
  if not self.map.custom_background_path:
86
86
  self.dem.process()
87
+ self.validate_np_for_mesh(self.dem.dem_path, self.map_size)
87
88
 
88
89
  shutil.copyfile(self.dem.dem_path, self.not_substracted_path)
89
90
  self.save_map_dem(self.dem.dem_path, save_path=self.not_resized_path)
@@ -1,5 +1,7 @@
1
1
  """Base class for all components that primarily used to work with meshes."""
2
2
 
3
+ import os
4
+
3
5
  import cv2
4
6
  import numpy as np
5
7
  import trimesh
@@ -17,24 +19,31 @@ class MeshComponent(Component):
17
19
  """Checks if the given image is a valid for mesh generation.
18
20
 
19
21
  Arguments:
20
- image_path (str): The path to the custom background image.
22
+ image_path (str): The path to the background image.
21
23
  map_size (int): The size of the map.
22
24
 
23
25
  Raises:
24
- ValueError: If the custom background image does not meet the requirements.
26
+ FileNotFoundError: If the background image is not found.
27
+ ValueError: If the background image does not meet the requirements.
25
28
  """
29
+ if not os.path.isfile(image_path):
30
+ raise FileNotFoundError(f"Can't find the background DEM image at {image_path}.")
31
+
26
32
  image = cv2.imread(image_path, cv2.IMREAD_UNCHANGED)
33
+ if image is None:
34
+ raise ValueError(f"Can't read the background DEM image at {image_path}.")
35
+
27
36
  if image.shape[0] != image.shape[1]:
28
- raise ValueError("The custom background image must be a square.")
37
+ raise ValueError("The background image must be a square.")
29
38
 
30
39
  if image.shape[0] != map_size + Parameters.BACKGROUND_DISTANCE * 2:
31
- raise ValueError("The custom background image must have the size of the map + 4096.")
40
+ raise ValueError("The background image must have the size of the map + 4096.")
32
41
 
33
42
  if len(image.shape) != 2:
34
- raise ValueError("The custom background image must be a grayscale image.")
43
+ raise ValueError("The background image must be a grayscale image.")
35
44
 
36
45
  if image.dtype != np.uint16:
37
- raise ValueError("The custom background image must be a 16-bit grayscale image.")
46
+ raise ValueError("The background image must be a 16-bit grayscale image.")
38
47
 
39
48
  @staticmethod
40
49
  def mesh_to_stl(mesh: trimesh.Trimesh, save_path: str) -> None:
@@ -249,10 +249,16 @@ class DTMProvider(ABC):
249
249
  return None
250
250
 
251
251
  @classmethod
252
- def get_valid_provider_descriptions(cls, lat_lon: tuple[float, float]) -> dict[str, str]:
252
+ def get_valid_provider_descriptions(
253
+ cls, lat_lon: tuple[float, float], default_code: str = "srtm30"
254
+ ) -> dict[str, str]:
253
255
  """Get descriptions of all providers, where keys are provider codes and
254
256
  values are provider descriptions.
255
257
 
258
+ Arguments:
259
+ lat_lon (tuple): Latitude and longitude of the center point.
260
+ default_code (str): Default provider code.
261
+
256
262
  Returns:
257
263
  dict: Provider descriptions.
258
264
  """
@@ -262,6 +268,10 @@ class DTMProvider(ABC):
262
268
  code = provider.code()
263
269
  if code is not None:
264
270
  providers[code] = provider.description()
271
+
272
+ # Sort the dictionary, to make sure that the default provider is the first one.
273
+ providers = dict(sorted(providers.items(), key=lambda item: item[0] != default_code))
274
+
265
275
  return providers
266
276
 
267
277
  @classmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: maps4fs
3
- Version: 1.8.197
3
+ Version: 1.8.199
4
4
  Summary: Generate map templates for Farming Simulator from real places.
5
5
  Author-email: iwatkot <iwatkot@gmail.com>
6
6
  License: MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "maps4fs"
7
- version = "1.8.197"
7
+ version = "1.8.199"
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 = "MIT License"}
File without changes
File without changes
File without changes
File without changes
File without changes