private void createLNode ( VNode vNode , VNode parent ) { LNode lNode = layout . newNode ( vNode ) ; lNode . type = vNode . glyph . getClazz ( ) ; lNode . label = vNode . glyph . getId ( ) ; LGraph rootLGraph = layout . getGraphManager ( ) . getRoot ( ) ; //Add corresponding nodes to corresponding maps viewToLayout . put ( vNode , lNode ) ; layoutToView . put ( lNode . label , vNode ) ; // if the vNode has a parent, add the lNode as a child of the parent l-node. // otherwise, add the node to the root graph. if ( parent != null ) { LNode parentLNode = viewToLayout . get ( parent ) ; parentLNode . getChild ( ) . add ( lNode ) ; } else { rootLGraph . add ( lNode ) ; } lNode . setLocation ( vNode . glyph . getBbox ( ) . getX ( ) , vNode . glyph . getBbox ( ) . getY ( ) ) ; if ( vNode instanceof VCompound ) { VCompound vCompound = ( VCompound ) vNode ; // add new LGraph to the graph manager for the compound node layout . getGraphManager ( ) . add ( layout . newGraph ( null ) , lNode ) ; // for each VNode in the node set create an LNode for ( VNode vChildNode : vCompound . getChildren ( ) ) { createLNode ( vChildNode , vCompound ) ; } } else { lNode . setWidth ( vNode . glyph . getBbox ( ) . getW ( ) ) ; lNode . setHeight ( vNode . glyph . getBbox ( ) . getH ( ) ) ; } }
Helper function for creating LNode objects from VNode objects and adds them to the given layout .