maps4fs 2.8.3__tar.gz → 2.8.4__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.

Potentially problematic release.


This version of maps4fs might be problematic. Click here for more details.

Files changed (35) hide show
  1. {maps4fs-2.8.3 → maps4fs-2.8.4}/PKG-INFO +1 -1
  2. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/component/base/component_mesh.py +3 -1
  3. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/component/config.py +64 -1
  4. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/game.py +20 -0
  5. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/settings.py +3 -0
  6. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs.egg-info/PKG-INFO +1 -1
  7. {maps4fs-2.8.3 → maps4fs-2.8.4}/pyproject.toml +1 -1
  8. {maps4fs-2.8.3 → maps4fs-2.8.4}/LICENSE.md +0 -0
  9. {maps4fs-2.8.3 → maps4fs-2.8.4}/README.md +0 -0
  10. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/__init__.py +0 -0
  11. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/__init__.py +0 -0
  12. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/component/__init__.py +0 -0
  13. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/component/background.py +0 -0
  14. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/component/base/__init__.py +0 -0
  15. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/component/base/component.py +0 -0
  16. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/component/base/component_image.py +0 -0
  17. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/component/base/component_xml.py +0 -0
  18. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/component/dem.py +0 -0
  19. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/component/grle.py +0 -0
  20. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/component/i3d.py +0 -0
  21. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/component/layer.py +0 -0
  22. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/component/satellite.py +0 -0
  23. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/component/texture.py +0 -0
  24. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/config.py +0 -0
  25. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/map.py +0 -0
  26. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/qgis.py +0 -0
  27. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/statistics.py +0 -0
  28. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/generator/utils.py +0 -0
  29. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs/logger.py +0 -0
  30. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs.egg-info/SOURCES.txt +0 -0
  31. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs.egg-info/dependency_links.txt +0 -0
  32. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs.egg-info/requires.txt +0 -0
  33. {maps4fs-2.8.3 → maps4fs-2.8.4}/maps4fs.egg-info/top_level.txt +0 -0
  34. {maps4fs-2.8.3 → maps4fs-2.8.4}/setup.cfg +0 -0
  35. {maps4fs-2.8.3 → maps4fs-2.8.4}/tests/test_generator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maps4fs
3
- Version: 2.8.3
3
+ Version: 2.8.4
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
@@ -241,7 +241,9 @@ class MeshComponent(Component):
241
241
  cube_mesh = trimesh.creation.box([remove_size, remove_size, z_size * 4])
242
242
 
243
243
  return trimesh.boolean.difference(
244
- [mesh_copy, cube_mesh], check_volume=False, engine="blender"
244
+ [mesh_copy, cube_mesh],
245
+ check_volume=False,
246
+ engine="blender",
245
247
  )
246
248
 
247
249
  @staticmethod
@@ -6,11 +6,13 @@ import os
6
6
 
7
7
  import cv2
8
8
 
9
+ from maps4fs.generator.component.base.component_image import ImageComponent
9
10
  from maps4fs.generator.component.base.component_xml import XMLComponent
11
+ from maps4fs.generator.settings import Parameters
10
12
 
11
13
 
12
14
  # pylint: disable=R0903
13
- class Config(XMLComponent):
15
+ class Config(XMLComponent, ImageComponent):
14
16
  """Component for map settings and configuration.
15
17
 
16
18
  Arguments:
@@ -36,6 +38,8 @@ class Config(XMLComponent):
36
38
  if self.game.fog_processing:
37
39
  self._adjust_fog()
38
40
 
41
+ self._set_overview()
42
+
39
43
  def _set_map_size(self) -> None:
40
44
  """Edits map.xml file to set correct map size."""
41
45
  tree = self.get_tree()
@@ -213,3 +217,62 @@ class Config(XMLComponent):
213
217
  )
214
218
 
215
219
  return dem_maximum_meter, dem_minimum_meter
220
+
221
+ def _set_overview(self) -> None:
222
+ """Generates and sets the overview image for the map."""
223
+ try:
224
+ overview_image_path = self.game.overview_file_path(self.map_directory)
225
+ except NotImplementedError:
226
+ self.logger.warning(
227
+ "Game does not support overview image file, overview generation will be skipped."
228
+ )
229
+ return
230
+
231
+ satellite_component = self.map.get_satellite_component()
232
+ if not satellite_component:
233
+ self.logger.warning(
234
+ "Satellite component not found, overview generation will be skipped."
235
+ )
236
+ return
237
+
238
+ if not satellite_component.assets.overview or not os.path.isfile(
239
+ satellite_component.assets.overview
240
+ ):
241
+ self.logger.warning(
242
+ "Satellite overview image not found, overview generation will be skipped."
243
+ )
244
+ return
245
+
246
+ satellite_images_directory = os.path.dirname(satellite_component.assets.overview)
247
+ overview_image = cv2.imread(satellite_component.assets.overview, cv2.IMREAD_UNCHANGED)
248
+
249
+ if overview_image is None:
250
+ self.logger.warning(
251
+ "Failed to read satellite overview image, overview generation will be skipped."
252
+ )
253
+ return
254
+
255
+ resized_overview_image = cv2.resize(
256
+ overview_image,
257
+ (Parameters.OVERVIEW_IMAGE_SIZE, Parameters.OVERVIEW_IMAGE_SIZE),
258
+ interpolation=cv2.INTER_LINEAR,
259
+ )
260
+
261
+ resized_overview_path = os.path.join(
262
+ satellite_images_directory,
263
+ f"{Parameters.OVERVIEW_IMAGE_FILENAME}.png",
264
+ )
265
+
266
+ cv2.imwrite(resized_overview_path, resized_overview_image)
267
+ self.logger.info("Overview image saved to: %s", resized_overview_path)
268
+
269
+ if os.path.isfile(overview_image_path):
270
+ try:
271
+ os.remove(overview_image_path)
272
+ self.logger.debug("Old overview image removed: %s", overview_image_path)
273
+ except Exception as e:
274
+ self.logger.warning("Failed to remove old overview image: %s", e)
275
+ return
276
+
277
+ self.convert_png_to_dds(resized_overview_path, overview_image_path)
278
+ self.logger.info("Overview image converted and saved to: %s", overview_image_path)
@@ -254,6 +254,16 @@ class Game:
254
254
  str: The path to the i3d file."""
255
255
  raise NotImplementedError
256
256
 
257
+ def overview_file_path(self, map_directory: str) -> str:
258
+ """Returns the path to the overview image file.
259
+
260
+ Arguments:
261
+ map_directory (str): The path to the map directory.
262
+
263
+ Returns:
264
+ str: The path to the overview image file."""
265
+ raise NotImplementedError
266
+
257
267
  @property
258
268
  def i3d_processing(self) -> bool:
259
269
  """Returns whether the i3d file should be processed.
@@ -437,3 +447,13 @@ class FS25(Game):
437
447
  Returns:
438
448
  str: The path to the environment xml file."""
439
449
  return os.path.join(map_directory, "map", "config", "environment.xml")
450
+
451
+ def overview_file_path(self, map_directory: str) -> str:
452
+ """Returns the path to the overview image file.
453
+
454
+ Arguments:
455
+ map_directory (str): The path to the map directory.
456
+
457
+ Returns:
458
+ str: The path to the overview image file."""
459
+ return os.path.join(map_directory, "map", "overview.dds")
@@ -55,6 +55,9 @@ class Parameters:
55
55
 
56
56
  HEIGHT_SCALE = "heightScale"
57
57
 
58
+ OVERVIEW_IMAGE_SIZE = 4096
59
+ OVERVIEW_IMAGE_FILENAME = "overview"
60
+
58
61
 
59
62
  class SharedSettings(BaseModel):
60
63
  """Represents the shared settings for all components."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maps4fs
3
- Version: 2.8.3
3
+ Version: 2.8.4
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.8.3"
7
+ version = "2.8.4"
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