Skip to content
Snippets Groups Projects
Commit 09562e88 authored by Allen, Bruce (CIV)'s avatar Allen, Bruce (CIV)
Browse files

account for when the trace-generator skips rows in events

parent ca7c55d1
No related branches found
No related tags found
No related merge requests found
...@@ -144,27 +144,24 @@ def _add_view_object(view_object, gry_graph): ...@@ -144,27 +144,24 @@ def _add_view_object(view_object, gry_graph):
view_object["AD"])) view_object["AD"]))
def _trace_v_spacing(tg_nodes): def _trace_v_spacing(tg_nodes):
# start off maximums with default node height # start off with default node height
maximums = defaultdict(lambda:settings["trace_node_height"]) row_heights = defaultdict(lambda:settings["trace_node_height"])
w = settings["trace_node_width"] w = settings["trace_node_width"]
default_v_spacing = settings["trace_node_v_spacing"] default_v_spacing = settings["trace_node_v_spacing"]
# get the max height for each row # get the max height for each row
for tg_node in tg_nodes: # event in event list for tg_node in tg_nodes: # event in event list
maximums[tg_node[4]] = max(maximums[tg_node[4]], row_heights[tg_node[4]] = max(row_heights[tg_node[4]],
margined_text_height(strip_underscore(tg_node[0]), w)) margined_text_height(strip_underscore(tg_node[0]), w))
# calculate the adjusted spacing at each row # calculate the adjusted spacing at each row
keys = sorted(maximums.keys()) keys = sorted(row_heights.keys())
count = len(maximums) count = keys[-1] + 1 # trace-generator can skip rows
adjusted_v_spacing = [0]*count adjusted_v_spacing = [0]*count # create the array and set the first to 0
for i in range(1, count): for i in range(1, count):
adjusted_v_spacing[i] = adjusted_v_spacing[i-1] \ adjusted_v_spacing[i] = adjusted_v_spacing[i-1] \
+ maximums[i-1] / 2 \ + row_heights[i-1] / 2 \
+ maximums[i] / 2 + default_v_spacing + row_heights[i] / 2 + default_v_spacing
return adjusted_v_spacing return adjusted_v_spacing
def _trace_edge(tg_edge, relation, label, nodes, placer): def _trace_edge(tg_edge, relation, label, nodes, placer):
gry_edge = dict() gry_edge = dict()
if relation == "IN" or relation == "FOLLOWS": if relation == "IN" or relation == "FOLLOWS":
...@@ -185,7 +182,7 @@ def _trace_edge(tg_edge, relation, label, nodes, placer): ...@@ -185,7 +182,7 @@ def _trace_edge(tg_edge, relation, label, nodes, placer):
gry_from_node = nodes[from_id] gry_from_node = nodes[from_id]
gry_to_node = nodes[to_id] gry_to_node = nodes[to_id]
ep1_x, ep1_y, ep2_x, ep2_y = placer.place_cubic_bezier_points( ep1_x, ep1_y, ep2_x, ep2_y = placer.place_cubic_bezier_points(
from_id, gry_from_node["x"], gry_from_node["y"], from_id, gry_from_node["x"], gry_from_node["y"],
to_id, gry_to_node["x"], gry_to_node["y"]) to_id, gry_to_node["x"], gry_to_node["y"])
gry_edge["ep1_x"] = ep1_x gry_edge["ep1_x"] = ep1_x
gry_edge["ep1_y"] = ep1_y gry_edge["ep1_y"] = ep1_y
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment