maps4fs 1.8.251__py3-none-any.whl → 1.9.0__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/component/background.py +1 -1
- maps4fs/generator/component/base/component_image.py +23 -0
- maps4fs/generator/{dem.py → component/dem.py} +3 -32
- maps4fs/generator/component/grle.py +10 -6
- {maps4fs-1.8.251.dist-info → maps4fs-1.9.0.dist-info}/METADATA +1 -1
- {maps4fs-1.8.251.dist-info → maps4fs-1.9.0.dist-info}/RECORD +9 -9
- {maps4fs-1.8.251.dist-info → maps4fs-1.9.0.dist-info}/WHEEL +1 -1
- {maps4fs-1.8.251.dist-info → maps4fs-1.9.0.dist-info}/licenses/LICENSE.md +0 -0
- {maps4fs-1.8.251.dist-info → maps4fs-1.9.0.dist-info}/top_level.txt +0 -0
@@ -15,8 +15,8 @@ from trimesh import Trimesh
|
|
15
15
|
|
16
16
|
from maps4fs.generator.component.base.component_image import ImageComponent
|
17
17
|
from maps4fs.generator.component.base.component_mesh import MeshComponent
|
18
|
+
from maps4fs.generator.component.dem import DEM
|
18
19
|
from maps4fs.generator.component.texture import Texture
|
19
|
-
from maps4fs.generator.dem import DEM
|
20
20
|
from maps4fs.generator.settings import Parameters
|
21
21
|
|
22
22
|
|
@@ -138,3 +138,26 @@ class ImageComponent(Component):
|
|
138
138
|
if dst_image is not None:
|
139
139
|
dst_image[border_slice][src_image[border_slice] != 0] = 255
|
140
140
|
src_image[border_slice] = 0
|
141
|
+
|
142
|
+
def apply_blur(
|
143
|
+
self, data: np.ndarray, blur_radius: int, sigma_x: int = 10, sigma_y: int = 10
|
144
|
+
) -> np.ndarray:
|
145
|
+
"""Apply blur to DEM data.
|
146
|
+
|
147
|
+
Arguments:
|
148
|
+
data (np.ndarray): DEM data.
|
149
|
+
blur_radius (int): Radius of the blur.
|
150
|
+
sigma_x (int, optional): Standard deviation in X direction. Defaults to 10.
|
151
|
+
sigma_y (int, optional): Standard deviation in Y direction. Defaults to 10.
|
152
|
+
|
153
|
+
Returns:
|
154
|
+
np.ndarray: Blurred DEM data.
|
155
|
+
"""
|
156
|
+
if blur_radius == 0:
|
157
|
+
return data
|
158
|
+
|
159
|
+
blurred_data = cv2.GaussianBlur(
|
160
|
+
data, (blur_radius, blur_radius), sigmaX=sigma_x, sigmaY=sigma_y
|
161
|
+
)
|
162
|
+
|
163
|
+
return blurred_data
|
@@ -9,12 +9,12 @@ import numpy as np
|
|
9
9
|
# import rasterio # type: ignore
|
10
10
|
from pympler import asizeof # type: ignore
|
11
11
|
|
12
|
-
from maps4fs.generator.component.base.
|
12
|
+
from maps4fs.generator.component.base.component_image import ImageComponent
|
13
13
|
from maps4fs.generator.dtm.dtm import DTMProvider
|
14
14
|
|
15
15
|
|
16
16
|
# pylint: disable=R0903, R0902
|
17
|
-
class DEM(
|
17
|
+
class DEM(ImageComponent):
|
18
18
|
"""Component for processing Digital Elevation Model data.
|
19
19
|
|
20
20
|
Arguments:
|
@@ -200,7 +200,7 @@ class DEM(Component):
|
|
200
200
|
self.update_info("normalized", resampled_data)
|
201
201
|
|
202
202
|
# 6. Blur DEM data.
|
203
|
-
resampled_data = self.apply_blur(resampled_data)
|
203
|
+
resampled_data = self.apply_blur(resampled_data, blur_radius=self.blur_radius)
|
204
204
|
|
205
205
|
cv2.imwrite(self._dem_path, resampled_data)
|
206
206
|
self.logger.debug("DEM data was saved to %s.", self._dem_path)
|
@@ -316,35 +316,6 @@ class DEM(Component):
|
|
316
316
|
|
317
317
|
return resampled_data
|
318
318
|
|
319
|
-
def apply_blur(self, data: np.ndarray) -> np.ndarray:
|
320
|
-
"""Apply blur to DEM data.
|
321
|
-
|
322
|
-
Arguments:
|
323
|
-
data (np.ndarray): DEM data.
|
324
|
-
|
325
|
-
Returns:
|
326
|
-
np.ndarray: Blurred DEM data.
|
327
|
-
"""
|
328
|
-
if self.blur_radius == 0:
|
329
|
-
return data
|
330
|
-
|
331
|
-
self.logger.debug(
|
332
|
-
"Applying Gaussion blur to DEM data with kernel size %s.",
|
333
|
-
self.blur_radius,
|
334
|
-
)
|
335
|
-
|
336
|
-
blurred_data = cv2.GaussianBlur(
|
337
|
-
data, (self.blur_radius, self.blur_radius), sigmaX=10, sigmaY=10
|
338
|
-
)
|
339
|
-
self.logger.debug(
|
340
|
-
"DEM data was blurred. Shape: %s, dtype: %s. Min: %s, max: %s.",
|
341
|
-
blurred_data.shape,
|
342
|
-
blurred_data.dtype,
|
343
|
-
blurred_data.min(),
|
344
|
-
blurred_data.max(),
|
345
|
-
)
|
346
|
-
return blurred_data
|
347
|
-
|
348
319
|
def rotate_dem(self) -> None:
|
349
320
|
"""Rotate DEM image."""
|
350
321
|
self.logger.debug("Rotating DEM image by %s degrees.", self.rotation)
|
@@ -173,18 +173,22 @@ class GRLE(ImageComponent, XMLComponent):
|
|
173
173
|
def _add_farmlands(self) -> None:
|
174
174
|
"""Adds farmlands to the InfoLayer PNG file."""
|
175
175
|
farmlands = []
|
176
|
+
|
177
|
+
fields = self.get_infolayer_data(Parameters.TEXTURES, Parameters.FIELDS)
|
178
|
+
if fields:
|
179
|
+
self.logger.debug("Found %s fields in textures info layer.", len(fields))
|
180
|
+
farmlands.extend(fields)
|
181
|
+
|
176
182
|
farmyards = self.get_infolayer_data(Parameters.TEXTURES, Parameters.FARMYARDS)
|
177
183
|
if farmyards and self.map.grle_settings.add_farmyards:
|
178
184
|
farmlands.extend(farmyards)
|
179
185
|
self.logger.debug("Found %s farmyards in textures info layer.", len(farmyards))
|
180
186
|
|
181
|
-
|
182
|
-
|
183
|
-
|
187
|
+
if not farmlands:
|
188
|
+
self.logger.warning(
|
189
|
+
"No farmlands was obtained from fields or farmyards, skipping the processing."
|
190
|
+
)
|
184
191
|
return
|
185
|
-
farmlands.extend(fields)
|
186
|
-
|
187
|
-
self.logger.debug("Found %s fields in textures info layer.", len(fields))
|
188
192
|
|
189
193
|
info_layer_farmlands_path = self.game.get_farmlands_path(self.map_directory)
|
190
194
|
|
@@ -1,23 +1,23 @@
|
|
1
1
|
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
|
-
maps4fs/generator/dem.py,sha256=CDfdDGCWhFn2_QYY5TtxgsXm3lgJ4W4qD-46UU3u-ck,13207
|
5
4
|
maps4fs/generator/game.py,sha256=NZaxj5z7WzMiHzAvQyr-TvVjGoHgqGldM6ZsItuYyzA,11292
|
6
5
|
maps4fs/generator/map.py,sha256=64uIHCwfpFyFXZJSayB0tuRFn0LVuTwf0wrAi4KMv00,13600
|
7
6
|
maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
|
8
7
|
maps4fs/generator/settings.py,sha256=E5sfkfJgcjh9QHpa7ILlV_jnrF6USpsOFxkooVnxrbs,6968
|
9
8
|
maps4fs/generator/statistics.py,sha256=aynS3zbAtiwnU_YLKHPTiiaKW98_suvQUhy1SGBA6mc,2448
|
10
9
|
maps4fs/generator/component/__init__.py,sha256=s01yVVVi8R2xxNvflu2D6wTd9I_g73AMM2x7vAC7GX4,490
|
11
|
-
maps4fs/generator/component/background.py,sha256=
|
10
|
+
maps4fs/generator/component/background.py,sha256=_QK9pqWs5SeJFljOJS8woImK7kkU37ZIo4QMux4dACw,22862
|
12
11
|
maps4fs/generator/component/config.py,sha256=RitKgFDZPzjA1fi8GcEi1na75qqaueUvpcITHjBvCXc,3674
|
13
|
-
maps4fs/generator/component/
|
12
|
+
maps4fs/generator/component/dem.py,sha256=zUKRwVT5DC5VpZMo79zKipxGW0Waw0Pxn10RIEB3wrQ,12430
|
13
|
+
maps4fs/generator/component/grle.py,sha256=99CFheRn2aDuE041iZj2usmh5spKSryKg3L848jVWdg,19475
|
14
14
|
maps4fs/generator/component/i3d.py,sha256=iVXYYGzDpSp5J7vAo_LFnDA8GDAy43Y6aUIf7yP_ZTI,23101
|
15
15
|
maps4fs/generator/component/layer.py,sha256=hbTBMLamKOWv_MXbnk-LjLyNV91jPsF33UEc17rBZCM,6185
|
16
16
|
maps4fs/generator/component/satellite.py,sha256=oZBHjP_QY0ik1-Vk7JqMS__zIG8ffw2voeozB7-HUQc,4946
|
17
17
|
maps4fs/generator/component/texture.py,sha256=ELU5QwysZaMPH9QQkE5jzIHAOzZ_Y8khcT9ruZuxQpQ,31803
|
18
18
|
maps4fs/generator/component/base/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
|
19
19
|
maps4fs/generator/component/base/component.py,sha256=CIR4Fjn9YfLU4y7nB_jOaz7PjGFvBcDnHlvXxeahpdM,21499
|
20
|
-
maps4fs/generator/component/base/component_image.py,sha256=
|
20
|
+
maps4fs/generator/component/base/component_image.py,sha256=AMYrStFSfeE_G34JKN5CJFFB6ZCTof-fJwMVKq3Y2H4,5521
|
21
21
|
maps4fs/generator/component/base/component_mesh.py,sha256=BsxS5NlUK2hLhksgCwSoMK-00GNAwK2fYGpgb3R4n1w,9396
|
22
22
|
maps4fs/generator/component/base/component_xml.py,sha256=6OO1dKoceO1ACk7-k1oGtnkfNud8ZN3u3ZNjdNMpTqw,3967
|
23
23
|
maps4fs/generator/dtm/__init__.py,sha256=CzK8ZdLU5Iv7DrwK5hIQ41zVsLRFgZO-IuRxf-NCVqg,1516
|
@@ -54,8 +54,8 @@ maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,4
|
|
54
54
|
maps4fs/toolbox/background.py,sha256=RclEqxEWLbMxuEkkegQP8jybzugwQ1_R3rdfDe0s21U,2104
|
55
55
|
maps4fs/toolbox/custom_osm.py,sha256=X6ZlPqiOhNjkmdD_qVroIfdOl9Rb90cDwVSLDVYgx80,1892
|
56
56
|
maps4fs/toolbox/dem.py,sha256=z9IPFNmYbjiigb3t02ZenI3Mo8odd19c5MZbjDEovTo,3525
|
57
|
-
maps4fs-1.
|
58
|
-
maps4fs-1.
|
59
|
-
maps4fs-1.
|
60
|
-
maps4fs-1.
|
61
|
-
maps4fs-1.
|
57
|
+
maps4fs-1.9.0.dist-info/licenses/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
|
58
|
+
maps4fs-1.9.0.dist-info/METADATA,sha256=Wd59mYegea9cIBPQSnHkHy_dIiDGttopm-vEcwYLyQM,47441
|
59
|
+
maps4fs-1.9.0.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
60
|
+
maps4fs-1.9.0.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
|
61
|
+
maps4fs-1.9.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|