maps4fs 1.3.1__py3-none-any.whl → 1.3.4__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.
@@ -77,9 +77,11 @@ class Background(Component):
77
77
  self.map_directory,
78
78
  self.logger,
79
79
  )
80
- dem.auto_process = autoprocess
81
80
  dem.preprocess()
82
81
  dem.is_preview = self.is_preview(name) # type: ignore
82
+ if dem.is_preview: # type: ignore
83
+ dem.multiplier = 1
84
+ dem.auto_process = autoprocess
83
85
  dem.set_output_resolution((self.rotated_size, self.rotated_size))
84
86
  dem.set_dem_path(output_path)
85
87
  dems.append(dem)
@@ -121,8 +123,6 @@ class Background(Component):
121
123
  self.generate_obj_files()
122
124
  if self.map.background_settings.generate_water:
123
125
  self.generate_water_resources_obj()
124
- else:
125
- self.logger.info("Light version is enabled, obj files will not be generated.")
126
126
 
127
127
  def make_copy(self, dem_path: str, dem_name: str) -> None:
128
128
  """Copies DEM data to additional DEM file.
@@ -136,7 +136,7 @@ class Background(Component):
136
136
  additional_dem_path = os.path.join(dem_directory, dem_name)
137
137
 
138
138
  shutil.copyfile(dem_path, additional_dem_path)
139
- 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)
140
140
 
141
141
  def info_sequence(self) -> dict[str, str | float | int]:
142
142
  """Returns a dictionary with information about the background terrain.
@@ -338,7 +338,7 @@ class Background(Component):
338
338
  preview_path = os.path.join(self.previews_directory, "background_dem.stl")
339
339
  mesh.export(preview_path)
340
340
 
341
- self.logger.info("STL file saved: %s", preview_path)
341
+ self.logger.debug("STL file saved: %s", preview_path)
342
342
 
343
343
  self.stl_preview_path = preview_path # pylint: disable=attribute-defined-outside-init
344
344
 
@@ -499,7 +499,7 @@ class Background(Component):
499
499
 
500
500
  background_save_path = os.path.join(self.water_directory, "water_resources.png")
501
501
  cv2.imwrite(background_save_path, background_image)
502
- self.logger.info("Background texture saved: %s", background_save_path)
502
+ self.logger.debug("Background texture saved: %s", background_save_path)
503
503
  self.water_resources_path = background_save_path # pylint: disable=W0201
504
504
 
505
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
@@ -54,9 +54,10 @@ class DEM(Component):
54
54
  elif blur_radius % 2 == 0:
55
55
  blur_radius += 1
56
56
  self.blur_radius = blur_radius
57
+ self.multiplier = self.map.dem_settings.multiplier
57
58
  self.logger.debug(
58
59
  "DEM value multiplier is %s, blur radius is %s.",
59
- self.map.dem_settings.multiplier,
60
+ self.multiplier,
60
61
  self.blur_radius,
61
62
  )
62
63
 
@@ -188,11 +189,11 @@ class DEM(Component):
188
189
  resampled_data = self._normalize_dem(resampled_data)
189
190
  else:
190
191
  self.logger.debug("Auto processing is disabled, DEM data will not be normalized.")
191
- resampled_data = resampled_data * self.map.dem_settings.multiplier
192
+ resampled_data = resampled_data * self.multiplier
192
193
 
193
194
  self.logger.debug(
194
195
  "DEM data was multiplied by %s. Min: %s, max: %s. Data type: %s.",
195
- self.map.dem_settings.multiplier,
196
+ self.multiplier,
196
197
  resampled_data.min(),
197
198
  resampled_data.max(),
198
199
  resampled_data.dtype,
@@ -207,7 +208,7 @@ class DEM(Component):
207
208
  self.logger.debug(
208
209
  "DEM data was multiplied by %s and clipped to 16-bit unsigned integer range. "
209
210
  "Min: %s, max: %s.",
210
- self.map.dem_settings.multiplier,
211
+ self.multiplier,
211
212
  resampled_data.min(),
212
213
  resampled_data.max(),
213
214
  )
@@ -254,7 +255,7 @@ class DEM(Component):
254
255
  )
255
256
 
256
257
  cv2.imwrite(self._dem_path, resampled_data)
257
- 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)
258
259
 
259
260
  if self.rotation:
260
261
  self.rotate_dem()
@@ -400,7 +401,7 @@ class DEM(Component):
400
401
 
401
402
  scaling_factor = self._get_scaling_factor(max_dev)
402
403
  adjusted_max_height = int(65535 * scaling_factor)
403
- self.logger.info(
404
+ self.logger.debug(
404
405
  "Maximum deviation: %s. Scaling factor: %s. Adjusted max height: %s.",
405
406
  max_dev,
406
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
@@ -149,6 +149,14 @@ class Map:
149
149
  Yields:
150
150
  Generator[str, None, None]: Component names.
151
151
  """
152
+ self.logger.info(
153
+ "Starting map generation. Game code: %s. Coordinates: %s, size: %s. Rotation: %s.",
154
+ self.game.code,
155
+ self.coordinates,
156
+ self.size,
157
+ self.rotation,
158
+ )
159
+
152
160
  for game_component in self.game.components:
153
161
  component = game_component(
154
162
  self.game,
@@ -184,6 +192,14 @@ class Map:
184
192
  )
185
193
  raise e
186
194
 
195
+ self.logger.info(
196
+ "Map generation completed. Game code: %s. Coordinates: %s, size: %s. Rotation: %s.",
197
+ self.game.code,
198
+ self.coordinates,
199
+ self.size,
200
+ self.rotation,
201
+ )
202
+
187
203
  def get_component(self, component_name: str) -> Component | None:
188
204
  """Get component by name.
189
205
 
@@ -231,7 +247,7 @@ class Map:
231
247
  if remove_source:
232
248
  try:
233
249
  shutil.rmtree(self.map_directory)
234
- self.logger.info("Map directory removed: %s", self.map_directory)
250
+ self.logger.debug("Map directory removed: %s", self.map_directory)
235
251
  except Exception as e: # pylint: disable=W0718
236
- self.logger.error("Error removing map directory %s: %s", self.map_directory, e)
252
+ self.logger.debug("Error removing map directory %s: %s", self.map_directory, e)
237
253
  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
@@ -416,7 +416,7 @@ class Texture(Component):
416
416
  cumulative_image = cv2.bitwise_or(cumulative_image, output_image)
417
417
 
418
418
  cv2.imwrite(layer_path, output_image)
419
- self.logger.info("Texture %s saved.", layer_path)
419
+ self.logger.debug("Texture %s saved.", layer_path)
420
420
 
421
421
  # Save info layer data.
422
422
  with open(self.info_layer_path, "w", encoding="utf-8") as f:
@@ -481,8 +481,6 @@ class Texture(Component):
481
481
 
482
482
  self.logger.info("Dissolved layer %s.", layer.name)
483
483
 
484
- self.logger.info("Dissolving finished.")
485
-
486
484
  def draw_base_layer(self, cumulative_image: np.ndarray) -> None:
487
485
  """Draws base layer and saves it into the png file.
488
486
  Base layer is the last layer to be drawn, it fills the remaining area of the map.
@@ -496,7 +494,7 @@ class Texture(Component):
496
494
  self.logger.debug("Drawing base layer %s.", layer_path)
497
495
  img = cv2.bitwise_not(cumulative_image)
498
496
  cv2.imwrite(layer_path, img)
499
- self.logger.info("Base texture %s saved.", layer_path)
497
+ self.logger.debug("Base texture %s saved.", layer_path)
500
498
 
501
499
  def get_relative_x(self, x: float) -> int:
502
500
  """Converts UTM X coordinate to relative X coordinate in map image.
@@ -635,9 +633,8 @@ class Texture(Component):
635
633
  is_fieds = info_layer == "fields"
636
634
  try:
637
635
  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)
636
+ except Exception: # pylint: disable=W0718
637
+ self.logger.debug("Error fetching objects for tags: %s.", tags)
641
638
  return
642
639
  objects_utm = ox.projection.project_gdf(objects, to_latlong=False)
643
640
  self.logger.debug("Fetched %s elements for tags: %s.", len(objects_utm), tags)
@@ -712,5 +709,5 @@ class Texture(Component):
712
709
  preview_path = os.path.join(self.previews_directory, "textures_osm.png")
713
710
 
714
711
  cv2.imwrite(preview_path, merged) # type: ignore
715
- self.logger.info("Preview saved to %s.", preview_path)
712
+ self.logger.debug("Preview saved to %s.", preview_path)
716
713
  return preview_path
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maps4fs
3
- Version: 1.3.1
3
+ Version: 1.3.4
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
@@ -523,3 +523,6 @@ But also, I want to thank the people who helped me with the project in some way,
523
523
  - [Ka5tis](https://github.com/Ka5tis) - for investigating the issue with a "spiky terrain" and finding a solution - changing the `DisplacementLayer` size to a higher value.
524
524
  - [Kalderone](https://www.youtube.com/@Kalderone_FS22) - for useful feedback, suggestions, expert advice on the map-making process and highlihting some important settings in the Giants Editor.
525
525
  - [OneSunnySunday](https://www.artstation.com/onesunnysunday) - for expert advice on Blender, help in processing background terrain, and compiling detailed tutorials on how to prepare the OBJ files for use in Giants Editor.
526
+ - [BFernaesds](https://github.com/BFernaesds) - for the manual tests of the app.
527
+ - [gamerdesigns](https://github.com/gamerdesigns) - for the manual tests of the app.
528
+ - [Tox3](https://github.com/Tox3) - for the manual tests of the app.
@@ -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=Oa8nU_5y3LpGvPW0hqkVjUxKd-U7o2eOFm0SfncDnMo,8397
12
+ maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
13
+ maps4fs/generator/texture.py,sha256=2WoP54i0ppZdbnmD2Q-GllDPTxcz6zhczC1xoTHIS_A,27542
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.4.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
18
+ maps4fs-1.3.4.dist-info/METADATA,sha256=gso9NEiGJ4tRl1KYeG0nJ8Uxww3kUGTARbxP_45zzI0,30910
19
+ maps4fs-1.3.4.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
20
+ maps4fs-1.3.4.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
21
+ maps4fs-1.3.4.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=mVffAsVyerd8t17c3pLQMStkdM_cYVoqreQq1XeqfVo,22318
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=5PMooBbDk_HrSOwu3ha7QvWc2AyzBNf-ELmZoIFzPL0,15946
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.1.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
18
- maps4fs-1.3.1.dist-info/METADATA,sha256=bL-S19qV6nsg22XWF2CRepeyyGHWABFKrq4O3eCQk0E,30673
19
- maps4fs-1.3.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
20
- maps4fs-1.3.1.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
21
- maps4fs-1.3.1.dist-info/RECORD,,