maps4fs 1.4.7__tar.gz → 1.4.9__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 (27) hide show
  1. {maps4fs-1.4.7 → maps4fs-1.4.9}/PKG-INFO +7 -1
  2. {maps4fs-1.4.7 → maps4fs-1.4.9}/README.md +6 -0
  3. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs/generator/grle.py +5 -0
  4. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs/generator/map.py +3 -0
  5. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs/generator/texture.py +13 -2
  6. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs.egg-info/PKG-INFO +7 -1
  7. {maps4fs-1.4.7 → maps4fs-1.4.9}/pyproject.toml +1 -1
  8. {maps4fs-1.4.7 → maps4fs-1.4.9}/LICENSE.md +0 -0
  9. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs/__init__.py +0 -0
  10. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs/generator/__init__.py +0 -0
  11. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs/generator/background.py +0 -0
  12. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs/generator/component.py +0 -0
  13. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs/generator/config.py +0 -0
  14. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs/generator/dem.py +0 -0
  15. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs/generator/game.py +0 -0
  16. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs/generator/i3d.py +0 -0
  17. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs/generator/qgis.py +0 -0
  18. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs/logger.py +0 -0
  19. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs/toolbox/__init__.py +0 -0
  20. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs/toolbox/background.py +0 -0
  21. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs/toolbox/dem.py +0 -0
  22. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs.egg-info/SOURCES.txt +0 -0
  23. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs.egg-info/dependency_links.txt +0 -0
  24. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs.egg-info/requires.txt +0 -0
  25. {maps4fs-1.4.7 → maps4fs-1.4.9}/maps4fs.egg-info/top_level.txt +0 -0
  26. {maps4fs-1.4.7 → maps4fs-1.4.9}/setup.cfg +0 -0
  27. {maps4fs-1.4.7 → maps4fs-1.4.9}/tests/test_generator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maps4fs
3
- Version: 1.4.7
3
+ Version: 1.4.9
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
@@ -418,6 +418,10 @@ Let's have a closer look at the fields:
418
418
  - `priority` - the priority of the texture for overlapping. Textures with higher priorities will be drawn over the textures with lower priorities.
419
419
  ℹ️ The texture with 0 priority considers the base layer, which means that all empty areas will be filled with this texture.
420
420
  - `exclude_weight` - this is only used for the forestRockRoots texture from FS25. It just means that this texture has no `weight` postfix, that's all.
421
+ - `usage` - the usage of the texture. Mainly used to group different textures by the purpose. For example, the `grass`, `forest`, `drain`.
422
+ - `background` - set it to True for the textures, which should have impact on the Background Terrain, by default it's used to subtract the water depth from the DEM and background terrain.
423
+ - `info_layer` - if the layer is saving some data in JSON format, this section will describe it's name in the JSON file. Used to find the needed JSON data, for example for fields it will be `fields` and as a value - list of polygon coordinates.
424
+ - `invisible` - set it to True for the textures, which should not be drawn in the files, but only to save the data in the JSON file (related to the previous field).
421
425
 
422
426
  ## Background terrain
423
427
  The tool now supports the generation of the background terrain. If you don't know what it is, here's a brief explanation. The background terrain is the world around the map. It's important to create it because if you don't, the map will look like it's floating in the void. The background terrain is a simple plane that can (and should) be textured to look fine.<br>
@@ -494,6 +498,8 @@ You can also apply some advanced settings to the map generation process. Note th
494
498
 
495
499
  - Farmlands margin - this value (in meters) will be applied to each farmland, making it bigger. You can use the value to adjust how much the farmland should be bigger than the actual field. By default, it's set to 3.
496
500
 
501
+ - Add Farmyards - if enabled, the tool will create farmlands from the regions that are marked as farmyards in the OSM data. Those farmlands will not have fields and also will not be drawn on textures. By default, it's turned off.
502
+
497
503
  ### Vegetation Advanced settings
498
504
 
499
505
  - Forest density - the density of the forest in meters. The lower the value, the lower the distance between the trees, which makes the forest denser. Note, that low values will lead to enormous number of trees, which may cause the Giants Editor to crash or lead to performance issues. By default, it's set to 10.
@@ -392,6 +392,10 @@ Let's have a closer look at the fields:
392
392
  - `priority` - the priority of the texture for overlapping. Textures with higher priorities will be drawn over the textures with lower priorities.
393
393
  ℹ️ The texture with 0 priority considers the base layer, which means that all empty areas will be filled with this texture.
394
394
  - `exclude_weight` - this is only used for the forestRockRoots texture from FS25. It just means that this texture has no `weight` postfix, that's all.
395
+ - `usage` - the usage of the texture. Mainly used to group different textures by the purpose. For example, the `grass`, `forest`, `drain`.
396
+ - `background` - set it to True for the textures, which should have impact on the Background Terrain, by default it's used to subtract the water depth from the DEM and background terrain.
397
+ - `info_layer` - if the layer is saving some data in JSON format, this section will describe it's name in the JSON file. Used to find the needed JSON data, for example for fields it will be `fields` and as a value - list of polygon coordinates.
398
+ - `invisible` - set it to True for the textures, which should not be drawn in the files, but only to save the data in the JSON file (related to the previous field).
395
399
 
396
400
  ## Background terrain
397
401
  The tool now supports the generation of the background terrain. If you don't know what it is, here's a brief explanation. The background terrain is the world around the map. It's important to create it because if you don't, the map will look like it's floating in the void. The background terrain is a simple plane that can (and should) be textured to look fine.<br>
@@ -468,6 +472,8 @@ You can also apply some advanced settings to the map generation process. Note th
468
472
 
469
473
  - Farmlands margin - this value (in meters) will be applied to each farmland, making it bigger. You can use the value to adjust how much the farmland should be bigger than the actual field. By default, it's set to 3.
470
474
 
475
+ - Add Farmyards - if enabled, the tool will create farmlands from the regions that are marked as farmyards in the OSM data. Those farmlands will not have fields and also will not be drawn on textures. By default, it's turned off.
476
+
471
477
  ### Vegetation Advanced settings
472
478
 
473
479
  - Forest density - the density of the forest in meters. The lower the value, the lower the distance between the trees, which makes the forest denser. Note, that low values will lead to enormous number of trees, which may cause the Giants Editor to crash or lead to performance issues. By default, it's set to 10.
@@ -116,6 +116,11 @@ class GRLE(Component):
116
116
 
117
117
  self.logger.info("Found %s fields in textures info layer.", len(fields))
118
118
 
119
+ farmyards: list[list[tuple[int, int]]] | None = textures_info_layer.get("farmyards")
120
+ if farmyards and self.map.grle_settings.add_farmyards:
121
+ fields.extend(farmyards)
122
+ self.logger.info("Found %s farmyards in textures info layer.", len(farmyards))
123
+
119
124
  info_layer_farmlands_path = os.path.join(
120
125
  self.game.weights_dir_path(self.map_directory), "infoLayer_farmlands.png"
121
126
  )
@@ -89,10 +89,13 @@ class GRLESettings(SettingsModel):
89
89
  Attributes:
90
90
  farmland_margin (int): margin around the farmland.
91
91
  random_plants (bool): generate random plants on the map or use the default one.
92
+ add_farmyards (bool): If True, regions of frarmyards will be added to the map
93
+ without corresponding fields.
92
94
  """
93
95
 
94
96
  farmland_margin: int = 0
95
97
  random_plants: bool = True
98
+ add_farmyards: bool = False
96
99
 
97
100
 
98
101
  class I3DSettings(SettingsModel):
@@ -45,6 +45,9 @@ class Texture(Component):
45
45
  exclude_weight (bool): Flag to exclude weight from the texture.
46
46
  priority (int | None): Priority of the layer.
47
47
  info_layer (str | None): Name of the corresnponding info layer.
48
+ usage (str | None): Usage of the layer.
49
+ background (bool): Flag to determine if the layer is a background.
50
+ invisible (bool): Flag to determine if the layer is invisible.
48
51
 
49
52
  Attributes:
50
53
  name (str): Name of the layer.
@@ -65,6 +68,7 @@ class Texture(Component):
65
68
  info_layer: str | None = None,
66
69
  usage: str | None = None,
67
70
  background: bool = False,
71
+ invisible: bool = False,
68
72
  ):
69
73
  self.name = name
70
74
  self.count = count
@@ -76,6 +80,7 @@ class Texture(Component):
76
80
  self.info_layer = info_layer
77
81
  self.usage = usage
78
82
  self.background = background
83
+ self.invisible = invisible
79
84
 
80
85
  def to_json(self) -> dict[str, str | list[str] | bool]: # type: ignore
81
86
  """Returns dictionary with layer data.
@@ -93,6 +98,7 @@ class Texture(Component):
93
98
  "info_layer": self.info_layer,
94
99
  "usage": self.usage,
95
100
  "background": self.background,
101
+ "invisible": self.invisible,
96
102
  }
97
103
 
98
104
  data = {k: v for k, v in data.items() if v is not None}
@@ -417,7 +423,8 @@ class Texture(Component):
417
423
  info_layer_data[layer.info_layer].append(
418
424
  self.np_to_polygon_points(polygon) # type: ignore
419
425
  )
420
- cv2.fillPoly(layer_image, [polygon], color=255) # type: ignore
426
+ if not layer.invisible:
427
+ cv2.fillPoly(layer_image, [polygon], color=255) # type: ignore
421
428
 
422
429
  if layer.info_layer == "roads":
423
430
  for linestring in self.objects_generator(
@@ -706,7 +713,11 @@ class Texture(Component):
706
713
  Generator[np.ndarray, None, None]: Numpy array of polygon points.
707
714
  """
708
715
  for _, obj in objects_utm.iterrows():
709
- polygon = self._to_polygon(obj, width)
716
+ try:
717
+ polygon = self._to_polygon(obj, width)
718
+ except Exception as e: # pylint: disable=W0703
719
+ self.logger.warning("Error converting object to polygon: %s.", e)
720
+ continue
710
721
  if polygon is None:
711
722
  continue
712
723
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maps4fs
3
- Version: 1.4.7
3
+ Version: 1.4.9
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
@@ -418,6 +418,10 @@ Let's have a closer look at the fields:
418
418
  - `priority` - the priority of the texture for overlapping. Textures with higher priorities will be drawn over the textures with lower priorities.
419
419
  ℹ️ The texture with 0 priority considers the base layer, which means that all empty areas will be filled with this texture.
420
420
  - `exclude_weight` - this is only used for the forestRockRoots texture from FS25. It just means that this texture has no `weight` postfix, that's all.
421
+ - `usage` - the usage of the texture. Mainly used to group different textures by the purpose. For example, the `grass`, `forest`, `drain`.
422
+ - `background` - set it to True for the textures, which should have impact on the Background Terrain, by default it's used to subtract the water depth from the DEM and background terrain.
423
+ - `info_layer` - if the layer is saving some data in JSON format, this section will describe it's name in the JSON file. Used to find the needed JSON data, for example for fields it will be `fields` and as a value - list of polygon coordinates.
424
+ - `invisible` - set it to True for the textures, which should not be drawn in the files, but only to save the data in the JSON file (related to the previous field).
421
425
 
422
426
  ## Background terrain
423
427
  The tool now supports the generation of the background terrain. If you don't know what it is, here's a brief explanation. The background terrain is the world around the map. It's important to create it because if you don't, the map will look like it's floating in the void. The background terrain is a simple plane that can (and should) be textured to look fine.<br>
@@ -494,6 +498,8 @@ You can also apply some advanced settings to the map generation process. Note th
494
498
 
495
499
  - Farmlands margin - this value (in meters) will be applied to each farmland, making it bigger. You can use the value to adjust how much the farmland should be bigger than the actual field. By default, it's set to 3.
496
500
 
501
+ - Add Farmyards - if enabled, the tool will create farmlands from the regions that are marked as farmyards in the OSM data. Those farmlands will not have fields and also will not be drawn on textures. By default, it's turned off.
502
+
497
503
  ### Vegetation Advanced settings
498
504
 
499
505
  - Forest density - the density of the forest in meters. The lower the value, the lower the distance between the trees, which makes the forest denser. Note, that low values will lead to enormous number of trees, which may cause the Giants Editor to crash or lead to performance issues. By default, it's set to 10.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "maps4fs"
7
- version = "1.4.7"
7
+ version = "1.4.9"
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
File without changes