maps4fs 1.7.1__tar.gz → 1.7.2__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.
Files changed (33) hide show
  1. {maps4fs-1.7.1 → maps4fs-1.7.2}/PKG-INFO +48 -20
  2. {maps4fs-1.7.1 → maps4fs-1.7.2}/README.md +47 -19
  3. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/__init__.py +3 -2
  4. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/generator/texture.py +5 -1
  5. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs.egg-info/PKG-INFO +48 -20
  6. {maps4fs-1.7.1 → maps4fs-1.7.2}/pyproject.toml +1 -1
  7. {maps4fs-1.7.1 → maps4fs-1.7.2}/LICENSE.md +0 -0
  8. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/generator/__init__.py +0 -0
  9. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/generator/background.py +0 -0
  10. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/generator/component.py +0 -0
  11. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/generator/config.py +0 -0
  12. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/generator/dem.py +0 -0
  13. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/generator/dtm/__init__.py +0 -0
  14. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/generator/dtm/dtm.py +0 -0
  15. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/generator/dtm/srtm.py +0 -0
  16. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/generator/dtm/usgs.py +0 -0
  17. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/generator/game.py +0 -0
  18. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/generator/grle.py +0 -0
  19. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/generator/i3d.py +0 -0
  20. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/generator/map.py +0 -0
  21. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/generator/qgis.py +0 -0
  22. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/generator/satellite.py +0 -0
  23. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/generator/settings.py +0 -0
  24. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/logger.py +0 -0
  25. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/toolbox/__init__.py +0 -0
  26. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/toolbox/background.py +0 -0
  27. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs/toolbox/dem.py +0 -0
  28. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs.egg-info/SOURCES.txt +0 -0
  29. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs.egg-info/dependency_links.txt +0 -0
  30. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs.egg-info/requires.txt +0 -0
  31. {maps4fs-1.7.1 → maps4fs-1.7.2}/maps4fs.egg-info/top_level.txt +0 -0
  32. {maps4fs-1.7.1 → maps4fs-1.7.2}/setup.cfg +0 -0
  33. {maps4fs-1.7.1 → maps4fs-1.7.2}/tests/test_generator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: maps4fs
3
- Version: 1.7.1
3
+ Version: 1.7.2
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
@@ -141,7 +141,7 @@ Check out the [Docker FAQ](docs/FAQ_docker.md) if you have any questions.<br>
141
141
  ```bash
142
142
  pip install maps4fs
143
143
  ```
144
- And refer to the [Python package](#option-3-python-package) section to learn how to use it.<br>
144
+ And refer to the [Python package or run from the source](#option-3-python-package-or-source-code) section to learn how to use it.<br>
145
145
 
146
146
  ## Overview
147
147
  The core idea is coming from the awesome [maps4cim](https://github.com/klamann/maps4cim) project.<br>
@@ -201,7 +201,7 @@ docker run -d -p 8501:8501 --name maps4fs iwatkot/maps4fs
201
201
  4. Fill in the required fields and click on the `Generate` button.
202
202
  5. When the map is generated click on the `Download` button to get the map.
203
203
 
204
- ### Option 3: Python package
204
+ ### Option 3: Python package or source code
205
205
  🔴 Recommended for developers.
206
206
  🗺️ Supported map sizes: 2x2, 4x4, 8x8, 16x16 km and any custom size.
207
207
  ⚙️ Advanced settings: enabled.
@@ -212,11 +212,50 @@ You can use the Python package to generate maps. Follow these steps:
212
212
  ```bash
213
213
  pip install maps4fs
214
214
  ```
215
+
216
+ Or clone the repository and install the package from the source code:
217
+ ```bash
218
+ git clone https://github.com/iwatkot/maps4fs.git
219
+ cd maps4fs
220
+ dev/create_venv.ps1 # for Windows
221
+ sh dev/create_venv.sh # for Linux
222
+
223
+ # Activate the virtual environment.
224
+ ./venv/scripts/activate # for Windows
225
+ source venv/bin/activate # for Linux
226
+
227
+ # Edit the demo.py file to set the parameters.
228
+ python demo.py
229
+ ```
230
+
231
+
215
232
  2. Import the Game class and create an instance of it:
216
233
  ```python
217
234
  import maps4fs as mfs
218
235
 
219
- game = mfs.Game.from_code("FS25")
236
+ game_code = "fs25"
237
+ game = mfs.Game.from_code(game_code)
238
+
239
+ dtm_provider = mfs.SRTM30Provider
240
+ dtm_provider_settings = mfs.SRTM30ProviderSettings(easy_mode=True, power_factor=0)
241
+
242
+ lat, lon = 45.28, 20.23
243
+ coordinates = (lat, lon)
244
+ size = 2048
245
+ rotation = 25
246
+
247
+ map_directory = "map_directory"
248
+ os.makedirs(map_directory, exist_ok=True)
249
+
250
+ mp = mfs.Map(
251
+ game,
252
+ dtm_provider,
253
+ dtm_provider_settings,
254
+ coordinates,
255
+ size,
256
+ rotation,
257
+ map_directory,
258
+ )
220
259
  ```
221
260
  In this case, the library will use the default templates, which should be present in the `data` directory, which should be placed in the current working directory.<br>
222
261
  Structure example:<br>
@@ -229,28 +268,17 @@ Structure example:<br>
229
268
 
230
269
  So it's recommended to download the `data` directory from the repository and place it in the root of your project.<br>
231
270
 
232
- 3. Create an instance of the Map class:
233
- ```python
234
- import maps4fs as mfs
235
-
236
- map = mfs.Map(
237
- game,
238
- (52.5200, 13.4050), # Latitude and longitude of the map center.
239
- height=1024, # The height of the map in meters.
240
- width=1024, # The width of the map in meters.
241
- map_directory="path/to/your/map/directory", # The directory where the map will be saved.
242
- )
243
- ```
244
-
245
- 4. Generate the map:
271
+ 3. Launch the generation process.
246
272
  The `generate` method returns a generator, which yields the active component of the map. You can use it to track the progress of the generation process.
247
273
  ```python
248
- for active_component in map.generate():
249
- print(active_component)
274
+ for component_name in mp.generate():
275
+ print(f"Generating {component_name}...")
250
276
  ```
251
277
 
252
278
  The map will be saved in the `map_directory` directory.
253
279
 
280
+ ➡️ Check out the [demo.py](demo.py) file for a complete example.
281
+
254
282
  ## Modder Toolbox
255
283
  The tool now has a Modder Toolbox, which is a set of tools to help you with various tasks. You can open the toolbox by switching to the `🧰 Modder Toolbox` tab in the StreamLit app.<br>
256
284
 
@@ -115,7 +115,7 @@ Check out the [Docker FAQ](docs/FAQ_docker.md) if you have any questions.<br>
115
115
  ```bash
116
116
  pip install maps4fs
117
117
  ```
118
- And refer to the [Python package](#option-3-python-package) section to learn how to use it.<br>
118
+ And refer to the [Python package or run from the source](#option-3-python-package-or-source-code) section to learn how to use it.<br>
119
119
 
120
120
  ## Overview
121
121
  The core idea is coming from the awesome [maps4cim](https://github.com/klamann/maps4cim) project.<br>
@@ -175,7 +175,7 @@ docker run -d -p 8501:8501 --name maps4fs iwatkot/maps4fs
175
175
  4. Fill in the required fields and click on the `Generate` button.
176
176
  5. When the map is generated click on the `Download` button to get the map.
177
177
 
178
- ### Option 3: Python package
178
+ ### Option 3: Python package or source code
179
179
  🔴 Recommended for developers.
180
180
  🗺️ Supported map sizes: 2x2, 4x4, 8x8, 16x16 km and any custom size.
181
181
  ⚙️ Advanced settings: enabled.
@@ -186,11 +186,50 @@ You can use the Python package to generate maps. Follow these steps:
186
186
  ```bash
187
187
  pip install maps4fs
188
188
  ```
189
+
190
+ Or clone the repository and install the package from the source code:
191
+ ```bash
192
+ git clone https://github.com/iwatkot/maps4fs.git
193
+ cd maps4fs
194
+ dev/create_venv.ps1 # for Windows
195
+ sh dev/create_venv.sh # for Linux
196
+
197
+ # Activate the virtual environment.
198
+ ./venv/scripts/activate # for Windows
199
+ source venv/bin/activate # for Linux
200
+
201
+ # Edit the demo.py file to set the parameters.
202
+ python demo.py
203
+ ```
204
+
205
+
189
206
  2. Import the Game class and create an instance of it:
190
207
  ```python
191
208
  import maps4fs as mfs
192
209
 
193
- game = mfs.Game.from_code("FS25")
210
+ game_code = "fs25"
211
+ game = mfs.Game.from_code(game_code)
212
+
213
+ dtm_provider = mfs.SRTM30Provider
214
+ dtm_provider_settings = mfs.SRTM30ProviderSettings(easy_mode=True, power_factor=0)
215
+
216
+ lat, lon = 45.28, 20.23
217
+ coordinates = (lat, lon)
218
+ size = 2048
219
+ rotation = 25
220
+
221
+ map_directory = "map_directory"
222
+ os.makedirs(map_directory, exist_ok=True)
223
+
224
+ mp = mfs.Map(
225
+ game,
226
+ dtm_provider,
227
+ dtm_provider_settings,
228
+ coordinates,
229
+ size,
230
+ rotation,
231
+ map_directory,
232
+ )
194
233
  ```
195
234
  In this case, the library will use the default templates, which should be present in the `data` directory, which should be placed in the current working directory.<br>
196
235
  Structure example:<br>
@@ -203,28 +242,17 @@ Structure example:<br>
203
242
 
204
243
  So it's recommended to download the `data` directory from the repository and place it in the root of your project.<br>
205
244
 
206
- 3. Create an instance of the Map class:
207
- ```python
208
- import maps4fs as mfs
209
-
210
- map = mfs.Map(
211
- game,
212
- (52.5200, 13.4050), # Latitude and longitude of the map center.
213
- height=1024, # The height of the map in meters.
214
- width=1024, # The width of the map in meters.
215
- map_directory="path/to/your/map/directory", # The directory where the map will be saved.
216
- )
217
- ```
218
-
219
- 4. Generate the map:
245
+ 3. Launch the generation process.
220
246
  The `generate` method returns a generator, which yields the active component of the map. You can use it to track the progress of the generation process.
221
247
  ```python
222
- for active_component in map.generate():
223
- print(active_component)
248
+ for component_name in mp.generate():
249
+ print(f"Generating {component_name}...")
224
250
  ```
225
251
 
226
252
  The map will be saved in the `map_directory` directory.
227
253
 
254
+ ➡️ Check out the [demo.py](demo.py) file for a complete example.
255
+
228
256
  ## Modder Toolbox
229
257
  The tool now has a Modder Toolbox, which is a set of tools to help you with various tasks. You can open the toolbox by switching to the `🧰 Modder Toolbox` tab in the StreamLit app.<br>
230
258
 
@@ -1,7 +1,7 @@
1
1
  # pylint: disable=missing-module-docstring
2
2
  from maps4fs.generator.dtm.dtm import DTMProvider
3
- from maps4fs.generator.dtm.srtm import SRTM30Provider
4
- from maps4fs.generator.dtm.usgs import USGSProvider
3
+ from maps4fs.generator.dtm.srtm import SRTM30Provider, SRTM30ProviderSettings
4
+ from maps4fs.generator.dtm.usgs import USGSProvider, USGSProviderSettings
5
5
  from maps4fs.generator.game import Game
6
6
  from maps4fs.generator.map import Map
7
7
  from maps4fs.generator.settings import (
@@ -9,6 +9,7 @@ from maps4fs.generator.settings import (
9
9
  DEMSettings,
10
10
  GRLESettings,
11
11
  I3DSettings,
12
+ SatelliteSettings,
12
13
  SettingsModel,
13
14
  SplineSettings,
14
15
  TextureSettings,
@@ -466,7 +466,11 @@ class Texture(Component):
466
466
  self.np_to_polygon_points(polygon) # type: ignore
467
467
  )
468
468
  if not layer.invisible:
469
- cv2.fillPoly(layer_image, [polygon], color=255) # type: ignore
469
+ try:
470
+ cv2.fillPoly(layer_image, [polygon], color=255) # type: ignore
471
+ except Exception as e: # pylint: disable=W0718
472
+ self.logger.warning("Error drawing polygon: %s.", repr(e))
473
+ continue
470
474
 
471
475
  if layer.info_layer == "roads":
472
476
  for linestring in self.objects_generator(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: maps4fs
3
- Version: 1.7.1
3
+ Version: 1.7.2
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
@@ -141,7 +141,7 @@ Check out the [Docker FAQ](docs/FAQ_docker.md) if you have any questions.<br>
141
141
  ```bash
142
142
  pip install maps4fs
143
143
  ```
144
- And refer to the [Python package](#option-3-python-package) section to learn how to use it.<br>
144
+ And refer to the [Python package or run from the source](#option-3-python-package-or-source-code) section to learn how to use it.<br>
145
145
 
146
146
  ## Overview
147
147
  The core idea is coming from the awesome [maps4cim](https://github.com/klamann/maps4cim) project.<br>
@@ -201,7 +201,7 @@ docker run -d -p 8501:8501 --name maps4fs iwatkot/maps4fs
201
201
  4. Fill in the required fields and click on the `Generate` button.
202
202
  5. When the map is generated click on the `Download` button to get the map.
203
203
 
204
- ### Option 3: Python package
204
+ ### Option 3: Python package or source code
205
205
  🔴 Recommended for developers.
206
206
  🗺️ Supported map sizes: 2x2, 4x4, 8x8, 16x16 km and any custom size.
207
207
  ⚙️ Advanced settings: enabled.
@@ -212,11 +212,50 @@ You can use the Python package to generate maps. Follow these steps:
212
212
  ```bash
213
213
  pip install maps4fs
214
214
  ```
215
+
216
+ Or clone the repository and install the package from the source code:
217
+ ```bash
218
+ git clone https://github.com/iwatkot/maps4fs.git
219
+ cd maps4fs
220
+ dev/create_venv.ps1 # for Windows
221
+ sh dev/create_venv.sh # for Linux
222
+
223
+ # Activate the virtual environment.
224
+ ./venv/scripts/activate # for Windows
225
+ source venv/bin/activate # for Linux
226
+
227
+ # Edit the demo.py file to set the parameters.
228
+ python demo.py
229
+ ```
230
+
231
+
215
232
  2. Import the Game class and create an instance of it:
216
233
  ```python
217
234
  import maps4fs as mfs
218
235
 
219
- game = mfs.Game.from_code("FS25")
236
+ game_code = "fs25"
237
+ game = mfs.Game.from_code(game_code)
238
+
239
+ dtm_provider = mfs.SRTM30Provider
240
+ dtm_provider_settings = mfs.SRTM30ProviderSettings(easy_mode=True, power_factor=0)
241
+
242
+ lat, lon = 45.28, 20.23
243
+ coordinates = (lat, lon)
244
+ size = 2048
245
+ rotation = 25
246
+
247
+ map_directory = "map_directory"
248
+ os.makedirs(map_directory, exist_ok=True)
249
+
250
+ mp = mfs.Map(
251
+ game,
252
+ dtm_provider,
253
+ dtm_provider_settings,
254
+ coordinates,
255
+ size,
256
+ rotation,
257
+ map_directory,
258
+ )
220
259
  ```
221
260
  In this case, the library will use the default templates, which should be present in the `data` directory, which should be placed in the current working directory.<br>
222
261
  Structure example:<br>
@@ -229,28 +268,17 @@ Structure example:<br>
229
268
 
230
269
  So it's recommended to download the `data` directory from the repository and place it in the root of your project.<br>
231
270
 
232
- 3. Create an instance of the Map class:
233
- ```python
234
- import maps4fs as mfs
235
-
236
- map = mfs.Map(
237
- game,
238
- (52.5200, 13.4050), # Latitude and longitude of the map center.
239
- height=1024, # The height of the map in meters.
240
- width=1024, # The width of the map in meters.
241
- map_directory="path/to/your/map/directory", # The directory where the map will be saved.
242
- )
243
- ```
244
-
245
- 4. Generate the map:
271
+ 3. Launch the generation process.
246
272
  The `generate` method returns a generator, which yields the active component of the map. You can use it to track the progress of the generation process.
247
273
  ```python
248
- for active_component in map.generate():
249
- print(active_component)
274
+ for component_name in mp.generate():
275
+ print(f"Generating {component_name}...")
250
276
  ```
251
277
 
252
278
  The map will be saved in the `map_directory` directory.
253
279
 
280
+ ➡️ Check out the [demo.py](demo.py) file for a complete example.
281
+
254
282
  ## Modder Toolbox
255
283
  The tool now has a Modder Toolbox, which is a set of tools to help you with various tasks. You can open the toolbox by switching to the `🧰 Modder Toolbox` tab in the StreamLit app.<br>
256
284
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "maps4fs"
7
- version = "1.7.1"
7
+ version = "1.7.2"
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"}
File without changes
File without changes
File without changes
File without changes
File without changes