mirror of
https://github.com/enzet/map-machine.git
synced 2025-06-03 19:31:52 +02:00
Add outline parameter for shape.
This commit is contained in:
parent
e34f012c4f
commit
1b45f3489f
2 changed files with 11 additions and 3 deletions
|
@ -195,6 +195,7 @@ class ShapeSpecification:
|
|||
offset: np.array = np.array((0, 0))
|
||||
flip_horizontally: bool = False
|
||||
flip_vertically: bool = False
|
||||
use_outline: bool = True
|
||||
|
||||
@classmethod
|
||||
def from_structure(
|
||||
|
@ -214,6 +215,7 @@ class ShapeSpecification:
|
|||
offset: np.array = np.array((0, 0))
|
||||
flip_horizontally: bool = False
|
||||
flip_vertically: bool = False
|
||||
use_outline: bool = True
|
||||
|
||||
if isinstance(structure, str):
|
||||
shape = extractor.get_shape(structure)
|
||||
|
@ -230,8 +232,13 @@ class ShapeSpecification:
|
|||
flip_horizontally = structure["flip_horizontally"]
|
||||
if "flip_vertically" in structure:
|
||||
flip_vertically = structure["flip_vertically"]
|
||||
if "outline" in structure:
|
||||
use_outline = structure["outline"]
|
||||
|
||||
return cls(shape, color, offset, flip_horizontally, flip_vertically)
|
||||
return cls(
|
||||
shape, color, offset, flip_horizontally, flip_vertically,
|
||||
use_outline
|
||||
)
|
||||
|
||||
def is_default(self) -> bool:
|
||||
"""
|
||||
|
@ -264,7 +271,7 @@ class ShapeSpecification:
|
|||
path = self.shape.get_path(svg, point, self.offset, scale)
|
||||
path.update({"fill": self.color.hex})
|
||||
|
||||
if outline:
|
||||
if outline and self.use_outline:
|
||||
bright: bool = is_bright(self.color)
|
||||
color: Color = Color("black") if bright else Color("white")
|
||||
opacity: float = 0.7 if bright else 0.5
|
||||
|
|
|
@ -20,6 +20,7 @@ colors:
|
|||
evergreen_color: "#688C44"
|
||||
farmland_color: "#FFEEBB"
|
||||
farmland_border_color: "#DDCC99"
|
||||
farmland_darker_color: "#998855"
|
||||
ferry_terminal_color: "#AABBDD"
|
||||
foot_border_color: "#FFFFFF"
|
||||
foot_color: "#B89A74"
|
||||
|
@ -144,7 +145,7 @@ node_icons:
|
|||
- tags: {plant: christmas_trees}
|
||||
shapes: [{shape: christmas_tree, color: orchard_border_color}]
|
||||
- tags: {crop: sunflower}
|
||||
shapes: [{shape: sunflower, color: farmland_border_color}]
|
||||
shapes: [{shape: sunflower, color: farmland_darker_color, outline: no}]
|
||||
- tags: {produce: apple}
|
||||
shapes: [{shape: apple, color: orchard_border_color}]
|
||||
- tags: {produce: christmas_trees}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue