maps4fs 1.5.9__tar.gz → 1.6.0__tar.gz
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.
- {maps4fs-1.5.9 → maps4fs-1.6.0}/PKG-INFO +1 -1
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/generator/dem.py +0 -52
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/generator/dtm/srtm.py +5 -4
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/generator/texture.py +1 -2
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs.egg-info/PKG-INFO +1 -1
- {maps4fs-1.5.9 → maps4fs-1.6.0}/pyproject.toml +1 -1
- {maps4fs-1.5.9 → maps4fs-1.6.0}/tests/test_generator.py +15 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/LICENSE.md +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/README.md +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/__init__.py +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/generator/__init__.py +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/generator/background.py +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/generator/component.py +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/generator/config.py +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/generator/dtm/__init__.py +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/generator/dtm/dtm.py +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/generator/dtm/usgs.py +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/generator/game.py +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/generator/grle.py +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/generator/i3d.py +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/generator/map.py +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/generator/qgis.py +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/generator/satellite.py +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/generator/settings.py +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/logger.py +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/toolbox/__init__.py +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/toolbox/background.py +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs/toolbox/dem.py +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs.egg-info/SOURCES.txt +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs.egg-info/dependency_links.txt +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs.egg-info/requires.txt +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/maps4fs.egg-info/top_level.txt +0 -0
- {maps4fs-1.5.9 → maps4fs-1.6.0}/setup.cfg +0 -0
@@ -280,55 +280,3 @@ class DEM(Component):
|
|
280
280
|
list: Empty list.
|
281
281
|
"""
|
282
282
|
return []
|
283
|
-
|
284
|
-
def _get_scaling_factor(self, maximum_deviation: int) -> float:
|
285
|
-
"""Calculate scaling factor for DEM data normalization.
|
286
|
-
NOTE: Needs reconsideration for the implementation.
|
287
|
-
|
288
|
-
Arguments:
|
289
|
-
maximum_deviation (int): Maximum deviation in DEM data.
|
290
|
-
|
291
|
-
Returns:
|
292
|
-
float: Scaling factor for DEM data normalization.
|
293
|
-
"""
|
294
|
-
ESTIMATED_MAXIMUM_DEVIATION = 1000 # pylint: disable=C0103
|
295
|
-
scaling_factor = maximum_deviation / ESTIMATED_MAXIMUM_DEVIATION
|
296
|
-
return scaling_factor if scaling_factor < 1 else 1
|
297
|
-
|
298
|
-
def _normalize_dem(self, data: np.ndarray) -> np.ndarray:
|
299
|
-
"""Normalize DEM data to 16-bit unsigned integer using max height from settings.
|
300
|
-
Arguments:
|
301
|
-
data (np.ndarray): DEM data from SRTM file after cropping.
|
302
|
-
Returns:
|
303
|
-
np.ndarray: Normalized DEM data.
|
304
|
-
"""
|
305
|
-
self.logger.debug("Starting DEM data normalization.")
|
306
|
-
# Calculate the difference between the maximum and minimum values in the DEM data.
|
307
|
-
|
308
|
-
max_height = data.max()
|
309
|
-
min_height = data.min()
|
310
|
-
max_dev = max_height - min_height
|
311
|
-
self.logger.debug(
|
312
|
-
"Maximum deviation: %s with maximum at %s and minimum at %s.",
|
313
|
-
max_dev,
|
314
|
-
max_height,
|
315
|
-
min_height,
|
316
|
-
)
|
317
|
-
|
318
|
-
scaling_factor = self._get_scaling_factor(max_dev)
|
319
|
-
adjusted_max_height = int(65535 * scaling_factor)
|
320
|
-
self.logger.debug(
|
321
|
-
"Maximum deviation: %s. Scaling factor: %s. Adjusted max height: %s.",
|
322
|
-
max_dev,
|
323
|
-
scaling_factor,
|
324
|
-
adjusted_max_height,
|
325
|
-
)
|
326
|
-
normalized_data = (
|
327
|
-
(data - data.min()) / (data.max() - data.min()) * adjusted_max_height
|
328
|
-
).astype("uint16")
|
329
|
-
self.logger.debug(
|
330
|
-
"DEM data was normalized to %s - %s.",
|
331
|
-
normalized_data.min(),
|
332
|
-
normalized_data.max(),
|
333
|
-
)
|
334
|
-
return normalized_data
|
@@ -24,10 +24,11 @@ class SRTM30Provider(DTMProvider):
|
|
24
24
|
_author = "[iwatkot](https://github.com/iwatkot)"
|
25
25
|
|
26
26
|
_instructions = (
|
27
|
-
"ℹ️
|
28
|
-
"Otherwise,
|
29
|
-
"
|
30
|
-
"
|
27
|
+
"ℹ️ If you're a rookie in the Giants Editor check the **Apply the default multiplier** "
|
28
|
+
"checkbox. Otherwise, you can change the multiplier value in the DEM Settings. "
|
29
|
+
"If you will not apply the default multiplier and not change the value in the DEM "
|
30
|
+
"Settings, you'll have the DEM image with the original values as on Earth, which can "
|
31
|
+
"not be seen by eye and will lead to completely flat terrain. "
|
31
32
|
)
|
32
33
|
|
33
34
|
def __init__(self, *args, **kwargs):
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "maps4fs"
|
7
|
-
version = "1.
|
7
|
+
version = "1.6.0"
|
8
8
|
description = "Generate map templates for Farming Simulator from real places."
|
9
9
|
authors = [{name = "iwatkot", email = "iwatkot@gmail.com"}]
|
10
10
|
license = {text = "MIT License"}
|
@@ -8,6 +8,11 @@ import cv2
|
|
8
8
|
|
9
9
|
from maps4fs import DTMProvider, Map
|
10
10
|
from maps4fs.generator.game import Game
|
11
|
+
from maps4fs.generator.settings import (
|
12
|
+
BackgroundSettings,
|
13
|
+
DEMSettings,
|
14
|
+
SatelliteSettings,
|
15
|
+
)
|
11
16
|
|
12
17
|
working_directory = os.getcwd()
|
13
18
|
|
@@ -168,6 +173,13 @@ def test_map_pack():
|
|
168
173
|
|
169
174
|
height, width = get_random_size()
|
170
175
|
|
176
|
+
dem_settings = DEMSettings(multiplier=2, blur_radius=15, plateau=1000, water_depth=500)
|
177
|
+
|
178
|
+
background_settings = BackgroundSettings(
|
179
|
+
generate_background=True, generate_water=True, resize_factor=16
|
180
|
+
)
|
181
|
+
satellite_settings = SatelliteSettings(download_images=True, satellite_margin=0, zoom_level=14)
|
182
|
+
|
171
183
|
directory = map_directory(game_code)
|
172
184
|
map = Map(
|
173
185
|
game=game,
|
@@ -177,6 +189,9 @@ def test_map_pack():
|
|
177
189
|
size=height,
|
178
190
|
rotation=30,
|
179
191
|
map_directory=directory,
|
192
|
+
dem_settings=dem_settings,
|
193
|
+
background_settings=background_settings,
|
194
|
+
satellite_settings=satellite_settings,
|
180
195
|
)
|
181
196
|
for _ in map.generate():
|
182
197
|
pass
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|