Skip to content

Commit

Permalink
Merge branch 'PMPY-1690' into 'integration'
Browse files Browse the repository at this point in the history
PMPY-1690 BPMN models reduce size of start/end nodes

See merge request process-mining/pm4py/pm4py-core!644
  • Loading branch information
fit-alessandro-berti committed May 1, 2022
2 parents 891ddfd + 558575f commit d982c53
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pm4py/objects/bpmn/layout/variants/graphviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def apply(bpmn_graph, parameters=None):
points = node.split("points=\"")[1].split("\"")[0]
nodes_pos[inv_nodes_dict[this_id]] = points

endpoints_wh = exec_utils.get_param_value(Parameters.TASK_WH, parameters, 30)
task_wh = exec_utils.get_param_value(Parameters.TASK_WH, parameters, 60)

# add node positions to BPMN nodes
Expand All @@ -117,12 +118,16 @@ def apply(bpmn_graph, parameters=None):
pos_y = float(node_pos[1])
n.set_x(pos_x)
n.set_y(pos_y)
n.set_height(task_wh)
if isinstance(n, BPMN.Task):
this_width = min(round(2 * task_wh), round(2 * (len(n.get_name()) + 7) * task_wh / 22.0))
n.set_width(this_width)
n.set_height(task_wh)
elif isinstance(n, BPMN.StartEvent) or isinstance(n, BPMN.EndEvent):
n.set_width(endpoints_wh)
n.set_height(endpoints_wh)
else:
n.set_width(task_wh)
n.set_height(task_wh)

max_x = max(1, max(abs(node.get_x()) for node in nodes))
max_y = max(1, max(abs(node.get_y()) for node in nodes))
Expand Down

0 comments on commit d982c53

Please sign in to comment.