Conditions Tree: first blueprint using anytree (iteratively)

This commit is contained in:
Jean Sirmai 2022-01-06 12:31:21 +01:00
parent 9e327a2643
commit 4cec4b1855
Signed by: jean
GPG Key ID: FB3115C340E057E3
1 changed files with 4 additions and 2 deletions

View File

@ -13,10 +13,11 @@ for i in range(0, len(model.testmodel.get_conditions().get_conditions_array())):
condition = model.testmodel.get_conditions().get_condition(i)
conditions_set.add((condition.get_node_self_id(),
condition.get_node_parent_id(),
condition.get_coord("x"), # TODO y,z,...
condition.get_coord("x"), # TODO y,z,...
condition.get_site(),
condition.get_weight()))
class CondTreeNode(NodeMixin):
def __init__(self, id, x, site, weight, parent_node_id):
super(CondTreeNode, self).__init__()
@ -31,12 +32,13 @@ class CondTreeNode(NodeMixin):
self.parent = parent_node
print('orphan node ', self.id, ' is adopted by node ', parent_node.id)
for i in conditions_set: # sorted(conditions_set, key=i.id):
condition = CondTreeNode(i[0], i[2], i[3], i[4], i[1]) # TODO y,z,...
conditions_list.append(condition)
for i in conditions_list:
if (i.parent == None):
if (i.parent is None):
for j in conditions_list:
if (i.parent_node_id == j.id):
i.add_parent_node(j)