maps4fs 1.9.2__py3-none-any.whl → 1.9.3__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.

Potentially problematic release.


This version of maps4fs might be problematic. Click here for more details.

@@ -35,7 +35,7 @@ class XMLComponent(Component):
35
35
  if not os.path.isfile(xml_path):
36
36
  raise FileNotFoundError(f"XML file {xml_path} does not exist.")
37
37
 
38
- return ET.parse(xml_path)
38
+ return ET.parse(xml_path) # type: ignore
39
39
 
40
40
  def save_tree(self, tree: ET.ElementTree, xml_path: str | None = None) -> None:
41
41
  """Saves the XML tree to the file.
@@ -40,7 +40,7 @@ class Config(XMLComponent):
40
40
  "height": str(self.scaled_size),
41
41
  }
42
42
 
43
- for element in root.iter("map"):
43
+ for element in root.iter("map"): # type: ignore
44
44
  self.update_element(element, data)
45
45
  break
46
46
  self.save_tree(tree)
@@ -204,7 +204,7 @@ class GRLE(ImageComponent, XMLComponent):
204
204
 
205
205
  tree = self.get_tree()
206
206
  root = tree.getroot()
207
- farmlands_node = root.find("farmlands")
207
+ farmlands_node = root.find("farmlands") # type: ignore
208
208
  if farmlands_node is None:
209
209
  raise ValueError("Farmlands XML element not found in the farmlands XML file.")
210
210
 
@@ -85,8 +85,8 @@ class I3d(XMLComponent):
85
85
 
86
86
  data = {"heightScale": str(value)}
87
87
 
88
- self.get_and_update_element(root, path, data)
89
- self.save_tree(tree)
88
+ self.get_and_update_element(root, path, data) # type: ignore
89
+ self.save_tree(tree) # type: ignore
90
90
 
91
91
  def _update_parameters(self) -> None:
92
92
  """Updates the map I3D file with the sun bounding box and displacement layer size."""
@@ -101,11 +101,11 @@ class I3d(XMLComponent):
101
101
  "lastShadowMapSplitBboxMax": f"{distance},148,{distance}",
102
102
  }
103
103
 
104
- self.get_and_update_element(root, sun_element_path, data)
104
+ self.get_and_update_element(root, sun_element_path, data) # type: ignore
105
105
 
106
106
  displacement_layer_path = ".//Scene/TerrainTransformGroup/Layers/DisplacementLayer"
107
107
  data = {"size": str(int(self.map_size * 8))}
108
- self.get_and_update_element(root, displacement_layer_path, data)
108
+ self.get_and_update_element(root, displacement_layer_path, data) # type: ignore
109
109
 
110
110
  self.save_tree(tree)
111
111
 
@@ -125,9 +125,9 @@ class I3d(XMLComponent):
125
125
 
126
126
  root = tree.getroot()
127
127
  # Find <Shapes> element in the I3D file.
128
- shapes_node = root.find(".//Shapes")
128
+ shapes_node = root.find(".//Shapes") # type: ignore
129
129
  # Find <Scene> element in the I3D file.
130
- scene_node = root.find(".//Scene")
130
+ scene_node = root.find(".//Scene") # type: ignore
131
131
 
132
132
  if shapes_node is None or scene_node is None:
133
133
  self.logger.warning("Shapes or Scene node not found in I3D file.")
@@ -145,7 +145,7 @@ class I3d(XMLComponent):
145
145
  interpolation=cv2.INTER_NEAREST,
146
146
  )
147
147
 
148
- user_attributes_node = root.find(".//UserAttributes")
148
+ user_attributes_node = root.find(".//UserAttributes") # type: ignore
149
149
  if user_attributes_node is None:
150
150
  self.logger.warning("UserAttributes node not found in I3D file.")
151
151
  return
@@ -240,12 +240,12 @@ class I3d(XMLComponent):
240
240
  self.logger.debug("Starging to add fields to the I3D file.")
241
241
 
242
242
  root = tree.getroot()
243
- gameplay_node = root.find(".//TransformGroup[@name='gameplay']")
243
+ gameplay_node = root.find(".//TransformGroup[@name='gameplay']") # type: ignore
244
244
 
245
245
  if gameplay_node is None:
246
246
  return
247
247
  fields_node = gameplay_node.find(".//TransformGroup[@name='fields']")
248
- user_attributes_node = root.find(".//UserAttributes")
248
+ user_attributes_node = root.find(".//UserAttributes") # type: ignore
249
249
 
250
250
  if fields_node is None or user_attributes_node is None:
251
251
  return
@@ -497,7 +497,7 @@ class I3d(XMLComponent):
497
497
 
498
498
  tree = self.get_tree()
499
499
  root = tree.getroot()
500
- scene_node = root.find(".//Scene")
500
+ scene_node = root.find(".//Scene") # type: ignore
501
501
  if scene_node is None:
502
502
  self.logger.warning("Scene element not found in I3D file.")
503
503
  return
maps4fs/generator/map.py CHANGED
@@ -226,8 +226,8 @@ class Map:
226
226
  self.rotation,
227
227
  self.map_directory,
228
228
  self.logger,
229
- texture_custom_schema=self.texture_custom_schema,
230
- tree_custom_schema=self.tree_custom_schema,
229
+ texture_custom_schema=self.texture_custom_schema, # type: ignore
230
+ tree_custom_schema=self.tree_custom_schema, # type: ignore
231
231
  )
232
232
  self.components.append(component)
233
233
 
@@ -1,5 +1,7 @@
1
1
  """This module contains functions to work with the background terrain of the map."""
2
2
 
3
+ import warnings
4
+
3
5
  import cv2
4
6
  import numpy as np
5
7
  import trimesh # type: ignore
@@ -22,6 +24,13 @@ def plane_from_np(
22
24
  will result in a simpler mesh.
23
25
  save_path (str) -- The path to save the obj file.
24
26
  """
27
+ warnings.warn(
28
+ "The 'plane_from_np' function is deprecated and will be removed in maps4fs 2.0. "
29
+ "Use 'trimesh' directly instead or maps4fs.generator.component.base.component_mesh."
30
+ "MeshComponent.mesh_from_np' instead.",
31
+ DeprecationWarning,
32
+ stacklevel=2,
33
+ )
25
34
  dem_data = cv2.resize(dem_data, (0, 0), fx=resize_factor, fy=resize_factor)
26
35
 
27
36
  # Invert the height values.
@@ -1,6 +1,7 @@
1
1
  """This module contains functions to work with custom OSM files."""
2
2
 
3
3
  import json
4
+ import warnings
4
5
  from xml.etree import ElementTree as ET
5
6
 
6
7
  import osmnx as ox
@@ -19,6 +20,13 @@ def check_osm_file(file_path: str) -> bool:
19
20
  Returns:
20
21
  bool: True if the file is valid, False otherwise.
21
22
  """
23
+ warnings.warn(
24
+ "The 'check_osm_file' function is deprecated and will be removed in maps4fs 2.0. "
25
+ "The feature will be directly integrated into the maps4fs generator. "
26
+ "And will not be available as a separate function.",
27
+ DeprecationWarning,
28
+ stacklevel=2,
29
+ )
22
30
  with open(FS25().texture_schema, encoding="utf-8") as f:
23
31
  schema = json.load(f)
24
32
 
@@ -50,6 +58,13 @@ def fix_osm_file(input_file_path: str, output_file_path: str) -> tuple[bool, int
50
58
  tuple[bool, int]: A tuple containing the result of the check_osm_file function
51
59
  and the number of fixed errors.
52
60
  """
61
+ warnings.warn(
62
+ "The 'fix_osm_file' function is deprecated and will be removed in maps4fs 2.0. "
63
+ "The feature will be directly integrated into the maps4fs generator. "
64
+ "And will not be available as a separate function.",
65
+ DeprecationWarning,
66
+ stacklevel=2,
67
+ )
53
68
  broken_entries = ["relation", ".//*[@action='delete']"]
54
69
 
55
70
  tree = ET.parse(input_file_path)
maps4fs/toolbox/dem.py CHANGED
@@ -1,6 +1,7 @@
1
1
  """This module contains functions for working with Digital Elevation Models (DEMs)."""
2
2
 
3
3
  import os
4
+ import warnings
4
5
 
5
6
  import rasterio # type: ignore
6
7
  from pyproj import Transformer
@@ -21,6 +22,12 @@ def read_geo_tiff(file_path: str) -> DatasetReader:
21
22
  Returns:
22
23
  DatasetReader: The DatasetReader object for the GeoTIFF file.
23
24
  """
25
+ warnings.warn(
26
+ "The 'read_geo_tiff' function is deprecated and will be removed in maps4fs 2.0. "
27
+ "Use 'rasterio.open' directly instead.",
28
+ DeprecationWarning,
29
+ stacklevel=2,
30
+ )
24
31
  if not os.path.isfile(file_path):
25
32
  raise FileNotFoundError(f"File not found: {file_path}")
26
33
 
@@ -51,6 +58,12 @@ def get_geo_tiff_bbox(
51
58
  tuple[float, float, float, float]: The bounding box in the destination CRS
52
59
  as (north, south, east, west).
53
60
  """
61
+ warnings.warn(
62
+ "The 'get_geo_tiff_bbox' function is deprecated and will be removed in maps4fs 2.0. "
63
+ "Use 'rasterio' methods directly instead.",
64
+ DeprecationWarning,
65
+ stacklevel=2,
66
+ )
54
67
  left, bottom, right, top = src.bounds
55
68
 
56
69
  transformer = Transformer.from_crs(src.crs, dst_crs, always_xy=True)
@@ -76,6 +89,12 @@ def extract_roi(file_path: str, bbox: tuple[float, float, float, float]) -> str:
76
89
  Returns:
77
90
  str: The path to the new GeoTIFF file containing the extracted ROI.
78
91
  """
92
+ warnings.warn(
93
+ "The 'extract_roi' function is deprecated and will be removed in maps4fs 2.0. "
94
+ "Use 'rasterio' methods directly instead.",
95
+ DeprecationWarning,
96
+ stacklevel=2,
97
+ )
79
98
  with rasterio.open(file_path) as src:
80
99
  transformer = Transformer.from_crs("EPSG:4326", src.crs, always_xy=True)
81
100
  north, south, east, west = bbox
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maps4fs
3
- Version: 1.9.2
3
+ Version: 1.9.3
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
@@ -29,6 +29,18 @@ Requires-Dist: tqdm
29
29
  Requires-Dist: scipy
30
30
  Dynamic: license-file
31
31
 
32
+ ⚠️ Learn more about the upcoming 2.0.0 changes in the [migration guide](docs/migration.md).
33
+ ⚠️ Some components are deprecated and there are major changes in the project structure.
34
+
35
+
36
+ <p align="center">
37
+ <a href="https://github.com/iwatkot/maps4fs">maps4fs</a> •
38
+ <a href="https://github.com/iwatkot/maps4fsui">maps4fs UI</a> •
39
+ <a href="https://github.com/iwatkot/maps4fsapi">maps4fs API</a> •
40
+ <a href="https://github.com/iwatkot/maps4fsstats">maps4fs Stats</a> •
41
+ <a href="https://github.com/iwatkot/maps4fsbot">maps4fs Bot</a>
42
+ </p>
43
+
32
44
  <div align="center" markdown>
33
45
  <a href="https://discord.gg/Sj5QKKyE42">
34
46
  <img src="https://github.com/user-attachments/assets/37043333-d6ef-4ca3-9f3c-81323d9d0b71">
@@ -41,7 +53,7 @@ Dynamic: license-file
41
53
  <a href="#How-To-Run">How-To-Run</a><br>
42
54
  <a href="docs/FAQ.md">FAQ</a> •
43
55
  <a href="docs/map_structure.md">Map Structure</a>
44
- <a href="#Modder-Toolbox">Modder Toolbox</a> •
56
+ <a href="#Schemas-Editor">Schemas Editor</a> •
45
57
  <a href="#Main-Settings">Main Settings</a><br>
46
58
  <a href="#Supported-objects">Supported objects</a> •
47
59
  <a href="#Generation-info">Generation info</a> •
@@ -69,7 +81,6 @@ Dynamic: license-file
69
81
  [![Build Status](https://github.com/iwatkot/maps4fs/actions/workflows/checks.yml/badge.svg)](https://github.com/iwatkot/maps4fs/actions)
70
82
  [![Test Coverage](https://api.codeclimate.com/v1/badges/b922fd0a7188d37e61de/test_coverage)](https://codeclimate.com/github/iwatkot/maps4fs/test_coverage)
71
83
  [![GitHub Repo stars](https://img.shields.io/github/stars/iwatkot/maps4fs)](https://github.com/iwatkot/maps4fs/stargazers)<br>
72
- [![Lines of code](https://tokei.rs/b1/github/iwatkot/maps4fs)](https://github.com/iwatkot/maps4fs)
73
84
 
74
85
  </div>
75
86
 
@@ -92,7 +103,6 @@ Dynamic: license-file
92
103
  🔷 Generates \*.obj files for background terrain based on the real-world height map<br>
93
104
  📄 Generates scripts to download high-resolution satellite images from [QGIS](https://qgis.org/download/) in one click<br>
94
105
  📕 Detailed [documentation](/docs) and tutorials <br>
95
- 🧰 Modder Toolbox to help you with various tasks <br>
96
106
 
97
107
  <p align="center">
98
108
  <img src="https://github.com/user-attachments/assets/cf8f5752-9c69-4018-bead-290f59ba6976"><br>
@@ -326,32 +336,12 @@ The map will be saved in the `map_directory` directory.
326
336
 
327
337
  ➡️ Check out the [demo.py](demo.py) file for a complete example.
328
338
 
329
- ## Modder Toolbox
330
-
331
- The tool now has a Modder Toolbox, which is a set of tools to help you with various tasks. You can open the toolbox by switching to the `🧰 Modder Toolbox` tab in the StreamLit app.<br>
332
-
333
- ![Modder Toolbox](https://github.com/user-attachments/assets/dffb252f-f5c0-4021-9d45-31e5bccc0d9b)
334
-
335
- ### Tool Categories
336
-
337
- Tools are divided into categories, which are listed below.
338
-
339
- #### For custom schemas
339
+ ## Schemas Editor
340
340
 
341
341
  - **Tree Schema Editor** - allows you to view all the supported trees models and select the ones you need on your map. After it, you should click the Show updated schema button and copy the JSON schema to the clipboard. Then you can use it in the Expert settings to generate the map with the selected trees.
342
342
 
343
343
  - **Texture Schema Editor** - allows you to view all the supported textures and edit their parameters, such as priority, OSM tags and so on. After editing, you should click the Show updated schema button and copy the JSON schema to the clipboard. Then you can use it in the Expert settings to generate the map with the updated textures.
344
344
 
345
- #### For Textures and DEM
346
-
347
- - **Fix custom OSM file** - this tool fixes the most common errors in the custom OSM file, but it can not guarantee that the file will be fixed completely if some non-common errors are present.
348
-
349
- - **GeoTIFF windowing** - allows you to upload your GeoTIFF file and select the region of interest to extract it from the image. It's useful when you have high-resolution DEM data and want to create a height map using it.
350
-
351
- #### For Background terrain
352
-
353
- - **Convert image to obj model** - allows you to convert the image to the obj model. You can use this tool to create the background terrain for your map. It can be extremely useful if you have access to the sources of high-resolution DEM data and want to create the background terrain using it.
354
-
355
345
  ## Main Settings
356
346
 
357
347
  ### Game Selection
@@ -2,16 +2,16 @@ maps4fs/__init__.py,sha256=EGvLVoRpSt4jITswsGbe1ISVmGAZAMQJcBmTwtyuVxI,335
2
2
  maps4fs/logger.py,sha256=HQrDyj72mUjVYo25aR_-_SxVn2rfFjDCNbj-JKJdSnE,1488
3
3
  maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
4
4
  maps4fs/generator/game.py,sha256=NZaxj5z7WzMiHzAvQyr-TvVjGoHgqGldM6ZsItuYyzA,11292
5
- maps4fs/generator/map.py,sha256=XYKzhr2SuC3ILty1RYfaWkxUr9VJF3FkpWJ6-dTwzB8,13896
5
+ maps4fs/generator/map.py,sha256=CaRfesYIZa801cKbTEwb-WdUYZcFQ_9dn_j1ij6VmhE,13928
6
6
  maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
7
7
  maps4fs/generator/settings.py,sha256=E5sfkfJgcjh9QHpa7ILlV_jnrF6USpsOFxkooVnxrbs,6968
8
8
  maps4fs/generator/statistics.py,sha256=aynS3zbAtiwnU_YLKHPTiiaKW98_suvQUhy1SGBA6mc,2448
9
9
  maps4fs/generator/component/__init__.py,sha256=s01yVVVi8R2xxNvflu2D6wTd9I_g73AMM2x7vAC7GX4,490
10
10
  maps4fs/generator/component/background.py,sha256=kt_RaLrj6hZeZaaFNT36jJyp9IofiN9CFsO8EYY7F7A,23756
11
- maps4fs/generator/component/config.py,sha256=dEezqrDJ9ghEvJ1Y2jdL-v7ezgeeTN415Fcr_vBQmqg,3680
11
+ maps4fs/generator/component/config.py,sha256=IP530sapLofFskSnBEB96G0aUSd6Sno0G9ET3ca0ZOQ,3696
12
12
  maps4fs/generator/component/dem.py,sha256=Bvm3ViA6PpR7RXRAHBj5rgYB9PWy55Qj6PhTMv6dJRI,11953
13
- maps4fs/generator/component/grle.py,sha256=xwuwkqVDvxQL6r9E5pytIcPH0HsgHI7ZYGmCcyfd8Pc,19484
14
- maps4fs/generator/component/i3d.py,sha256=432LJWfOcY4rPXc2tb3okCRJ_DD9wgIHt0u0nqJBhJI,23617
13
+ maps4fs/generator/component/grle.py,sha256=zzQsTrSoGE8hIESRIMJMHggVJzohUzCgaFlCBl7k58Q,19500
14
+ maps4fs/generator/component/i3d.py,sha256=OvcvRnsLjqo059R3nClJ4PNGaCyh7-1aFyGFmC8Jivo,23777
15
15
  maps4fs/generator/component/layer.py,sha256=-br4gAGcGeBNb3ldch9XFEK0lhXqb1IbArhFB5Owu54,6186
16
16
  maps4fs/generator/component/satellite.py,sha256=oZBHjP_QY0ik1-Vk7JqMS__zIG8ffw2voeozB7-HUQc,4946
17
17
  maps4fs/generator/component/texture.py,sha256=tCMuuNcRwgdPkPVmNA7BCbnsTBnwkUXOrdlJJUoYAMU,33273
@@ -19,7 +19,7 @@ maps4fs/generator/component/base/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX5
19
19
  maps4fs/generator/component/base/component.py,sha256=13ZjIatyxmxfcpE89cqlpQ6IBppJTeUisIEVa344eqM,21833
20
20
  maps4fs/generator/component/base/component_image.py,sha256=2NYJgCU8deHl7O2FYFYk38WKZVJygFoc2gjBXwH6vjM,5970
21
21
  maps4fs/generator/component/base/component_mesh.py,sha256=BsxS5NlUK2hLhksgCwSoMK-00GNAwK2fYGpgb3R4n1w,9396
22
- maps4fs/generator/component/base/component_xml.py,sha256=6OO1dKoceO1ACk7-k1oGtnkfNud8ZN3u3ZNjdNMpTqw,3967
22
+ maps4fs/generator/component/base/component_xml.py,sha256=V9pGUvHh6UF6BP0qFARqDq9vquoAgq1zJqhOgBoeS_Y,3983
23
23
  maps4fs/generator/dtm/__init__.py,sha256=CzK8ZdLU5Iv7DrwK5hIQ41zVsLRFgZO-IuRxf-NCVqg,1516
24
24
  maps4fs/generator/dtm/arctic.py,sha256=LSivLLjtd6TJUaPYvgSYQ4KalMTaY58zFvwivSh45uM,2587
25
25
  maps4fs/generator/dtm/baden.py,sha256=PQTMEPm9hrO3nKbv_DXA9oNYnGK_0ei41Q_DhtethX0,1041
@@ -51,11 +51,11 @@ maps4fs/generator/dtm/utils.py,sha256=I-wUSA_J85Xbt8sZCZAVKHSIcrMj5Ng-0adtPVhVmk
51
51
  maps4fs/generator/dtm/base/wcs.py,sha256=lQAp_gVz9_XUmtyobJkskiefQpuJH4o1Vwb3CSQ0lQA,2510
52
52
  maps4fs/generator/dtm/base/wms.py,sha256=6Va2UMhg_s0TMOfMhxrPbsiAPiw6-vXBglnaij032I0,2264
53
53
  maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
54
- maps4fs/toolbox/background.py,sha256=RclEqxEWLbMxuEkkegQP8jybzugwQ1_R3rdfDe0s21U,2104
55
- maps4fs/toolbox/custom_osm.py,sha256=X6ZlPqiOhNjkmdD_qVroIfdOl9Rb90cDwVSLDVYgx80,1892
56
- maps4fs/toolbox/dem.py,sha256=z9IPFNmYbjiigb3t02ZenI3Mo8odd19c5MZbjDEovTo,3525
57
- maps4fs-1.9.2.dist-info/licenses/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
58
- maps4fs-1.9.2.dist-info/METADATA,sha256=JbEQlBdtwmVmxgKqAX18yn6PFBwmyQrFGOo4ZJLa8iI,50476
59
- maps4fs-1.9.2.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
60
- maps4fs-1.9.2.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
61
- maps4fs-1.9.2.dist-info/RECORD,,
54
+ maps4fs/toolbox/background.py,sha256=RB0pHuRyfnDuqYtO2gUypfPm4G5cYRFdT2W-DG49zy0,2427
55
+ maps4fs/toolbox/custom_osm.py,sha256=fjVSl9Ztc8_q0DxgNkhM7tE0Y-XpX8xcGGW-Tunp0R8,2518
56
+ maps4fs/toolbox/dem.py,sha256=mbn3ZqMRhhYmzgssm2CGvg6aa89MUBOJPq6QyE54OLY,4191
57
+ maps4fs-1.9.3.dist-info/licenses/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
58
+ maps4fs-1.9.3.dist-info/METADATA,sha256=a4q4ZRFsuBGoiARtZHJurqD06CO4GHmPgFEdIoMKME0,49704
59
+ maps4fs-1.9.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
60
+ maps4fs-1.9.3.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
61
+ maps4fs-1.9.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.8.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5