maps4fs 1.5.0__py3-none-any.whl → 1.5.7__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/__init__.py +3 -2
- maps4fs/generator/background.py +74 -110
- maps4fs/generator/component.py +10 -0
- maps4fs/generator/dem.py +22 -106
- maps4fs/generator/dtm.py +333 -0
- maps4fs/generator/game.py +2 -1
- maps4fs/generator/i3d.py +4 -14
- maps4fs/generator/map.py +17 -134
- maps4fs/generator/satellite.py +92 -0
- maps4fs/generator/settings.py +150 -0
- {maps4fs-1.5.0.dist-info → maps4fs-1.5.7.dist-info}/METADATA +11 -4
- maps4fs-1.5.7.dist-info/RECORD +24 -0
- maps4fs-1.5.0.dist-info/RECORD +0 -21
- {maps4fs-1.5.0.dist-info → maps4fs-1.5.7.dist-info}/LICENSE.md +0 -0
- {maps4fs-1.5.0.dist-info → maps4fs-1.5.7.dist-info}/WHEEL +0 -0
- {maps4fs-1.5.0.dist-info → maps4fs-1.5.7.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,150 @@
|
|
1
|
+
"""This module contains settings models for all components."""
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
from typing import Any
|
6
|
+
|
7
|
+
from pydantic import BaseModel
|
8
|
+
|
9
|
+
|
10
|
+
class SettingsModel(BaseModel):
|
11
|
+
"""Base class for settings models. It provides methods to convert settings to and from JSON."""
|
12
|
+
|
13
|
+
@classmethod
|
14
|
+
def all_settings_to_json(cls) -> dict[str, dict[str, Any]]:
|
15
|
+
"""Get all settings of the current class and its subclasses as a dictionary.
|
16
|
+
|
17
|
+
Returns:
|
18
|
+
dict[str, dict[str, Any]]: Dictionary with settings of the current class and its
|
19
|
+
subclasses.
|
20
|
+
"""
|
21
|
+
all_settings = {}
|
22
|
+
for subclass in cls.__subclasses__():
|
23
|
+
all_settings[subclass.__name__] = subclass().model_dump()
|
24
|
+
|
25
|
+
return all_settings
|
26
|
+
|
27
|
+
@classmethod
|
28
|
+
def all_settings_from_json(cls, data: dict) -> dict[str, SettingsModel]:
|
29
|
+
"""Create settings instances from JSON data.
|
30
|
+
|
31
|
+
Arguments:
|
32
|
+
data (dict): JSON data.
|
33
|
+
|
34
|
+
Returns:
|
35
|
+
dict[str, Type[SettingsModel]]: Dictionary with settings instances.
|
36
|
+
"""
|
37
|
+
settings = {}
|
38
|
+
for subclass in cls.__subclasses__():
|
39
|
+
settings[subclass.__name__] = subclass(**data[subclass.__name__])
|
40
|
+
|
41
|
+
return settings
|
42
|
+
|
43
|
+
@classmethod
|
44
|
+
def all_settings(cls) -> list[SettingsModel]:
|
45
|
+
"""Get all settings of the current class and its subclasses.
|
46
|
+
|
47
|
+
Returns:
|
48
|
+
list[SettingsModel]: List with settings of the current class and its subclasses.
|
49
|
+
"""
|
50
|
+
settings = []
|
51
|
+
for subclass in cls.__subclasses__():
|
52
|
+
settings.append(subclass())
|
53
|
+
|
54
|
+
return settings
|
55
|
+
|
56
|
+
|
57
|
+
class DEMSettings(SettingsModel):
|
58
|
+
"""Represents the advanced settings for DEM component.
|
59
|
+
|
60
|
+
Attributes:
|
61
|
+
multiplier (int): multiplier for the heightmap, every pixel will be multiplied by this
|
62
|
+
value.
|
63
|
+
blur_radius (int): radius of the blur filter.
|
64
|
+
plateau (int): plateau height, will be added to each pixel.
|
65
|
+
water_depth (int): water depth, will be subtracted from each pixel where the water
|
66
|
+
is present.
|
67
|
+
"""
|
68
|
+
|
69
|
+
multiplier: int = 1
|
70
|
+
blur_radius: int = 35
|
71
|
+
plateau: int = 0
|
72
|
+
water_depth: int = 0
|
73
|
+
|
74
|
+
|
75
|
+
class BackgroundSettings(SettingsModel):
|
76
|
+
"""Represents the advanced settings for background component.
|
77
|
+
|
78
|
+
Attributes:
|
79
|
+
generate_background (bool): generate obj files for the background terrain.
|
80
|
+
generate_water (bool): generate obj files for the water.
|
81
|
+
resize_factor (int): resize factor for the background terrain and water.
|
82
|
+
It will be used as 1 / resize_factor of the original size.
|
83
|
+
"""
|
84
|
+
|
85
|
+
generate_background: bool = False
|
86
|
+
generate_water: bool = False
|
87
|
+
resize_factor: int = 8
|
88
|
+
|
89
|
+
|
90
|
+
class GRLESettings(SettingsModel):
|
91
|
+
"""Represents the advanced settings for GRLE component.
|
92
|
+
|
93
|
+
Attributes:
|
94
|
+
farmland_margin (int): margin around the farmland.
|
95
|
+
random_plants (bool): generate random plants on the map or use the default one.
|
96
|
+
add_farmyards (bool): If True, regions of frarmyards will be added to the map
|
97
|
+
without corresponding fields.
|
98
|
+
"""
|
99
|
+
|
100
|
+
farmland_margin: int = 0
|
101
|
+
random_plants: bool = True
|
102
|
+
add_farmyards: bool = False
|
103
|
+
|
104
|
+
|
105
|
+
class I3DSettings(SettingsModel):
|
106
|
+
"""Represents the advanced settings for I3D component.
|
107
|
+
|
108
|
+
Attributes:
|
109
|
+
forest_density (int): density of the forest (distance between trees).
|
110
|
+
"""
|
111
|
+
|
112
|
+
forest_density: int = 10
|
113
|
+
|
114
|
+
|
115
|
+
class TextureSettings(SettingsModel):
|
116
|
+
"""Represents the advanced settings for texture component.
|
117
|
+
|
118
|
+
Attributes:
|
119
|
+
dissolve (bool): dissolve the texture into several images.
|
120
|
+
fields_padding (int): padding around the fields.
|
121
|
+
skip_drains (bool): skip drains generation.
|
122
|
+
"""
|
123
|
+
|
124
|
+
dissolve: bool = False
|
125
|
+
fields_padding: int = 0
|
126
|
+
skip_drains: bool = False
|
127
|
+
|
128
|
+
|
129
|
+
class SplineSettings(SettingsModel):
|
130
|
+
"""Represents the advanced settings for spline component.
|
131
|
+
|
132
|
+
Attributes:
|
133
|
+
spline_density (int): the number of extra points that will be added between each two
|
134
|
+
existing points.
|
135
|
+
"""
|
136
|
+
|
137
|
+
spline_density: int = 2
|
138
|
+
|
139
|
+
|
140
|
+
class SatelliteSettings(SettingsModel):
|
141
|
+
"""Represents the advanced settings for satellite component.
|
142
|
+
|
143
|
+
Attributes:
|
144
|
+
download_images (bool): download satellite images.
|
145
|
+
margin (int): margin around the map.
|
146
|
+
"""
|
147
|
+
|
148
|
+
download_images: bool = False
|
149
|
+
satellite_margin: int = 100
|
150
|
+
zoom_level: int = 14
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: maps4fs
|
3
|
-
Version: 1.5.
|
3
|
+
Version: 1.5.7
|
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
|
@@ -75,6 +75,8 @@ Requires-Dist: pydantic
|
|
75
75
|
🌲 Automatically generates forests 🆕<br>
|
76
76
|
🌊 Automatically generates water planes 🆕<br>
|
77
77
|
📈 Automatically generates splines 🆕<br>
|
78
|
+
🛰️ Automatically downloads high resolution satellite images 🆕<br>
|
79
|
+
🏔️ Allows to use multiple DTM providers for elevation models 🆕<br>
|
78
80
|
🌍 Based on real-world data from OpenStreetMap<br>
|
79
81
|
🗺️ Supports [custom OSM maps](/docs/custom_osm.md)<br>
|
80
82
|
🏞️ Generates height map using SRTM dataset<br>
|
@@ -473,8 +475,6 @@ You can also apply some advanced settings to the map generation process. Note th
|
|
473
475
|
|
474
476
|
### DEM Advanced settings
|
475
477
|
|
476
|
-
- Auto process: the tool will automatically try to find suitable multiplier. As a result, the DEM image WILL not match real world values. If this option is disabled, you'll probably see completely black DEM image, but it's not empty. It's just you can't see the values of 16-bit image by eye, because they're too small. Learn more what's DEM image and how to work with it in [docs](docs/dem.md). By default, it's set to True.
|
477
|
-
|
478
478
|
- Multiplier: the height of the map is multiplied by this value. So the DEM map is just a 16-bit grayscale image, which means that the maximum available value there is 65535, while the actual difference between the deepest and the highest point on Earth is about 20 km. Just note that this setting mostly does not matter, because you can always adjust it in the Giants Editor, learn more about the DEM file and the heightScale parameter in [docs](docs/dem.md). By default, it's set to 1.
|
479
479
|
|
480
480
|
- Blur radius: the radius of the Gaussian blur filter applied to the DEM map. By default, it's set to 21. This filter just makes the DEM map smoother, so the height transitions will be more natural. You can set it to 1 to disable the filter, but it will result in a Minecraft-like map.
|
@@ -511,10 +511,16 @@ You can also apply some advanced settings to the map generation process. Note th
|
|
511
511
|
|
512
512
|
- Skip drains - if enabled, the tool will not generate the drains and ditches on the map. By default, it's set to False. Use this if you don't need the drains on the map.
|
513
513
|
|
514
|
-
|
514
|
+
### Splines Advanced settings
|
515
515
|
|
516
516
|
- Splines density - number of points, which will be added (interpolate) between each pair of existing points. The higher the value, the denser the spline will be. It can smooth the splines, but high values can in opposite make the splines look unnatural.
|
517
517
|
|
518
|
+
### Satellite Advanced settings
|
519
|
+
|
520
|
+
- Download images - if enabled, the tool will download the satellite images for the background terrain and the overview image. If you already have the images, you can turn it off.
|
521
|
+
- Satellite margin - the margin around the map in meters. It's useful when you want to have some space around the map on the satellite images. By default, it's set to 100.
|
522
|
+
- Zoom level - the zoom level of the satellite images. The higher the value, the more detailed the images will be. By default, it's set to 14 and this option is disabled on a public version of the app.
|
523
|
+
|
518
524
|
## Expert Settings
|
519
525
|
The tool also supports the expert settings. Do not use them until you read the documentation and understand what they do. Here's the list of the expert settings:
|
520
526
|
|
@@ -555,3 +561,4 @@ But also, I want to thank the people who helped me with the project in some way,
|
|
555
561
|
- [Tox3](https://github.com/Tox3) - for the manual tests of the app.
|
556
562
|
- [Lucandia](https://github.com/Lucandia) - for the awesome StreamLit [widget to preview STL files](https://github.com/Lucandia/streamlit_stl).
|
557
563
|
- [H4rdB4se](https://github.com/H4rdB4se) - for investigating the issue with custom OSM files and finding a proper way to work with the files in JOSM.
|
564
|
+
- [kbrandwijk](https://github.com/kbrandwijk) - for providing [awesome tool](https://github.com/Paint-a-Farm/satmap_downloader) to download the satellite images from the Google Maps and giving a permission to modify it and create a Python Package.
|
@@ -0,0 +1,24 @@
|
|
1
|
+
maps4fs/__init__.py,sha256=EJzbqRrSGltSMUI-dHgONODxKt9YvP_ElwFmXV8M_MA,380
|
2
|
+
maps4fs/logger.py,sha256=B-NEYpMjPAAqlV4VpfTi6nbBFnEABVtQOaYe6nMpidg,1489
|
3
|
+
maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
|
4
|
+
maps4fs/generator/background.py,sha256=moTsEJM-hZgHQQiBjFVTWBKgPMqxup-58EErh4bq_dE,21342
|
5
|
+
maps4fs/generator/component.py,sha256=RtXruvT4Fxfr7_xo9Bi-i3IIWcPd5QQOSpYJ_cNC49o,20408
|
6
|
+
maps4fs/generator/config.py,sha256=0QmK052B8bxyHVhg3jzCORLfOBMMmqVfhhbqXKf6OMk,4383
|
7
|
+
maps4fs/generator/dem.py,sha256=shyehXYXXog9ZTdi_8Y1WAnmhsL4-YAIZ3EpmGy8qeA,12300
|
8
|
+
maps4fs/generator/dtm.py,sha256=5_1e-kQcZ7c1Xg3tvuTyumzfTAcUPmDkIyZd5VagyOk,10550
|
9
|
+
maps4fs/generator/game.py,sha256=QHgVnyGYvEnfwGZ84-u-dpbCRr3UeVVqBbrwr5WG8dE,7992
|
10
|
+
maps4fs/generator/grle.py,sha256=u8ZwSs313PIOkH_0B_O2tVTaZ-eYNkc30eKGtBxWzTM,17846
|
11
|
+
maps4fs/generator/i3d.py,sha256=FLVlj0g90IXRuaRARD1HTnufsLpuaa5kHKdiME-LUZY,24329
|
12
|
+
maps4fs/generator/map.py,sha256=flU0b2TrVYLxj9o3v_YRvNz9YB3s4w6YFSv4Jka5ojM,9283
|
13
|
+
maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
|
14
|
+
maps4fs/generator/satellite.py,sha256=Qnb6XxmXKnHdHKVMb9mJ3vDGtGkDHCOv_81hrrXdx3k,3660
|
15
|
+
maps4fs/generator/settings.py,sha256=NWuK76ICr8gURQnzePat4JH9w-iACbQEKQebqu51gBE,4470
|
16
|
+
maps4fs/generator/texture.py,sha256=sErusfv1AqQfP-veMrZ921Tz8DnGEhfB4ucggMmKrD4,31231
|
17
|
+
maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
|
18
|
+
maps4fs/toolbox/background.py,sha256=9BXWNqs_n3HgqDiPztWylgYk_QM4YgBpe6_ZNQAWtSc,2154
|
19
|
+
maps4fs/toolbox/dem.py,sha256=z9IPFNmYbjiigb3t02ZenI3Mo8odd19c5MZbjDEovTo,3525
|
20
|
+
maps4fs-1.5.7.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
|
21
|
+
maps4fs-1.5.7.dist-info/METADATA,sha256=pIrqQEpHgaljNNzjl297anHnHS2jMruuNeBKyX9iGME,35585
|
22
|
+
maps4fs-1.5.7.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
23
|
+
maps4fs-1.5.7.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
|
24
|
+
maps4fs-1.5.7.dist-info/RECORD,,
|
maps4fs-1.5.0.dist-info/RECORD
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
maps4fs/__init__.py,sha256=LMzzORK3Q3OjXmmRJ03CpS2SMP6zTwKNnUUei3P7s40,300
|
2
|
-
maps4fs/logger.py,sha256=B-NEYpMjPAAqlV4VpfTi6nbBFnEABVtQOaYe6nMpidg,1489
|
3
|
-
maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
|
4
|
-
maps4fs/generator/background.py,sha256=ySABP9HLji8R0aXi1BwjUQtP2uDqZPkrlmugowa9Gkk,22836
|
5
|
-
maps4fs/generator/component.py,sha256=58UQgdR-7KlWHTfwLesNNK76BTRsiVngRa6B64OKjhc,20065
|
6
|
-
maps4fs/generator/config.py,sha256=0QmK052B8bxyHVhg3jzCORLfOBMMmqVfhhbqXKf6OMk,4383
|
7
|
-
maps4fs/generator/dem.py,sha256=MZf3ZjawJ977TxqB1q9nNpvPZUNwfmm2EaJDtVU-eCU,15939
|
8
|
-
maps4fs/generator/game.py,sha256=jjo7CTwHHSkRpeD_QgRXkhR_NxI09C4kMxz-nYOTM4A,7931
|
9
|
-
maps4fs/generator/grle.py,sha256=u8ZwSs313PIOkH_0B_O2tVTaZ-eYNkc30eKGtBxWzTM,17846
|
10
|
-
maps4fs/generator/i3d.py,sha256=qeZYqfuhbhRPlSAuQHXaq6RmIO7314oMN68Ivebp1YQ,24786
|
11
|
-
maps4fs/generator/map.py,sha256=jIdekpiymhHqKx4FaAwjtq3hMnRdKYo6TvJLX1fSD0k,12814
|
12
|
-
maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
|
13
|
-
maps4fs/generator/texture.py,sha256=sErusfv1AqQfP-veMrZ921Tz8DnGEhfB4ucggMmKrD4,31231
|
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.5.0.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
|
18
|
-
maps4fs-1.5.0.dist-info/METADATA,sha256=JZXcCZU91J0GD2q1YKooz_52UeA8DeCgbuv2zRrnTsQ,35026
|
19
|
-
maps4fs-1.5.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
20
|
-
maps4fs-1.5.0.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
|
21
|
-
maps4fs-1.5.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|