maps4fs 1.1.4__py3-none-any.whl → 1.1.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.
@@ -356,6 +356,7 @@ class Component:
356
356
  offset = (self.map_size / 2) - (self.map_rotated_size / 2)
357
357
  self.logger.debug("Translating the polygon by %s", offset)
358
358
  polygon = translate(polygon, xoff=offset, yoff=offset)
359
+ self.logger.debug("Rotated and translated polygon.")
359
360
 
360
361
  if margin:
361
362
  polygon = polygon.buffer(margin, join_style="mitre")
@@ -367,12 +368,16 @@ class Component:
367
368
 
368
369
  # Intersect the polygon with the bounds to fit it within the map
369
370
  fitted_polygon = polygon.intersection(bounds)
371
+ self.logger.debug("Fitted the polygon into the bounds: %s", bounds)
370
372
 
371
373
  if not isinstance(fitted_polygon, Polygon):
372
374
  raise ValueError("The fitted polygon is not a valid polygon.")
373
375
 
374
376
  # Return the fitted polygon points
375
- return list(fitted_polygon.exterior.coords)
377
+ as_list = list(fitted_polygon.exterior.coords)
378
+ if not as_list:
379
+ raise ValueError("The fitted polygon has no points.")
380
+ return as_list
376
381
 
377
382
  def get_infolayer_path(self, layer_name: str) -> str | None:
378
383
  """Returns the path to the info layer file.
maps4fs/generator/grle.py CHANGED
@@ -108,6 +108,10 @@ class GRLE(Component):
108
108
  self.game.weights_dir_path(self.map_directory), "infoLayer_farmlands.png"
109
109
  )
110
110
 
111
+ self.logger.info(
112
+ "Adding farmlands to the InfoLayer PNG file: %s.", info_layer_farmlands_path
113
+ )
114
+
111
115
  if not os.path.isfile(info_layer_farmlands_path):
112
116
  self.logger.warning("InfoLayer PNG file %s not found.", info_layer_farmlands_path)
113
117
  return
@@ -139,12 +143,19 @@ class GRLE(Component):
139
143
  )
140
144
  continue
141
145
 
146
+ self.logger.debug("Fitted field %s contains %s points.", farmland_id, len(fitted_field))
147
+
142
148
  field_np = np.array(fitted_field, np.int32)
143
149
  field_np = field_np.reshape((-1, 1, 2))
144
150
 
151
+ self.logger.debug(
152
+ "Created a numpy array and reshaped it. Number of points: %s", len(field_np)
153
+ )
154
+
145
155
  # Infolayer image is 1/2 of the size of the map image, that's why we need to divide
146
156
  # the coordinates by 2.
147
157
  field_np = field_np // 2
158
+ self.logger.debug("Divided the coordinates by 2.")
148
159
 
149
160
  # pylint: disable=no-member
150
161
  try:
maps4fs/generator/i3d.py CHANGED
@@ -126,6 +126,7 @@ class I3d(Component):
126
126
  return
127
127
 
128
128
  self.logger.info("Found %s fields in textures info layer.", len(fields))
129
+ self.logger.debug("Starging to add fields to the I3D file.")
129
130
 
130
131
  root = tree.getroot()
131
132
  gameplay_node = root.find(".//TransformGroup[@name='gameplay']")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maps4fs
3
- Version: 1.1.4
3
+ Version: 1.1.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
@@ -2,20 +2,20 @@ maps4fs/__init__.py,sha256=da4jmND2Ths9AffnkAKgzLHNkvKFOc_l21gJisPXqWY,155
2
2
  maps4fs/logger.py,sha256=B-NEYpMjPAAqlV4VpfTi6nbBFnEABVtQOaYe6nMpidg,1489
3
3
  maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
4
4
  maps4fs/generator/background.py,sha256=dnUkS1atEqqz_ryKkcfP_K9ZcwMHZVs97y-twZMpD44,15881
5
- maps4fs/generator/component.py,sha256=iYQgw2l_rvVpZ-VIhoZELdAe8rPVBwCVKwRsYejDCb0,17094
5
+ maps4fs/generator/component.py,sha256=sihh2S35q0o38leEU-dpi0is6kYCuxXiWUISAtiQErM,17351
6
6
  maps4fs/generator/config.py,sha256=b7qY0luC-_WM_c72Ohtlf4FrB37X5cALInbestSdUsw,4382
7
7
  maps4fs/generator/dem.py,sha256=rc7ADzjvlZzStOqagsWW0Vrm9-X86aPpoR1RhBF_-OE,16025
8
8
  maps4fs/generator/game.py,sha256=2oA77i9lyNYOlhtOZft6KiPTxgGJbX1Gam1TosMNLis,7407
9
- maps4fs/generator/grle.py,sha256=HFOH07RZfkCkIpSj2VSMoBUjhmYDVCFWQQYd4tn6O5o,7162
10
- maps4fs/generator/i3d.py,sha256=0UGUvmtxIaSvIF84Y4mONRGh-PXzcbjE5mSxbf3tUWc,12199
9
+ maps4fs/generator/grle.py,sha256=IVbvzF_azItxLE_ZxaM_suQflEZjJuMgHmv1En51G7A,7592
10
+ maps4fs/generator/i3d.py,sha256=SzjAxYacbBQ030N2sHh9c-dhWoG3iADJqCrHBox6vWI,12268
11
11
  maps4fs/generator/map.py,sha256=7UqLjDZgoY6M0ZxX5Q4Rjee2UGWZ64a3tGyr8B24UO0,4863
12
12
  maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
13
13
  maps4fs/generator/texture.py,sha256=uSt563KomSVUndl25IgEIi0YuhBQbnhPIoQKa-4A3_E,26016
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.1.4.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
18
- maps4fs-1.1.4.dist-info/METADATA,sha256=QmHUKafK6ugizzTCC1EhAZwOJNRxknFUon6AIEwIJ1A,28910
19
- maps4fs-1.1.4.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
20
- maps4fs-1.1.4.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
21
- maps4fs-1.1.4.dist-info/RECORD,,
17
+ maps4fs-1.1.5.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
18
+ maps4fs-1.1.5.dist-info/METADATA,sha256=bSEuXs-aIwOLiwLjEzVzObdqJswN6OsgPG8LTXjO1jk,28910
19
+ maps4fs-1.1.5.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
20
+ maps4fs-1.1.5.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
21
+ maps4fs-1.1.5.dist-info/RECORD,,