maps4fs 1.4.7__py3-none-any.whl → 1.4.9__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/grle.py CHANGED
@@ -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
  )
maps4fs/generator/map.py CHANGED
@@ -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.
@@ -6,16 +6,16 @@ maps4fs/generator/component.py,sha256=58UQgdR-7KlWHTfwLesNNK76BTRsiVngRa6B64OKjh
6
6
  maps4fs/generator/config.py,sha256=0QmK052B8bxyHVhg3jzCORLfOBMMmqVfhhbqXKf6OMk,4383
7
7
  maps4fs/generator/dem.py,sha256=MZf3ZjawJ977TxqB1q9nNpvPZUNwfmm2EaJDtVU-eCU,15939
8
8
  maps4fs/generator/game.py,sha256=jjo7CTwHHSkRpeD_QgRXkhR_NxI09C4kMxz-nYOTM4A,7931
9
- maps4fs/generator/grle.py,sha256=onhZovvRtireDfw7wEOL0CZmOmoVzRPY-R4TlvbOUMI,17561
9
+ maps4fs/generator/grle.py,sha256=u8ZwSs313PIOkH_0B_O2tVTaZ-eYNkc30eKGtBxWzTM,17846
10
10
  maps4fs/generator/i3d.py,sha256=qeZYqfuhbhRPlSAuQHXaq6RmIO7314oMN68Ivebp1YQ,24786
11
- maps4fs/generator/map.py,sha256=13RazKCPqKk5BDDdjQacoebP2H9orv12Jm_IA_JUmec,11721
11
+ maps4fs/generator/map.py,sha256=H7UUd-kFSGy90InX-1Ek4If-WdAnbVGSVZaJQDQAjiY,11881
12
12
  maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
13
- maps4fs/generator/texture.py,sha256=geS99ddVG3t-5nX9LPQQ1lJ77Lt2uVV-xQZAP-8KL84,30672
13
+ maps4fs/generator/texture.py,sha256=sErusfv1AqQfP-veMrZ921Tz8DnGEhfB4ucggMmKrD4,31231
14
14
  maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
15
15
  maps4fs/toolbox/background.py,sha256=9BXWNqs_n3HgqDiPztWylgYk_QM4YgBpe6_ZNQAWtSc,2154
16
16
  maps4fs/toolbox/dem.py,sha256=z9IPFNmYbjiigb3t02ZenI3Mo8odd19c5MZbjDEovTo,3525
17
- maps4fs-1.4.7.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
18
- maps4fs-1.4.7.dist-info/METADATA,sha256=T3U8-UtvdUZGRzUR6MWLTvDd5U_oNNsIEmq6c4kxFFs,32421
19
- maps4fs-1.4.7.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
20
- maps4fs-1.4.7.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
21
- maps4fs-1.4.7.dist-info/RECORD,,
17
+ maps4fs-1.4.9.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
18
+ maps4fs-1.4.9.dist-info/METADATA,sha256=LTErgrBHf3M_GSQwOp5EqjglUS6eOOKNA7LlfHllw9U,33389
19
+ maps4fs-1.4.9.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
20
+ maps4fs-1.4.9.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
21
+ maps4fs-1.4.9.dist-info/RECORD,,