Fix generation for single node.

This commit is contained in:
Sergey Vartanov 2021-05-07 03:28:22 +03:00
parent 5a0a9fe14f
commit b5b3da860d
2 changed files with 12 additions and 4 deletions

View file

@ -136,8 +136,16 @@ def draw_element(target: str, tags_description: str):
icon, labels, tags, np.array((32, 32)), None, is_for_node=is_for_node,
draw_outline=is_for_node
)
print(point.is_for_node)
svg = svgwrite.Drawing("test_icon.svg", (64, 64))
border: int = 8
icon_size: int = 16
width: int = (
border * 2 + (1 + max(2, len(icon.extra_icons) - 1)) * icon_size
)
height: int = border * 2 + (1 + int(len(icon.extra_icons) / 3)) * icon_size
if len(labels):
height += 2 + 11 * len(labels)
point.point = np.array((width / 2, border + icon_size / 2))
svg = svgwrite.Drawing("test_icon.svg", (width, height))
for style in scheme.get_style(tags, 18):
style: LineStyle
path = svg.path(d="M 0,0 L 64,0 L 64,64 L 0,64 L 0,0 Z")
@ -145,7 +153,7 @@ def draw_element(target: str, tags_description: str):
svg.add(path)
point.draw_main_shapes(svg)
point.draw_extra_shapes(svg)
point.draw_texts(svg, None)
point.draw_texts(svg)
svg.write(open("test_icon.svg", "w+"))

View file

@ -149,7 +149,7 @@ class Point(Tagged):
return True
def draw_texts(
self, svg: svgwrite.Drawing, occupied: Optional[Occupied]
self, svg: svgwrite.Drawing, occupied: Optional[Occupied] = None
) -> None:
"""
Draw all labels.