mirror of
https://github.com/enzet/map-machine.git
synced 2025-05-10 15:46:51 +02:00
Issue #11: fix user and time modes.
This commit is contained in:
parent
f452a08177
commit
f88f3b9f50
3 changed files with 26 additions and 16 deletions
|
@ -219,6 +219,8 @@ class Constructor:
|
|||
nodes = way.nodes
|
||||
|
||||
if self.mode == "user-coloring":
|
||||
if not way:
|
||||
return
|
||||
user_color = get_user_color(way.user, self.seed)
|
||||
self.ways.append(
|
||||
Way("way", nodes, path,
|
||||
|
@ -629,8 +631,10 @@ class Constructor:
|
|||
|
||||
if self.mode == "user-coloring":
|
||||
fill = get_user_color(node.user, self.seed)
|
||||
shapes = ["small"]
|
||||
if self.mode == "time":
|
||||
fill = get_time_color(node.timestamp)
|
||||
shapes = ["small"]
|
||||
|
||||
# for k in tags:
|
||||
# if k in processed or self.no_draw(k):
|
||||
|
|
|
@ -64,6 +64,8 @@ class IconExtractor:
|
|||
if id_ in self.icons:
|
||||
return self.icons[id_]
|
||||
else:
|
||||
if id_ != "no":
|
||||
ui.error(f"no such icon ID {id_}")
|
||||
if id_ == "no":
|
||||
return "M 4,4 L 4,10 10,10 10,4 z", 0, 0
|
||||
if id_ == "small":
|
||||
return "M 6,6 L 6,8 8,8 8,6 z", 0, 0
|
||||
ui.error(f"no such icon ID {id_}")
|
||||
|
|
|
@ -288,11 +288,11 @@ class Painter:
|
|||
if way.kind == "way":
|
||||
if way.nodes:
|
||||
path = get_path(way.nodes, [0, 0], self.map_, self.flinger)
|
||||
self.output_file.write(f'<path d="{path}" ' +
|
||||
'style="' + way.style + '" />\n')
|
||||
self.output_file.write(
|
||||
f'<path d="{path}" style="' + way.style + '" />\n')
|
||||
else:
|
||||
self.output_file.write('<path d="' + way.path + '" ' +
|
||||
'style="' + way.style + '" />\n')
|
||||
self.output_file.write(
|
||||
f'<path d="{way.path}" style="' + way.style + '" />\n')
|
||||
|
||||
# Building shade
|
||||
|
||||
|
@ -360,16 +360,20 @@ class Painter:
|
|||
node.tags["natural"] == "tree" and \
|
||||
"diameter_crown" in node.tags:
|
||||
continue
|
||||
self.draw_shapes(node.shapes, points, node.x, node.y,
|
||||
node.color, node.tags, node.processed)
|
||||
self.draw_shapes(
|
||||
node.shapes, points, node.x, node.y, node.color, node.tags,
|
||||
node.processed)
|
||||
|
||||
for node in nodes:
|
||||
self.draw_texts(node.shapes, points, node.x, node.y,
|
||||
node.color, node.tags, node.processed)
|
||||
if self.mode not in ["time", "user-coloring"]:
|
||||
self.draw_texts(
|
||||
node.shapes, points, node.x, node.y, node.color,
|
||||
node.tags, node.processed)
|
||||
|
||||
def draw_point_shape(self, name, x, y, fill, tags=None):
|
||||
if not isinstance(name, list):
|
||||
name = [name]
|
||||
if self.mode not in ["time", "user-coloring"]:
|
||||
for one_name in name:
|
||||
shape, xx, yy = self.icons.get_path(one_name)
|
||||
self.draw_point_outline(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue