mirror of
https://github.com/enzet/map-machine.git
synced 2025-05-01 19:27:06 +02:00
Support drawing options in scheme.
It is now necessary to enable drawing map features in the scheme file. In the `options` field one should enable the following features in order to have these features on the map, because they are disabled by default: - `draw_nodes`, - `draw_buildings`, - `draw_trees`, - `draw_craters`, - `draw_directions` Related to #140.
This commit is contained in:
parent
d3c18a3d5f
commit
f0b3d19b15
4 changed files with 63 additions and 37 deletions
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 439 KiB After Width: | Height: | Size: 440 KiB |
|
@ -87,18 +87,26 @@ class Map:
|
||||||
path.update(figure.line_style.style)
|
path.update(figure.line_style.style)
|
||||||
self.svg.add(path)
|
self.svg.add(path)
|
||||||
|
|
||||||
|
if self.scheme.draw_trees:
|
||||||
for tree in constructor.trees:
|
for tree in constructor.trees:
|
||||||
tree.draw(self.svg, self.flinger, self.scheme)
|
tree.draw(self.svg, self.flinger, self.scheme)
|
||||||
|
|
||||||
|
if self.scheme.draw_craters:
|
||||||
for crater in constructor.craters:
|
for crater in constructor.craters:
|
||||||
crater.draw(self.svg, self.flinger)
|
crater.draw(self.svg, self.flinger)
|
||||||
|
|
||||||
self.draw_buildings(constructor, self.configuration.use_building_colors)
|
if self.scheme.draw_buildings:
|
||||||
|
self.draw_buildings(
|
||||||
|
constructor, self.configuration.use_building_colors
|
||||||
|
)
|
||||||
|
|
||||||
|
if self.scheme.draw_directions:
|
||||||
for direction_sector in constructor.direction_sectors:
|
for direction_sector in constructor.direction_sectors:
|
||||||
direction_sector.draw(self.svg, self.scheme)
|
direction_sector.draw(self.svg, self.scheme)
|
||||||
|
|
||||||
# All other points
|
# All other points
|
||||||
|
|
||||||
|
if self.scheme.draw_nodes:
|
||||||
occupied: Optional[Occupied]
|
occupied: Optional[Occupied]
|
||||||
if self.configuration.overlap == 0:
|
if self.configuration.overlap == 0:
|
||||||
occupied = None
|
occupied = None
|
||||||
|
|
|
@ -321,6 +321,16 @@ class Scheme:
|
||||||
for element in group["tags"]:
|
for element in group["tags"]:
|
||||||
self.node_matchers.append(NodeMatcher(element, group))
|
self.node_matchers.append(NodeMatcher(element, group))
|
||||||
|
|
||||||
|
options = content.get("options", {})
|
||||||
|
|
||||||
|
self.draw_nodes: bool = options.get("draw_nodes", False)
|
||||||
|
|
||||||
|
# Map features.
|
||||||
|
self.draw_buildings: bool = options.get("draw_buildings", False)
|
||||||
|
self.draw_trees: bool = options.get("draw_trees", False)
|
||||||
|
self.draw_craters: bool = options.get("draw_craters", False)
|
||||||
|
self.draw_directions: bool = options.get("draw_directions", False)
|
||||||
|
|
||||||
self.colors: dict[str, str] = content.get("colors", {})
|
self.colors: dict[str, str] = content.get("colors", {})
|
||||||
self.material_colors: dict[str, str] = content.get(
|
self.material_colors: dict[str, str] = content.get(
|
||||||
"material_colors", {}
|
"material_colors", {}
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
options:
|
||||||
|
|
||||||
|
draw_nodes: yes
|
||||||
|
draw_trees: yes
|
||||||
|
draw_craters: yes
|
||||||
|
draw_buildings: yes
|
||||||
|
draw_directions: yes
|
||||||
|
|
||||||
colors:
|
colors:
|
||||||
|
|
||||||
# Entity
|
# Entity
|
||||||
|
|
Loading…
Add table
Reference in a new issue