def render_floatings(n2i, n2f, img, float_layer, float_behind_layer): #floating_faces = [ [node, fb["float"]] for node, fb in n2f.iteritems() if "float" in fb] for node, faces in n2f.iteritems(): face_set = [ [float_layer, faces.get("float", None)], [float_behind_layer, faces.get("float-behind",None)]] for parent_layer,fb in face_set: if not fb: continue item = n2i[node] fb.setParentItem(parent_layer) if item.extra_branch_line: xtra = item.extra_branch_line.line().dx() else: xtra = 0 if img.mode == "c": # Floatings are positioned over branches crender.rotate_and_displace(fb, item.rotation, fb.h, item.radius - item.nodeRegion.width() + xtra) # Floatings are positioned starting from the node circle #crender.rotate_and_displace(fb, item.rotation, fb.h, item.radius - item.nodeRegion.width()) elif img.mode == "r": fb.setPos(item.content.mapToScene(0, item.center-(fb.h/2))) z = item.zValue() if not img.children_faces_on_top: z = -z fb.setZValue(z) fb.update_columns_size() fb.render()
def render_floatings(n2i, n2f, img, float_layer, float_behind_layer): #floating_faces = [ [node, fb["float"]] for node, fb in n2f.iteritems() if "float" in fb] for node, faces in n2f.iteritems(): face_set = [[float_layer, faces.get("float", None)], [float_behind_layer, faces.get("float-behind", None)]] for parent_layer, fb in face_set: if not fb: continue item = n2i[node] fb.setParentItem(parent_layer) try: xtra = item.extra_branch_line.line().dx() except AttributeError: xtra = 0 if img.mode == "c": # Floatings are positioned over branches crender.rotate_and_displace( fb, item.rotation, fb.h, item.radius - item.nodeRegion.width() + xtra) # Floatings are positioned starting from the node circle #crender.rotate_and_displace(fb, item.rotation, fb.h, item.radius - item.nodeRegion.width()) elif img.mode == "r": start = item.branch_length + xtra - fb.w #if fb.w < item.branch_length else 0.0 fb.setPos( item.content.mapToScene(start, item.center - (fb.h / 2.0))) z = item.zValue() if not img.children_faces_on_top: z = -z fb.setZValue(z) fb.update_columns_size() fb.render()