maps4fs 2.0.7__py3-none-any.whl → 2.0.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.
@@ -542,41 +542,28 @@ class Background(MeshComponent, ImageComponent):
542
542
  It creates polygons from the polylines, fits them into the map bounds, and generates a mesh.
543
543
  """
544
544
  self.logger.debug("Starting line-based water generation...")
545
-
546
- water_polylines = self.get_infolayer_data(Parameters.BACKGROUND, Parameters.WATER_POLYLINES)
545
+ water_polygons = self.get_infolayer_data(Parameters.BACKGROUND, Parameters.WATER)
547
546
  self.logger.debug(
548
- "Found %s water polylines in background info layer.", len(water_polylines) # type: ignore
547
+ "Found %s water polygons in background info layer.", len(water_polygons) # type: ignore
549
548
  )
550
- if not water_polylines:
551
- self.logger.warning("No water polylines found in background info layer.")
549
+ if not water_polygons:
550
+ self.logger.warning("No water polygons found in background info layer.")
552
551
  return
553
552
 
554
553
  polygons: list[shapely.Polygon] = []
555
- for polyline in water_polylines:
556
- points = polyline["points"]
557
- width = polyline["width"]
558
- if not points or len(points) < 2:
559
- self.logger.warning("Skipping polyline with insufficient points: %s", polyline)
554
+ for polygon_points in water_polygons:
555
+ if not polygon_points or len(polygon_points) < 2:
556
+ self.logger.warning("Skipping polygon with insufficient points...")
560
557
  continue
561
558
 
562
- # Create a shapely LineString from the points
563
- line = shapely.geometry.LineString(points)
564
- # Create a buffer around the line to create a polygon
565
- if width <= 0:
566
- self.logger.warning("Skipping polyline with non-positive width: %s", polyline)
567
- continue
559
+ polygon = shapely.Polygon(polygon_points)
568
560
 
569
- polygon = line.buffer(
570
- width + Parameters.WATER_ADD_WIDTH, cap_style=shapely.geometry.CAP_STYLE.square
571
- )
572
- if polygon.is_empty:
573
- self.logger.warning("Skipping empty polygon created from polyline: %s", polyline)
561
+ if polygon.is_empty or not polygon.is_valid:
562
+ self.logger.warning("Skipping empty or invalid polygon...")
574
563
  continue
575
564
 
576
- # Ensure the polygon is valid and not empty
577
- if not polygon.is_valid:
578
- self.logger.warning("Invalid polygon created from polyline, skipping: %s", polyline)
579
- continue
565
+ # Make Polygon a little bit bigger to hide under the terrain when creating water planes.
566
+ polygon = polygon.buffer(Parameters.WATER_ADD_WIDTH, resolution=4)
580
567
 
581
568
  polygons.append(polygon)
582
569
 
@@ -19,6 +19,7 @@ class Parameters:
19
19
  FOREST = "forest"
20
20
  ROADS_POLYLINES = "roads_polylines"
21
21
  WATER_POLYLINES = "water_polylines"
22
+ WATER = "water"
22
23
  FARMYARDS = "farmyards"
23
24
 
24
25
  PREVIEW_MAXIMUM_SIZE = 2048
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maps4fs
3
- Version: 2.0.7
3
+ Version: 2.0.9
4
4
  Summary: Generate map templates for Farming Simulator from real places.
5
5
  Author-email: iwatkot <iwatkot@gmail.com>
6
6
  License: Apache License 2.0
@@ -4,10 +4,10 @@ maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk
4
4
  maps4fs/generator/game.py,sha256=g8lMHuuRRmJLSDsQTAMv8p_-qntYMiZKnAqn7ru96i0,11645
5
5
  maps4fs/generator/map.py,sha256=x_NjUwKkDnh2cC61QpTfX88mFHAkQG1sxVwZckoV0mE,16357
6
6
  maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
7
- maps4fs/generator/settings.py,sha256=CRXpUi_ftZP9N6FckVnnXPzQKfShP_5zaDy2mhKgaR4,7524
7
+ maps4fs/generator/settings.py,sha256=iEazY2goQlyYgJA6-jhCvDOh7EZ4bDzBDGocJ5K3cjc,7544
8
8
  maps4fs/generator/statistics.py,sha256=aynS3zbAtiwnU_YLKHPTiiaKW98_suvQUhy1SGBA6mc,2448
9
9
  maps4fs/generator/component/__init__.py,sha256=s01yVVVi8R2xxNvflu2D6wTd9I_g73AMM2x7vAC7GX4,490
10
- maps4fs/generator/component/background.py,sha256=etQ3woLLfLA4_SYMtUcSRy6aGYKtJAROKFEXr9SHTcE,30019
10
+ maps4fs/generator/component/background.py,sha256=wqTgndTfRIGlLMpMXqJMw_6eVdH1JtMei46ZIXlT9X4,29480
11
11
  maps4fs/generator/component/config.py,sha256=IP530sapLofFskSnBEB96G0aUSd6Sno0G9ET3ca0ZOQ,3696
12
12
  maps4fs/generator/component/dem.py,sha256=SH_2Zu5O4dhWtZeOkCwzDF4RU04XhTdpGFYaRYJkdjc,11905
13
13
  maps4fs/generator/component/grle.py,sha256=8K32pC_ar9CR6p0EhCe2X--wEoIxFzJCPcN9ydHQ1LE,19747
@@ -20,8 +20,8 @@ maps4fs/generator/component/base/component.py,sha256=Vgmdsn1ZC37EwWi4Va4uYVt0RnF
20
20
  maps4fs/generator/component/base/component_image.py,sha256=2NYJgCU8deHl7O2FYFYk38WKZVJygFoc2gjBXwH6vjM,5970
21
21
  maps4fs/generator/component/base/component_mesh.py,sha256=lZuF-9hzDYodL4Ub4RgvFjsozxTPZJrOaLQmlNTrZ7I,9074
22
22
  maps4fs/generator/component/base/component_xml.py,sha256=V9pGUvHh6UF6BP0qFARqDq9vquoAgq1zJqhOgBoeS_Y,3983
23
- maps4fs-2.0.7.dist-info/licenses/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
24
- maps4fs-2.0.7.dist-info/METADATA,sha256=9jqulAtUcyYRpILh0AZOCt8ZsIhIhJ2Dln9N-E3p0Fc,44135
25
- maps4fs-2.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
26
- maps4fs-2.0.7.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
27
- maps4fs-2.0.7.dist-info/RECORD,,
23
+ maps4fs-2.0.9.dist-info/licenses/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
24
+ maps4fs-2.0.9.dist-info/METADATA,sha256=JhBYuvnO_3NuZlvzWafXt94qffCQPdO5GXotONW69PE,44135
25
+ maps4fs-2.0.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
26
+ maps4fs-2.0.9.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
27
+ maps4fs-2.0.9.dist-info/RECORD,,