}
}
Map<Integer, DNVNode> nodeToParent = new HashMap<Integer, DNVNode>();
Map<Integer, List<DNVNode>> parentToNode = new HashMap<Integer, List<DNVNode>>();
DNVNode newNode;
Vector2D position;
Vector3D color;
for( String neighborListId : nodesByNeighborlist.keySet() )
{
tempList = nodesByNeighborlist.get( neighborListId );
position = new Vector2D( 0, 0 );
color = new Vector3D( 0, 0, 0 );
if( tempList != null && tempList.size() > 0 )
{
newNode = new DNVNode( graph );
newNode.setFirstChild( tempList.get( 0 ) );
newNode.setSubNodes( tempList );
graph.addNode( currentLevel + 1, newNode );
parentToNode.put( newNode.getId(), tempList );
for( DNVNode childNode : tempList )
{
nodeToParent.put( childNode.getId(), newNode );
position.add( childNode.getPosition() );
color.add( childNode.getColor() );
childNode.setParentNode( newNode );
}
position.dotProduct( 1.0f / (float)tempList.size() );
color.dotProduct( 1.0f / (float)tempList.size() );
if( tempList.size() == 1 )
{
newNode.setLabel( tempList.get( 0 ).getLabel() );
newNode.setIcon( tempList.get( 0 ).getIcon() );
newNode.setLabelColor( tempList.get( 0 ).getLabelColor() );
newNode.setLabelOutlineColor( tempList.get( 0 ).getLabelOutlineColor() );
newNode.setForceLabel( tempList.get( 0 ).isForceLabel() );
}
else
{
newNode.setLabel( "" + tempList.size() );
}
newNode.setColor( color );
newNode.setPosition( position );
}
}
for( DNVNode tempNode : currentNodes )
{
DNVNode parentNode = tempNode.getParentNode();
DNVNode parentNode2;
// DNVEdge newEdge;
DNVNode tempNode2;
List<DNVEdge> edgeList = tempNode.getFromEdges();
for( DNVEdge tempEdge : edgeList )
{
tempNode2 = tempEdge.getTo();
parentNode2 = tempNode2.getParentNode();
if( parentNode2 != null && !parentNode2.getId().equals( parentNode.getId() ) && parentNode != parentNode2 )
{
if( !parentNode.isNeighbor( parentNode2 ) )
{
createEdge( graph, currentLevel, parentNode, parentNode2, tempEdge );
}
}
}
edgeList = tempNode.getToEdges();
for( DNVEdge tempEdge : edgeList )
{
tempNode2 = tempEdge.getFrom();
parentNode2 = tempNode2.getParentNode();
if( parentNode2 != null && !parentNode2.getId().equals( parentNode.getId() ) && parentNode != parentNode2 )
{
if( !parentNode.isNeighbor( parentNode2 ) )
{
createEdge( graph, currentLevel, parentNode2, parentNode, tempEdge );