maps4fs 1.6.1__py3-none-any.whl → 1.6.2__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.
@@ -179,7 +179,7 @@ class Background(Component):
179
179
  self.logger.debug("Generating obj file in path: %s", save_path)
180
180
 
181
181
  dem_data = cv2.imread(self.dem.dem_path, cv2.IMREAD_UNCHANGED) # pylint: disable=no-member
182
- self.plane_from_np(dem_data, save_path) # type: ignore
182
+ self.plane_from_np(dem_data, save_path, create_preview=True) # type: ignore
183
183
 
184
184
  # pylint: disable=too-many-locals
185
185
  def cutout(self, dem_path: str, save_path: str | None = None) -> str:
@@ -232,6 +232,7 @@ class Background(Component):
232
232
  dem_data: np.ndarray,
233
233
  save_path: str,
234
234
  include_zeros: bool = True,
235
+ create_preview: bool = False,
235
236
  ) -> None:
236
237
  """Generates a 3D obj file based on DEM data.
237
238
 
@@ -239,6 +240,7 @@ class Background(Component):
239
240
  dem_data (np.ndarray) -- The DEM data as a numpy array.
240
241
  save_path (str) -- The path where the obj file will be saved.
241
242
  include_zeros (bool, optional) -- If True, the mesh will include the zero height values.
243
+ create_preview (bool, optional) -- If True, a simplified mesh will be saved as an STL.
242
244
  """
243
245
  resize_factor = 1 / self.map.background_settings.resize_factor
244
246
  dem_data = cv2.resize( # pylint: disable=no-member
@@ -278,7 +280,10 @@ class Background(Component):
278
280
  bottom_left = top_left + cols
279
281
  bottom_right = bottom_left + 1
280
282
 
281
- if ground in [z[i, j], z[i, j + 1], z[i + 1, j], z[i + 1, j + 1]]:
283
+ if (
284
+ ground in [z[i, j], z[i, j + 1], z[i + 1, j], z[i + 1, j + 1]]
285
+ and not include_zeros
286
+ ):
282
287
  skipped += 1
283
288
  continue
284
289
 
@@ -304,7 +309,7 @@ class Background(Component):
304
309
  mesh.export(save_path)
305
310
  self.logger.debug("Obj file saved: %s", save_path)
306
311
 
307
- if include_zeros:
312
+ if create_preview:
308
313
  # Simplify the preview mesh to reduce the size of the file.
309
314
  mesh = mesh.simplify_quadric_decimation(face_count=len(mesh.faces) // 2**7)
310
315
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maps4fs
3
- Version: 1.6.1
3
+ Version: 1.6.2
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
@@ -1,7 +1,7 @@
1
1
  maps4fs/__init__.py,sha256=WbT36EzJ_74GN0RUUrLIYECdSdtRiZaxKl17KUt7pjA,492
2
2
  maps4fs/logger.py,sha256=B-NEYpMjPAAqlV4VpfTi6nbBFnEABVtQOaYe6nMpidg,1489
3
3
  maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
4
- maps4fs/generator/background.py,sha256=UQlYobpDuUaRM9Ke20-ZKhAYtMS-FC-ekYeaLhimhyQ,22374
4
+ maps4fs/generator/background.py,sha256=dpvhhkDUJtOt_pobIOuDp6DV8Z1HJfLyP8pzkIkk-G8,22615
5
5
  maps4fs/generator/component.py,sha256=GrTI7803gOQFhqocdjFG-wh0HOkC6HWoyKr8pR2Xp28,20409
6
6
  maps4fs/generator/config.py,sha256=0QmK052B8bxyHVhg3jzCORLfOBMMmqVfhhbqXKf6OMk,4383
7
7
  maps4fs/generator/dem.py,sha256=20gx0dzX0LyO6ipvDitst-BwGfcKogFqgQf9Q2qMH5U,10933
@@ -20,8 +20,8 @@ maps4fs/generator/dtm/usgs.py,sha256=U0kDog1UAa1lWiK4Pe3nnhXnnplOS4HZde1yqYqCiDw
20
20
  maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
21
21
  maps4fs/toolbox/background.py,sha256=9BXWNqs_n3HgqDiPztWylgYk_QM4YgBpe6_ZNQAWtSc,2154
22
22
  maps4fs/toolbox/dem.py,sha256=z9IPFNmYbjiigb3t02ZenI3Mo8odd19c5MZbjDEovTo,3525
23
- maps4fs-1.6.1.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
24
- maps4fs-1.6.1.dist-info/METADATA,sha256=6LPuSkp0S7c0USSsUBF6n5MPuNMIuSA_J7IviBUHaKA,36231
25
- maps4fs-1.6.1.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
26
- maps4fs-1.6.1.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
27
- maps4fs-1.6.1.dist-info/RECORD,,
23
+ maps4fs-1.6.2.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
24
+ maps4fs-1.6.2.dist-info/METADATA,sha256=d-BfbnZWHPF705S_hRl6q9u9GtL3wzonab3J-dFjzjk,36231
25
+ maps4fs-1.6.2.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
26
+ maps4fs-1.6.2.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
27
+ maps4fs-1.6.2.dist-info/RECORD,,