maps4fs 1.3.2__py3-none-any.whl → 1.3.5__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.
@@ -123,8 +123,6 @@ class Background(Component):
123
123
  self.generate_obj_files()
124
124
  if self.map.background_settings.generate_water:
125
125
  self.generate_water_resources_obj()
126
- else:
127
- self.logger.info("Light version is enabled, obj files will not be generated.")
128
126
 
129
127
  def make_copy(self, dem_path: str, dem_name: str) -> None:
130
128
  """Copies DEM data to additional DEM file.
@@ -138,7 +136,7 @@ class Background(Component):
138
136
  additional_dem_path = os.path.join(dem_directory, dem_name)
139
137
 
140
138
  shutil.copyfile(dem_path, additional_dem_path)
141
- self.logger.info("Additional DEM data was copied to %s.", additional_dem_path)
139
+ self.logger.debug("Additional DEM data was copied to %s.", additional_dem_path)
142
140
 
143
141
  def info_sequence(self) -> dict[str, str | float | int]:
144
142
  """Returns a dictionary with information about the background terrain.
@@ -340,7 +338,7 @@ class Background(Component):
340
338
  preview_path = os.path.join(self.previews_directory, "background_dem.stl")
341
339
  mesh.export(preview_path)
342
340
 
343
- self.logger.info("STL file saved: %s", preview_path)
341
+ self.logger.debug("STL file saved: %s", preview_path)
344
342
 
345
343
  self.stl_preview_path = preview_path # pylint: disable=attribute-defined-outside-init
346
344
 
@@ -501,7 +499,7 @@ class Background(Component):
501
499
 
502
500
  background_save_path = os.path.join(self.water_directory, "water_resources.png")
503
501
  cv2.imwrite(background_save_path, background_image)
504
- self.logger.info("Background texture saved: %s", background_save_path)
502
+ self.logger.debug("Background texture saved: %s", background_save_path)
505
503
  self.water_resources_path = background_save_path # pylint: disable=W0201
506
504
 
507
505
  def subtraction(self) -> None:
@@ -38,7 +38,7 @@ class Config(Component):
38
38
  self.logger.warning("Map XML file not found: %s.", self._map_xml_path)
39
39
  return
40
40
  tree = ET.parse(self._map_xml_path)
41
- self.logger.info("Map XML file loaded from: %s.", self._map_xml_path)
41
+ self.logger.debug("Map XML file loaded from: %s.", self._map_xml_path)
42
42
  root = tree.getroot()
43
43
  for map_elem in root.iter("map"):
44
44
  map_elem.set("width", str(self.map_size))
maps4fs/generator/dem.py CHANGED
@@ -255,7 +255,7 @@ class DEM(Component):
255
255
  )
256
256
 
257
257
  cv2.imwrite(self._dem_path, resampled_data)
258
- self.logger.info("DEM data was saved to %s.", self._dem_path)
258
+ self.logger.debug("DEM data was saved to %s.", self._dem_path)
259
259
 
260
260
  if self.rotation:
261
261
  self.rotate_dem()
@@ -401,7 +401,7 @@ class DEM(Component):
401
401
 
402
402
  scaling_factor = self._get_scaling_factor(max_dev)
403
403
  adjusted_max_height = int(65535 * scaling_factor)
404
- self.logger.info(
404
+ self.logger.debug(
405
405
  "Maximum deviation: %s. Scaling factor: %s. Adjusted max height: %s.",
406
406
  max_dev,
407
407
  scaling_factor,
maps4fs/generator/grle.py CHANGED
@@ -43,7 +43,7 @@ class GRLE(Component):
43
43
  try:
44
44
  grle_schema_path = self.game.grle_schema
45
45
  except ValueError:
46
- self.logger.info("GRLE schema processing is not implemented for this game.")
46
+ self.logger.warning("GRLE schema processing is not implemented for this game.")
47
47
  return
48
48
 
49
49
  try:
@@ -57,7 +57,7 @@ class GRLE(Component):
57
57
  def process(self) -> None:
58
58
  """Generates InfoLayer PNG files based on the GRLE schema."""
59
59
  if not self._grle_schema:
60
- self.logger.info("GRLE schema is not obtained, skipping the processing.")
60
+ self.logger.debug("GRLE schema is not obtained, skipping the processing.")
61
61
  return
62
62
 
63
63
  for info_layer in self._grle_schema:
@@ -84,7 +84,7 @@ class GRLE(Component):
84
84
 
85
85
  self._add_farmlands()
86
86
  if self.game.code == "FS25":
87
- self.logger.info("Game is %s, plants will be added.", self.game.code)
87
+ self.logger.debug("Game is %s, plants will be added.", self.game.code)
88
88
  self._add_plants()
89
89
  else:
90
90
  self.logger.warning("Adding plants it's not supported for the %s.", self.game.code)
@@ -120,7 +120,7 @@ class GRLE(Component):
120
120
  self.game.weights_dir_path(self.map_directory), "infoLayer_farmlands.png"
121
121
  )
122
122
 
123
- self.logger.info(
123
+ self.logger.debug(
124
124
  "Adding farmlands to the InfoLayer PNG file: %s.", info_layer_farmlands_path
125
125
  )
126
126
 
@@ -190,10 +190,10 @@ class GRLE(Component):
190
190
 
191
191
  tree.write(farmlands_xml_path)
192
192
 
193
- self.logger.info("Farmlands added to the farmlands XML file: %s.", farmlands_xml_path)
193
+ self.logger.debug("Farmlands added to the farmlands XML file: %s.", farmlands_xml_path)
194
194
 
195
195
  cv2.imwrite(info_layer_farmlands_path, image) # pylint: disable=no-member
196
- self.logger.info(
196
+ self.logger.debug(
197
197
  "Farmlands added to the InfoLayer PNG file: %s.", info_layer_farmlands_path
198
198
  )
199
199
 
@@ -354,7 +354,7 @@ class GRLE(Component):
354
354
 
355
355
  # Add islands of plants to the base image.
356
356
  island_count = self.map_size
357
- self.logger.info("Adding %s islands of plants to the base image.", island_count)
357
+ self.logger.debug("Adding %s islands of plants to the base image.", island_count)
358
358
  if self.map.grle_settings.random_plants:
359
359
  grass_image_copy = create_island_of_plants(grass_image_copy, island_count)
360
360
  self.logger.debug("Islands of plants added to the base image.")
@@ -391,4 +391,4 @@ class GRLE(Component):
391
391
  # Ensure that order of channels is correct because CV2 uses BGR and we need RGB.
392
392
  density_map_fruits = cv2.cvtColor(density_map_fruits, cv2.COLOR_BGR2RGB)
393
393
  cv2.imwrite(density_map_fruit_path, density_map_fruits)
394
- self.logger.info("Updated density map for fruits saved in %s.", density_map_fruit_path)
394
+ self.logger.debug("Updated density map for fruits saved in %s.", density_map_fruit_path)
maps4fs/generator/i3d.py CHANGED
@@ -47,7 +47,7 @@ class I3d(Component):
47
47
  self._map_i3d_path = self.game.i3d_file_path(self.map_directory)
48
48
  self.logger.debug("Map I3D path: %s.", self._map_i3d_path)
49
49
  except NotImplementedError:
50
- self.logger.info("I3D file processing is not implemented for this game.")
50
+ self.logger.warning("I3D file processing is not implemented for this game.")
51
51
  self._map_i3d_path = None
52
52
 
53
53
  def process(self) -> None:
@@ -59,7 +59,7 @@ class I3d(Component):
59
59
  def _get_tree(self) -> ET.ElementTree | None:
60
60
  """Returns the ElementTree instance of the map I3D file."""
61
61
  if not self._map_i3d_path:
62
- self.logger.info("I3D is not obtained, skipping the update.")
62
+ self.logger.debug("I3D is not obtained, skipping the update.")
63
63
  return None
64
64
  if not os.path.isfile(self._map_i3d_path):
65
65
  self.logger.warning("I3D file not found: %s.", self._map_i3d_path)
@@ -117,7 +117,7 @@ class I3d(Component):
117
117
  )
118
118
 
119
119
  tree.write(self._map_i3d_path) # type: ignore
120
- self.logger.info("Map I3D file saved to: %s.", self._map_i3d_path)
120
+ self.logger.debug("Map I3D file saved to: %s.", self._map_i3d_path)
121
121
 
122
122
  def previews(self) -> list[str]:
123
123
  """Returns a list of paths to the preview images (empty list).
@@ -234,7 +234,7 @@ class I3d(Component):
234
234
  field_id += 1
235
235
 
236
236
  tree.write(self._map_i3d_path) # type: ignore
237
- self.logger.info("Map I3D file saved to: %s.", self._map_i3d_path)
237
+ self.logger.debug("Map I3D file saved to: %s.", self._map_i3d_path)
238
238
 
239
239
  def get_name_indicator_node(self, node_id: int, field_id: int) -> tuple[ET.Element, int]:
240
240
  """Creates a name indicator node with given node ID and field ID.
@@ -417,7 +417,7 @@ class I3d(Component):
417
417
  self.logger.info("Added %s trees to the I3D file.", tree_count)
418
418
 
419
419
  tree.write(self._map_i3d_path) # type: ignore
420
- self.logger.info("Map I3D file saved to: %s.", self._map_i3d_path)
420
+ self.logger.debug("Map I3D file saved to: %s.", self._map_i3d_path)
421
421
 
422
422
  @staticmethod
423
423
  def randomize_coordinates(coordinates: tuple[int, int], density: int) -> tuple[float, float]:
maps4fs/generator/map.py CHANGED
@@ -71,10 +71,12 @@ class TextureSettings(NamedTuple):
71
71
  Attributes:
72
72
  dissolve (bool): dissolve the texture into several images.
73
73
  fields_padding (int): padding around the fields.
74
+ skip_drains (bool): skip drains generation.
74
75
  """
75
76
 
76
77
  dissolve: bool = True
77
78
  fields_padding: int = 0
79
+ skip_drains: bool = False
78
80
 
79
81
 
80
82
  # pylint: disable=R0913, R0902
@@ -149,6 +151,14 @@ class Map:
149
151
  Yields:
150
152
  Generator[str, None, None]: Component names.
151
153
  """
154
+ self.logger.info(
155
+ "Starting map generation. Game code: %s. Coordinates: %s, size: %s. Rotation: %s.",
156
+ self.game.code,
157
+ self.coordinates,
158
+ self.size,
159
+ self.rotation,
160
+ )
161
+
152
162
  for game_component in self.game.components:
153
163
  component = game_component(
154
164
  self.game,
@@ -184,6 +194,14 @@ class Map:
184
194
  )
185
195
  raise e
186
196
 
197
+ self.logger.info(
198
+ "Map generation completed. Game code: %s. Coordinates: %s, size: %s. Rotation: %s.",
199
+ self.game.code,
200
+ self.coordinates,
201
+ self.size,
202
+ self.rotation,
203
+ )
204
+
187
205
  def get_component(self, component_name: str) -> Component | None:
188
206
  """Get component by name.
189
207
 
@@ -231,7 +249,7 @@ class Map:
231
249
  if remove_source:
232
250
  try:
233
251
  shutil.rmtree(self.map_directory)
234
- self.logger.info("Map directory removed: %s", self.map_directory)
252
+ self.logger.debug("Map directory removed: %s", self.map_directory)
235
253
  except Exception as e: # pylint: disable=W0718
236
- self.logger.error("Error removing map directory %s: %s", self.map_directory, e)
254
+ self.logger.debug("Error removing map directory %s: %s", self.map_directory, e)
237
255
  return archive_path
@@ -202,7 +202,7 @@ class Texture(Component):
202
202
 
203
203
  base_layer = self.get_base_layer()
204
204
  if base_layer:
205
- self.logger.info("Base layer found: %s.", base_layer.name)
205
+ self.logger.debug("Base layer found: %s.", base_layer.name)
206
206
  else:
207
207
  self.logger.warning("No base layer found.")
208
208
 
@@ -313,7 +313,7 @@ class Texture(Component):
313
313
 
314
314
  for layer in self.layers:
315
315
  self._generate_weights(layer)
316
- self.logger.info("Prepared weights for %s layers.", len(self.layers))
316
+ self.logger.debug("Prepared weights for %s layers.", len(self.layers))
317
317
 
318
318
  def _generate_weights(self, layer: Layer) -> None:
319
319
  """Generates weight files for textures. Each file is a numpy array of zeros and
@@ -388,6 +388,9 @@ class Texture(Component):
388
388
  info_layer_data = defaultdict(list)
389
389
 
390
390
  for layer in layers:
391
+ if self.map.texture_settings.skip_drains and layer.usage == "drain":
392
+ self.logger.debug("Skipping layer %s because of the usage.", layer.name)
393
+ continue
391
394
  if not layer.tags:
392
395
  self.logger.debug("Layer %s has no tags, there's nothing to draw.", layer.name)
393
396
  continue
@@ -416,7 +419,7 @@ class Texture(Component):
416
419
  cumulative_image = cv2.bitwise_or(cumulative_image, output_image)
417
420
 
418
421
  cv2.imwrite(layer_path, output_image)
419
- self.logger.info("Texture %s saved.", layer_path)
422
+ self.logger.debug("Texture %s saved.", layer_path)
420
423
 
421
424
  # Save info layer data.
422
425
  with open(self.info_layer_path, "w", encoding="utf-8") as f:
@@ -481,8 +484,6 @@ class Texture(Component):
481
484
 
482
485
  self.logger.info("Dissolved layer %s.", layer.name)
483
486
 
484
- self.logger.info("Dissolving finished.")
485
-
486
487
  def draw_base_layer(self, cumulative_image: np.ndarray) -> None:
487
488
  """Draws base layer and saves it into the png file.
488
489
  Base layer is the last layer to be drawn, it fills the remaining area of the map.
@@ -496,7 +497,7 @@ class Texture(Component):
496
497
  self.logger.debug("Drawing base layer %s.", layer_path)
497
498
  img = cv2.bitwise_not(cumulative_image)
498
499
  cv2.imwrite(layer_path, img)
499
- self.logger.info("Base texture %s saved.", layer_path)
500
+ self.logger.debug("Base texture %s saved.", layer_path)
500
501
 
501
502
  def get_relative_x(self, x: float) -> int:
502
503
  """Converts UTM X coordinate to relative X coordinate in map image.
@@ -635,9 +636,8 @@ class Texture(Component):
635
636
  is_fieds = info_layer == "fields"
636
637
  try:
637
638
  objects = ox.features_from_bbox(bbox=self.new_bbox, tags=tags)
638
- except Exception as e: # pylint: disable=W0718
639
- self.logger.warning("Error fetching objects for tags: %s.", tags)
640
- self.logger.warning(e)
639
+ except Exception: # pylint: disable=W0718
640
+ self.logger.debug("Error fetching objects for tags: %s.", tags)
641
641
  return
642
642
  objects_utm = ox.projection.project_gdf(objects, to_latlong=False)
643
643
  self.logger.debug("Fetched %s elements for tags: %s.", len(objects_utm), tags)
@@ -712,5 +712,5 @@ class Texture(Component):
712
712
  preview_path = os.path.join(self.previews_directory, "textures_osm.png")
713
713
 
714
714
  cv2.imwrite(preview_path, merged) # type: ignore
715
- self.logger.info("Preview saved to %s.", preview_path)
715
+ self.logger.debug("Preview saved to %s.", preview_path)
716
716
  return preview_path
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maps4fs
3
- Version: 1.3.2
3
+ Version: 1.3.5
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
@@ -483,6 +483,8 @@ You can also apply some advanced settings to the map generation process. Note th
483
483
 
484
484
  - Texture dissolving - if enabled, the values from one layer will be splitted between different layers of texture, making it look more natural. By default, it's set to True. Can be turned of for faster processing.
485
485
 
486
+ - Skip drains - if enabled, the tool will not generate the drains and ditches on the map. By default, it's set to False. Use this if you don't need the drains on the map.
487
+
486
488
  ### Farmlands Advanced settings
487
489
 
488
490
  - 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.
@@ -0,0 +1,21 @@
1
+ maps4fs/__init__.py,sha256=MlM_vkLH_22xoBwhoRD52JDECCmeAJ8gBQr7RMQZmis,261
2
+ maps4fs/logger.py,sha256=B-NEYpMjPAAqlV4VpfTi6nbBFnEABVtQOaYe6nMpidg,1489
3
+ maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
4
+ maps4fs/generator/background.py,sha256=rywtqApQ0ijIaID59ThoXsWBsQfQBa-ch6Xw6zTuBCw,22298
5
+ maps4fs/generator/component.py,sha256=XN-3Zx0bujugpuRk3YB-pYNwUHREdyt_cLxPd7pr57g,17967
6
+ maps4fs/generator/config.py,sha256=0QmK052B8bxyHVhg3jzCORLfOBMMmqVfhhbqXKf6OMk,4383
7
+ maps4fs/generator/dem.py,sha256=MZf3ZjawJ977TxqB1q9nNpvPZUNwfmm2EaJDtVU-eCU,15939
8
+ maps4fs/generator/game.py,sha256=ZQeYzPzPB3CG41avdhNCyTZpHEeedqNBuAbNevTZuXg,7931
9
+ maps4fs/generator/grle.py,sha256=xKIpyhYsZol-IXcBULbX7wWZ1n83BWTZqaf8FLodchE,17499
10
+ maps4fs/generator/i3d.py,sha256=z8l_dxF8cd8OQT-mcI3lha_9o_lX-moxVFBOXg7aZt4,18232
11
+ maps4fs/generator/map.py,sha256=csmnuHRQqk5HEpcp1nGGy8P46Sg3lmVh2ko_sP7jPO0,8479
12
+ maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
13
+ maps4fs/generator/texture.py,sha256=STwc2a2deCJQblWZ8oHduwYNMAB3_mWlU9a1fQE6DO8,27737
14
+ maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
15
+ maps4fs/toolbox/background.py,sha256=9BXWNqs_n3HgqDiPztWylgYk_QM4YgBpe6_ZNQAWtSc,2154
16
+ maps4fs/toolbox/dem.py,sha256=z9IPFNmYbjiigb3t02ZenI3Mo8odd19c5MZbjDEovTo,3525
17
+ maps4fs-1.3.5.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
18
+ maps4fs-1.3.5.dist-info/METADATA,sha256=QL11TXZbGlyknecxBTtELqsZuCiUwDn2FXxQ1AUK7hQ,31082
19
+ maps4fs-1.3.5.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
20
+ maps4fs-1.3.5.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
21
+ maps4fs-1.3.5.dist-info/RECORD,,
@@ -1,21 +0,0 @@
1
- maps4fs/__init__.py,sha256=MlM_vkLH_22xoBwhoRD52JDECCmeAJ8gBQr7RMQZmis,261
2
- maps4fs/logger.py,sha256=B-NEYpMjPAAqlV4VpfTi6nbBFnEABVtQOaYe6nMpidg,1489
3
- maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
4
- maps4fs/generator/background.py,sha256=LDM8377BpBa9Iy1AMK0c0sbW8QTvhVM3yFlf-bu8APU,22400
5
- maps4fs/generator/component.py,sha256=XN-3Zx0bujugpuRk3YB-pYNwUHREdyt_cLxPd7pr57g,17967
6
- maps4fs/generator/config.py,sha256=b7qY0luC-_WM_c72Ohtlf4FrB37X5cALInbestSdUsw,4382
7
- maps4fs/generator/dem.py,sha256=DoQk6IPkS47eF21rh7JZoiUr1bAzuJkdF41ejAqykW4,15937
8
- maps4fs/generator/game.py,sha256=ZQeYzPzPB3CG41avdhNCyTZpHEeedqNBuAbNevTZuXg,7931
9
- maps4fs/generator/grle.py,sha256=zdYM-MHGfa3CHKgnOnd4EpCKF6HfY_sUfeJbo7-cic0,17489
10
- maps4fs/generator/i3d.py,sha256=fsKveRWQk68fpWRwMYqSL4RfHkD0dLUyNHi_iAyANso,18225
11
- maps4fs/generator/map.py,sha256=r0yEqQB56aqo0MxZMVLdP8w9xmQao0R3WTp6Sg-C4bY,7913
12
- maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
13
- maps4fs/generator/texture.py,sha256=57R0v4QuB-tnr_75hgGxfUTX5ennrULkhqiDNTgzi4s,27629
14
- maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
15
- maps4fs/toolbox/background.py,sha256=9BXWNqs_n3HgqDiPztWylgYk_QM4YgBpe6_ZNQAWtSc,2154
16
- maps4fs/toolbox/dem.py,sha256=z9IPFNmYbjiigb3t02ZenI3Mo8odd19c5MZbjDEovTo,3525
17
- maps4fs-1.3.2.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
18
- maps4fs-1.3.2.dist-info/METADATA,sha256=PysvMKUBYzqwHkBqoahH6uziBlrrNCySs8RKvv6XlhM,30910
19
- maps4fs-1.3.2.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
20
- maps4fs-1.3.2.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
21
- maps4fs-1.3.2.dist-info/RECORD,,