maps4fs 1.3.2__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.
- maps4fs/generator/background.py +3 -5
- maps4fs/generator/config.py +1 -1
- maps4fs/generator/dem.py +2 -2
- maps4fs/generator/grle.py +8 -8
- maps4fs/generator/i3d.py +5 -5
- maps4fs/generator/map.py +18 -2
- maps4fs/generator/texture.py +7 -10
- {maps4fs-1.3.2.dist-info → maps4fs-1.3.4.dist-info}/METADATA +1 -1
- maps4fs-1.3.4.dist-info/RECORD +21 -0
- maps4fs-1.3.2.dist-info/RECORD +0 -21
- {maps4fs-1.3.2.dist-info → maps4fs-1.3.4.dist-info}/LICENSE.md +0 -0
- {maps4fs-1.3.2.dist-info → maps4fs-1.3.4.dist-info}/WHEEL +0 -0
- {maps4fs-1.3.2.dist-info → maps4fs-1.3.4.dist-info}/top_level.txt +0 -0
maps4fs/generator/background.py
CHANGED
@@ -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.
|
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.
|
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.
|
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:
|
maps4fs/generator/config.py
CHANGED
@@ -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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
250
|
+
self.logger.debug("Map directory removed: %s", self.map_directory)
|
235
251
|
except Exception as e: # pylint: disable=W0718
|
236
|
-
self.logger.
|
252
|
+
self.logger.debug("Error removing map directory %s: %s", self.map_directory, e)
|
237
253
|
return archive_path
|
maps4fs/generator/texture.py
CHANGED
@@ -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.
|
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.
|
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.
|
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.
|
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
|
639
|
-
self.logger.
|
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.
|
712
|
+
self.logger.debug("Preview saved to %s.", preview_path)
|
716
713
|
return preview_path
|
@@ -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,,
|
maps4fs-1.3.2.dist-info/RECORD
DELETED
@@ -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,,
|
File without changes
|
File without changes
|
File without changes
|