mirror of
https://github.com/enzet/map-machine.git
synced 2025-05-29 17:06:30 +02:00
Fix generation for single node.
This commit is contained in:
parent
5a0a9fe14f
commit
b5b3da860d
2 changed files with 12 additions and 4 deletions
14
roentgen.py
14
roentgen.py
|
@ -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,
|
icon, labels, tags, np.array((32, 32)), None, is_for_node=is_for_node,
|
||||||
draw_outline=is_for_node
|
draw_outline=is_for_node
|
||||||
)
|
)
|
||||||
print(point.is_for_node)
|
border: int = 8
|
||||||
svg = svgwrite.Drawing("test_icon.svg", (64, 64))
|
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):
|
for style in scheme.get_style(tags, 18):
|
||||||
style: LineStyle
|
style: LineStyle
|
||||||
path = svg.path(d="M 0,0 L 64,0 L 64,64 L 0,64 L 0,0 Z")
|
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)
|
svg.add(path)
|
||||||
point.draw_main_shapes(svg)
|
point.draw_main_shapes(svg)
|
||||||
point.draw_extra_shapes(svg)
|
point.draw_extra_shapes(svg)
|
||||||
point.draw_texts(svg, None)
|
point.draw_texts(svg)
|
||||||
svg.write(open("test_icon.svg", "w+"))
|
svg.write(open("test_icon.svg", "w+"))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,7 @@ class Point(Tagged):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def draw_texts(
|
def draw_texts(
|
||||||
self, svg: svgwrite.Drawing, occupied: Optional[Occupied]
|
self, svg: svgwrite.Drawing, occupied: Optional[Occupied] = None
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""
|
||||||
Draw all labels.
|
Draw all labels.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue