maps4fs 0.9.93__py3-none-any.whl → 1.1.6__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.
@@ -1,83 +0,0 @@
1
- """This module contains functions and clas for generating path steps."""
2
-
3
- from typing import NamedTuple
4
-
5
- from geopy.distance import distance # type: ignore
6
-
7
- DEFAULT_DISTANCE = 2048
8
- PATH_FULL_NAME = "FULL"
9
-
10
-
11
- class PathStep(NamedTuple):
12
- """Represents parameters of one step in the path.
13
-
14
- Attributes:
15
- code {str} -- Tile code (N, NE, E, SE, S, SW, W, NW).
16
- angle {int} -- Angle in degrees (for example 0 for North, 90 for East).
17
- If None, the step is a full map with a center at the same coordinates as the
18
- map itself.
19
- distance {int} -- Distance in meters from previous step.
20
- If None, the step is a full map with a center at the same coordinates as the
21
- map itself.
22
- size {tuple[int, int]} -- Size of the tile in pixels (width, height).
23
- """
24
-
25
- code: str
26
- angle: int | None
27
- distance: int | None
28
- size: tuple[int, int]
29
-
30
- def get_destination(self, origin: tuple[float, float]) -> tuple[float, float]:
31
- """Calculate destination coordinates based on origin and step parameters.
32
-
33
- Arguments:
34
- origin {tuple[float, float]} -- Origin coordinates (latitude, longitude)
35
-
36
- Returns:
37
- tuple[float, float] -- Destination coordinates (latitude, longitude)
38
- """
39
- destination = distance(meters=self.distance).destination(origin, self.angle)
40
- return destination.latitude, destination.longitude
41
-
42
-
43
- def get_steps(map_height: int, map_width: int) -> list[PathStep]:
44
- """Return a list of PathStep objects for each tile, which represent a step in the path.
45
- Moving from the center of the map to North, then clockwise.
46
-
47
- Arguments:
48
- map_height {int} -- Height of the map in pixels
49
- map_width {int} -- Width of the map in pixels
50
-
51
- Returns:
52
- list[PathStep] -- List of PathStep objects
53
- """
54
- # Move clockwise from N and calculate coordinates and sizes for each tile.
55
- half_width = int(map_width / 2)
56
- half_height = int(map_height / 2)
57
-
58
- half_default_distance = int(DEFAULT_DISTANCE / 2)
59
-
60
- return [
61
- PathStep("N", 0, half_height + half_default_distance, (map_width, DEFAULT_DISTANCE)),
62
- PathStep(
63
- "NE", 90, half_width + half_default_distance, (DEFAULT_DISTANCE, DEFAULT_DISTANCE)
64
- ),
65
- PathStep("E", 180, half_height + half_default_distance, (DEFAULT_DISTANCE, map_height)),
66
- PathStep(
67
- "SE", 180, half_height + half_default_distance, (DEFAULT_DISTANCE, DEFAULT_DISTANCE)
68
- ),
69
- PathStep("S", 270, half_width + half_default_distance, (map_width, DEFAULT_DISTANCE)),
70
- PathStep(
71
- "SW", 270, half_width + half_default_distance, (DEFAULT_DISTANCE, DEFAULT_DISTANCE)
72
- ),
73
- PathStep("W", 0, half_height + half_default_distance, (DEFAULT_DISTANCE, map_height)),
74
- PathStep(
75
- "NW", 0, half_height + half_default_distance, (DEFAULT_DISTANCE, DEFAULT_DISTANCE)
76
- ),
77
- PathStep(
78
- PATH_FULL_NAME,
79
- None,
80
- None,
81
- (map_width + DEFAULT_DISTANCE * 2, map_height + DEFAULT_DISTANCE * 2),
82
- ),
83
- ]
maps4fs/generator/tile.py DELETED
@@ -1,55 +0,0 @@
1
- """This module contains the Tile component, which is used to generate a tile of DEM data around
2
- the map."""
3
-
4
- import os
5
-
6
- from maps4fs.generator.dem import DEM
7
-
8
-
9
- class Tile(DEM):
10
- """Component for creating a tile of DEM data around the map.
11
-
12
- Arguments:
13
- coordinates (tuple[float, float]): The latitude and longitude of the center of the map.
14
- map_height (int): The height of the map in pixels.
15
- map_width (int): The width of the map in pixels.
16
- map_directory (str): The directory where the map files are stored.
17
- logger (Any, optional): The logger to use. Must have at least three basic methods: debug,
18
- info, warning. If not provided, default logging will be used.
19
-
20
- Keyword Arguments:
21
- tile_code (str): The code of the tile (N, NE, E, SE, S, SW, W, NW).
22
-
23
- Public Methods:
24
- get_output_resolution: Return the resolution of the output image.
25
- process: Launch the component processing.
26
- make_copy: Override the method to prevent copying the tile.
27
- """
28
-
29
- def preprocess(self) -> None:
30
- """Prepares the component for processing. Reads the tile code from the kwargs and sets the
31
- DEM path for the tile."""
32
- super().preprocess()
33
- self.code = self.kwargs.get("tile_code")
34
- if not self.code:
35
- raise ValueError("Tile code was not provided")
36
-
37
- self.logger.debug(f"Generating tile {self.code}")
38
-
39
- tiles_directory = os.path.join(self.map_directory, "objects", "tiles")
40
- os.makedirs(tiles_directory, exist_ok=True)
41
-
42
- self._dem_path = os.path.join(tiles_directory, f"{self.code}.png")
43
- self.logger.debug(f"DEM path for tile {self.code} is {self._dem_path}")
44
-
45
- def get_output_resolution(self) -> tuple[int, int]:
46
- """Return the resolution of the output image.
47
-
48
- Returns:
49
- tuple[int, int]: The width and height of the output image.
50
- """
51
- return self.map_width, self.map_height
52
-
53
- def make_copy(self, *args, **kwargs) -> None:
54
- """Override the method to prevent copying the tile."""
55
- pass # pylint: disable=unnecessary-pass
@@ -1,21 +0,0 @@
1
- # MIT License
2
-
3
- Copyright © [2024] [iwatkot]
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,21 +0,0 @@
1
- maps4fs/__init__.py,sha256=da4jmND2Ths9AffnkAKgzLHNkvKFOc_l21gJisPXqWY,155
2
- maps4fs/logger.py,sha256=8oZzAKJllilYrVp452LX0zx-dNFwpS6UngbTrI6KfwA,2148
3
- maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
4
- maps4fs/generator/background.py,sha256=AP-Z3F-4I9achvA9xsaXAAoA6IHtmPLxb1RkUsVYdbg,14036
5
- maps4fs/generator/component.py,sha256=ZEDjChPnvqAsgnBu2f2YBOlwGOlfax4VaAYBcJerLIQ,10684
6
- maps4fs/generator/config.py,sha256=ZO5BWDU-S3p0-ndKDSFa8Oin3YcYy0iH8B4lqEA_07Q,4275
7
- maps4fs/generator/dem.py,sha256=2hqkNfJpMJ3rNUK5Mi1OoWzMaaDfycwr7Okb19PyF4M,17142
8
- maps4fs/generator/game.py,sha256=94HjPNOyy6XSSOnBp-uxrkBglKyC-X3ULIrrucfdlKw,6825
9
- maps4fs/generator/i3d.py,sha256=UuQiQRusPQ2f6PvGKxJ_UZeXsx3uG15efmy8Ysnm3F8,3597
10
- maps4fs/generator/map.py,sha256=_LQe54KLfS_4M462UiiNSqKyUroqnQ8inwXZIZDP9a0,4487
11
- maps4fs/generator/path_steps.py,sha256=yeN6hmOD8O2LMozUf4HcQMIy8WJ5sHF5pGQT_s2FfOw,3147
12
- maps4fs/generator/qgis.py,sha256=R5Iv3ovyLXkhAL5Oy41u3ZLNOSEbc1byLetzPootO7o,6091
13
- maps4fs/generator/texture.py,sha256=CwaXZfAG4e3D3YR7yVR2MC677EHpbUWTboCS3G6jkhk,17723
14
- maps4fs/generator/tile.py,sha256=3vmfjQiPiiUZKPuIo5tg2rOKkgcP1NRVkMGK-Vo10-A,2138
15
- maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
16
- maps4fs/toolbox/dem.py,sha256=53KVZ6IKIlK642eYFSRDAC8l2HL9IEUpQNYkkTC56uU,3510
17
- maps4fs-0.9.93.dist-info/LICENSE.md,sha256=-JY0v7p3dwXze61EbYiK7YEJ2aKrjaFZ8y2xYEOrmRY,1068
18
- maps4fs-0.9.93.dist-info/METADATA,sha256=PMRKQfiPBp67jkCY1JLOx_jTMIU6OLE_f7kpsuWINEk,25194
19
- maps4fs-0.9.93.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
20
- maps4fs-0.9.93.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
21
- maps4fs-0.9.93.dist-info/RECORD,,