mirror of
https://github.com/enzet/map-machine.git
synced 2025-05-22 05:26:24 +02:00
Fix special mode node outline.
This commit is contained in:
parent
fc2fa5f766
commit
3e132992d5
4 changed files with 14 additions and 7 deletions
BIN
doc/time.png
BIN
doc/time.png
Binary file not shown.
Before Width: | Height: | Size: 397 KiB After Width: | Height: | Size: 385 KiB |
BIN
doc/user.png
BIN
doc/user.png
Binary file not shown.
Before Width: | Height: | Size: 403 KiB After Width: | Height: | Size: 396 KiB |
|
@ -429,6 +429,7 @@ class Constructor:
|
||||||
|
|
||||||
priority: int
|
priority: int
|
||||||
icon_set: IconSet
|
icon_set: IconSet
|
||||||
|
draw_outline: bool = True
|
||||||
|
|
||||||
if self.mode in ["time", "user-coloring"]:
|
if self.mode in ["time", "user-coloring"]:
|
||||||
if not tags:
|
if not tags:
|
||||||
|
@ -440,13 +441,16 @@ class Constructor:
|
||||||
dot, _ = self.icon_extractor.get_path(DEFAULT_SMALL_SHAPE_ID)
|
dot, _ = self.icon_extractor.get_path(DEFAULT_SMALL_SHAPE_ID)
|
||||||
icon_set = IconSet([dot], [], color, set(), True)
|
icon_set = IconSet([dot], [], color, set(), True)
|
||||||
priority = 0
|
priority = 0
|
||||||
|
draw_outline = False
|
||||||
else:
|
else:
|
||||||
icon_set, priority = self.scheme.get_icon(
|
icon_set, priority = self.scheme.get_icon(
|
||||||
self.icon_extractor, tags
|
self.icon_extractor, tags
|
||||||
)
|
)
|
||||||
|
|
||||||
self.nodes.append(Point(
|
self.nodes.append(Point(
|
||||||
icon_set, tags, flung, node.coordinates, priority=priority))
|
icon_set, tags, flung, node.coordinates, priority=priority,
|
||||||
|
draw_outline=draw_outline
|
||||||
|
))
|
||||||
|
|
||||||
missing_tags.update(
|
missing_tags.update(
|
||||||
f"{key}: {tags[key]}" for key in tags
|
f"{key}: {tags[key]}" for key in tags
|
||||||
|
|
|
@ -140,7 +140,8 @@ class Point(Tagged):
|
||||||
def __init__(
|
def __init__(
|
||||||
self, icon_set: IconSet, tags: Dict[str, str], point: np.array,
|
self, icon_set: IconSet, tags: Dict[str, str], point: np.array,
|
||||||
coordinates: np.array, priority: float = 0,
|
coordinates: np.array, priority: float = 0,
|
||||||
is_for_node: bool = True):
|
is_for_node: bool = True, draw_outline: bool = True
|
||||||
|
):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
assert point is not None
|
assert point is not None
|
||||||
|
@ -152,6 +153,7 @@ class Point(Tagged):
|
||||||
self.priority: float = priority
|
self.priority: float = priority
|
||||||
self.layer: float = 0
|
self.layer: float = 0
|
||||||
self.is_for_node: bool = is_for_node
|
self.is_for_node: bool = is_for_node
|
||||||
|
self.draw_outline: bool = draw_outline
|
||||||
|
|
||||||
self.y = 0
|
self.y = 0
|
||||||
|
|
||||||
|
@ -210,11 +212,12 @@ class Point(Tagged):
|
||||||
|
|
||||||
# Draw outlines.
|
# Draw outlines.
|
||||||
|
|
||||||
for icon in icons: # type: Icon
|
if self.draw_outline:
|
||||||
bright: bool = is_bright(fill)
|
for icon in icons: # type: Icon
|
||||||
color: Color = Color("black") if bright else Color("white")
|
bright: bool = is_bright(fill)
|
||||||
opacity: float = 0.7 if bright else 0.5
|
color: Color = Color("black") if bright else Color("white")
|
||||||
icon.draw(svg, position, color, opacity=opacity, outline=True)
|
opacity: float = 0.7 if bright else 0.5
|
||||||
|
icon.draw(svg, position, color, opacity=opacity, outline=True)
|
||||||
|
|
||||||
# Draw icons.
|
# Draw icons.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue