maps4fs 1.8.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- maps4fs/__init__.py +22 -0
- maps4fs/generator/__init__.py +1 -0
- maps4fs/generator/background.py +625 -0
- maps4fs/generator/component.py +553 -0
- maps4fs/generator/config.py +109 -0
- maps4fs/generator/dem.py +297 -0
- maps4fs/generator/dtm/__init__.py +0 -0
- maps4fs/generator/dtm/base/wcs.py +71 -0
- maps4fs/generator/dtm/base/wms.py +70 -0
- maps4fs/generator/dtm/bavaria.py +113 -0
- maps4fs/generator/dtm/dtm.py +637 -0
- maps4fs/generator/dtm/england.py +31 -0
- maps4fs/generator/dtm/hessen.py +31 -0
- maps4fs/generator/dtm/niedersachsen.py +39 -0
- maps4fs/generator/dtm/nrw.py +30 -0
- maps4fs/generator/dtm/srtm.py +127 -0
- maps4fs/generator/dtm/usgs.py +87 -0
- maps4fs/generator/dtm/utils.py +61 -0
- maps4fs/generator/game.py +247 -0
- maps4fs/generator/grle.py +470 -0
- maps4fs/generator/i3d.py +624 -0
- maps4fs/generator/map.py +275 -0
- maps4fs/generator/qgis.py +196 -0
- maps4fs/generator/satellite.py +92 -0
- maps4fs/generator/settings.py +187 -0
- maps4fs/generator/texture.py +893 -0
- maps4fs/logger.py +46 -0
- maps4fs/toolbox/__init__.py +1 -0
- maps4fs/toolbox/background.py +63 -0
- maps4fs/toolbox/custom_osm.py +67 -0
- maps4fs/toolbox/dem.py +112 -0
- maps4fs-1.8.0.dist-info/LICENSE.md +190 -0
- maps4fs-1.8.0.dist-info/METADATA +693 -0
- maps4fs-1.8.0.dist-info/RECORD +36 -0
- maps4fs-1.8.0.dist-info/WHEEL +5 -0
- maps4fs-1.8.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,187 @@
|
|
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, ConfigDict
|
8
|
+
|
9
|
+
|
10
|
+
class SharedSettings(BaseModel):
|
11
|
+
"""Represents the shared settings for all components."""
|
12
|
+
|
13
|
+
mesh_z_scaling_factor: float | None = None
|
14
|
+
height_scale_multiplier: float | None = None
|
15
|
+
height_scale_value: float | None = None
|
16
|
+
change_height_scale: bool = False
|
17
|
+
|
18
|
+
model_config = ConfigDict(
|
19
|
+
frozen=False,
|
20
|
+
)
|
21
|
+
|
22
|
+
|
23
|
+
class SettingsModel(BaseModel):
|
24
|
+
"""Base class for settings models. It provides methods to convert settings to and from JSON."""
|
25
|
+
|
26
|
+
model_config = ConfigDict(
|
27
|
+
frozen=False,
|
28
|
+
)
|
29
|
+
|
30
|
+
@classmethod
|
31
|
+
def all_settings_to_json(cls) -> dict[str, dict[str, Any]]:
|
32
|
+
"""Get all settings of the current class and its subclasses as a dictionary.
|
33
|
+
|
34
|
+
Returns:
|
35
|
+
dict[str, dict[str, Any]]: Dictionary with settings of the current class and its
|
36
|
+
subclasses.
|
37
|
+
"""
|
38
|
+
all_settings = {}
|
39
|
+
for subclass in cls.__subclasses__():
|
40
|
+
all_settings[subclass.__name__] = subclass().model_dump()
|
41
|
+
|
42
|
+
return all_settings
|
43
|
+
|
44
|
+
@classmethod
|
45
|
+
def all_settings_from_json(
|
46
|
+
cls, data: dict, flattening: bool = True
|
47
|
+
) -> dict[str, SettingsModel]:
|
48
|
+
"""Create settings instances from JSON data.
|
49
|
+
|
50
|
+
Arguments:
|
51
|
+
data (dict): JSON data.
|
52
|
+
flattening (bool): if set to True will flattet iterables to use the first element
|
53
|
+
of it.
|
54
|
+
|
55
|
+
Returns:
|
56
|
+
dict[str, Type[SettingsModel]]: Dictionary with settings instances.
|
57
|
+
"""
|
58
|
+
settings = {}
|
59
|
+
for subclass in cls.__subclasses__():
|
60
|
+
subclass_data = data[subclass.__name__]
|
61
|
+
if flattening:
|
62
|
+
for key, value in subclass_data.items():
|
63
|
+
if isinstance(value, (list, tuple)):
|
64
|
+
subclass_data[key] = value[0]
|
65
|
+
|
66
|
+
settings[subclass.__name__] = subclass(**subclass_data)
|
67
|
+
|
68
|
+
return settings
|
69
|
+
|
70
|
+
@classmethod
|
71
|
+
def all_settings(cls) -> list[SettingsModel]:
|
72
|
+
"""Get all settings of the current class and its subclasses.
|
73
|
+
|
74
|
+
Returns:
|
75
|
+
list[SettingsModel]: List with settings of the current class and its subclasses.
|
76
|
+
"""
|
77
|
+
settings = []
|
78
|
+
for subclass in cls.__subclasses__():
|
79
|
+
settings.append(subclass())
|
80
|
+
|
81
|
+
return settings
|
82
|
+
|
83
|
+
|
84
|
+
class DEMSettings(SettingsModel):
|
85
|
+
"""Represents the advanced settings for DEM component.
|
86
|
+
|
87
|
+
Attributes:
|
88
|
+
multiplier (int): multiplier for the heightmap, every pixel will be multiplied by this
|
89
|
+
value.
|
90
|
+
blur_radius (int): radius of the blur filter.
|
91
|
+
plateau (int): plateau height, will be added to each pixel.
|
92
|
+
water_depth (int): water depth, will be subtracted from each pixel where the water
|
93
|
+
is present.
|
94
|
+
"""
|
95
|
+
|
96
|
+
multiplier: int = 1
|
97
|
+
blur_radius: int = 35
|
98
|
+
plateau: int = 0
|
99
|
+
water_depth: int = 0
|
100
|
+
|
101
|
+
|
102
|
+
class BackgroundSettings(SettingsModel):
|
103
|
+
"""Represents the advanced settings for background component.
|
104
|
+
|
105
|
+
Attributes:
|
106
|
+
generate_background (bool): generate obj files for the background terrain.
|
107
|
+
generate_water (bool): generate obj files for the water.
|
108
|
+
resize_factor (int): resize factor for the background terrain and water.
|
109
|
+
It will be used as 1 / resize_factor of the original size.
|
110
|
+
"""
|
111
|
+
|
112
|
+
generate_background: bool = False
|
113
|
+
generate_water: bool = False
|
114
|
+
resize_factor: int = 8
|
115
|
+
remove_center: bool = False
|
116
|
+
apply_decimation: bool = False
|
117
|
+
decimation_percent: int = 25
|
118
|
+
decimation_agression: int = 3
|
119
|
+
|
120
|
+
|
121
|
+
class GRLESettings(SettingsModel):
|
122
|
+
"""Represents the advanced settings for GRLE component.
|
123
|
+
|
124
|
+
Attributes:
|
125
|
+
farmland_margin (int): margin around the farmland.
|
126
|
+
random_plants (bool): generate random plants on the map or use the default one.
|
127
|
+
add_farmyards (bool): If True, regions of frarmyards will be added to the map
|
128
|
+
without corresponding fields.
|
129
|
+
"""
|
130
|
+
|
131
|
+
farmland_margin: int = 0
|
132
|
+
random_plants: bool = True
|
133
|
+
add_farmyards: bool = False
|
134
|
+
base_grass: tuple | str = ("smallDenseMix", "meadow")
|
135
|
+
plants_island_minimum_size: int = 10
|
136
|
+
plants_island_maximum_size: int = 200
|
137
|
+
plants_island_vertex_count: int = 30
|
138
|
+
plants_island_rounding_radius: int = 15
|
139
|
+
plants_island_percent: int = 100
|
140
|
+
|
141
|
+
|
142
|
+
class I3DSettings(SettingsModel):
|
143
|
+
"""Represents the advanced settings for I3D component.
|
144
|
+
|
145
|
+
Attributes:
|
146
|
+
forest_density (int): density of the forest (distance between trees).
|
147
|
+
"""
|
148
|
+
|
149
|
+
forest_density: int = 10
|
150
|
+
|
151
|
+
|
152
|
+
class TextureSettings(SettingsModel):
|
153
|
+
"""Represents the advanced settings for texture component.
|
154
|
+
|
155
|
+
Attributes:
|
156
|
+
dissolve (bool): dissolve the texture into several images.
|
157
|
+
fields_padding (int): padding around the fields.
|
158
|
+
skip_drains (bool): skip drains generation.
|
159
|
+
"""
|
160
|
+
|
161
|
+
dissolve: bool = False
|
162
|
+
fields_padding: int = 0
|
163
|
+
skip_drains: bool = False
|
164
|
+
|
165
|
+
|
166
|
+
class SplineSettings(SettingsModel):
|
167
|
+
"""Represents the advanced settings for spline component.
|
168
|
+
|
169
|
+
Attributes:
|
170
|
+
spline_density (int): the number of extra points that will be added between each two
|
171
|
+
existing points.
|
172
|
+
"""
|
173
|
+
|
174
|
+
spline_density: int = 2
|
175
|
+
|
176
|
+
|
177
|
+
class SatelliteSettings(SettingsModel):
|
178
|
+
"""Represents the advanced settings for satellite component.
|
179
|
+
|
180
|
+
Attributes:
|
181
|
+
download_images (bool): download satellite images.
|
182
|
+
margin (int): margin around the map.
|
183
|
+
"""
|
184
|
+
|
185
|
+
download_images: bool = False
|
186
|
+
satellite_margin: int = 0
|
187
|
+
zoom_level: int = 14
|