-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add auto-populate cemeteries and factories
- Loading branch information
1 parent
2f88e11
commit ef654c1
Showing
6 changed files
with
90 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from render_map.auto_populate.map_features.auto_populate_gas_stations import GasStationFeatureMetadata | ||
from render_map.auto_populate.map_features.auto_populate_super_markets import SuperMarketFeatureMetadata | ||
from render_map.auto_populate.map_features.factories import FactoryFeatureMetadata | ||
from render_map.auto_populate.map_features.cemeteries import CemeteryFeatureMetadata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import overpy | ||
|
||
from render_map import mapping | ||
from render_map.auto_populate.map_features import map_features_utils | ||
|
||
CEMETERY_QUERY = """[out:json]; | ||
(node[amenity=grave_yard](around:130000,29.7063997,-95.553997); | ||
//way[landuse=cemetery](around:130000,29.7063997,-95.553997); | ||
); | ||
(._;>;); | ||
out meta; | ||
""" | ||
|
||
|
||
def choose_cemetery_name(node: overpy.Node | overpy.Way) -> map_features_utils.NameZoomIcon: | ||
"""Choose the game name and map zoom level for a cemetery, based on the properties of the supermarket in the | ||
real world. | ||
Args: | ||
node: The node in OpenStreetMap representing the cemetery. | ||
Returns: | ||
Game name and map zoom level for the cemetery. | ||
""" | ||
name_from_node = node.tags.get("name", "") | ||
if name_from_node is None: | ||
return None, mapping.ZoomLevel.WASTELAND, mapping.map_icons.MapIcon.CEMETERY | ||
|
||
# TODO: Make name of marker similar to its real world name | ||
# TODO: Create really big cemeteries visible from the wasteland map | ||
|
||
zoom_level = mapping.ZoomLevel.TOWN | ||
return "Cemetery", zoom_level, mapping.map_icons.MapIcon.CEMETERY | ||
|
||
|
||
CemeteryFeatureMetadata = map_features_utils.FeaturePopulateMetadata( | ||
feature_type_name="cemeteries", query=CEMETERY_QUERY, choose_name_function=choose_cemetery_name | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import overpy | ||
|
||
from render_map import mapping | ||
from render_map.auto_populate import auto_populate_utils | ||
from render_map.auto_populate.map_features import map_features_utils | ||
|
||
FACTORY_QUERY = """[out:json]; | ||
(node[man_made=works](around:{radius},{lat},{lon}); | ||
); | ||
(._;>;); | ||
out meta; | ||
""" | ||
|
||
def choose_factory_name(node: overpy.Node | overpy.Way) -> map_features_utils.NameZoomIcon: | ||
"""Choose the game name and map zoom level for a factory, based on the properties of the factory in the real world. | ||
Args: | ||
node: The node in OpenStreetMap representing the factory. | ||
Returns: | ||
Game name and map zoom level for the factory. | ||
""" | ||
# TODO: Add more custom names | ||
return "Factory", mapping.ZoomLevel.WASTELAND, mapping.map_icons.MapIcon.FACTORY | ||
|
||
FactoryFeatureMetadata = map_features_utils.FeaturePopulateMetadata( | ||
feature_type_name="factories", query=FACTORY_QUERY, choose_name_function=choose_factory_name | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters