private void computeAreas(NodeItem root){
  int leafCount=0;
  Graph g=(Graph)m_vis.getGroup(m_group);
  TupleSet nodes=g.getNodes();
  nodes.addColumns(AREA_SCHEMA);
  Iterator iter=new TreeNodeIterator(root);
  while (iter.hasNext()) {
    NodeItem n=(NodeItem)iter.next();
    n.setDouble(AREA,0);
  }
  iter=new TreeNodeIterator(root,false);
  while (iter.hasNext()) {
    NodeItem n=(NodeItem)iter.next();
    double area=0;
    if (n.getChildCount() == 0) {
      area=n.getSize();
      ++leafCount;
    }
 else     if (n.isExpanded()) {
      NodeItem c=(NodeItem)n.getFirstChild();
      for (; c != null; c=(NodeItem)c.getNextSibling()) {
        area+=c.getDouble(AREA);
        ++leafCount;
      }
    }
    n.setDouble(AREA,area);
  }
  Rectangle2D b=getLayoutBounds();
  double area=(b.getWidth() - 1) * (b.getHeight() - 1);
  double scale=area / root.getDouble(AREA);
  iter=new TreeNodeIterator(root);
  while (iter.hasNext()) {
    NodeItem n=(NodeItem)iter.next();
    n.setDouble(AREA,n.getDouble(AREA) * scale);
  }
}

private void computeAreas ( NodeItem root ) { int leafCount = 0 ; Graph g = ( Graph ) m_vis . getGroup ( m_group ) ; TupleSet nodes = g . getNodes ( ) ; nodes . addColumns ( AREA_SCHEMA ) ; Iterator iter = new TreeNodeIterator ( root ) ; while ( iter . hasNext ( ) ) { NodeItem n = ( NodeItem ) iter . next ( ) ; n . setDouble ( AREA , 0 ) ; } iter = new TreeNodeIterator ( root , false ) ; while ( iter . hasNext ( ) ) { NodeItem n = ( NodeItem ) iter . next ( ) ; double area = 0 ; if ( n . getChildCount ( ) == 0 ) { area = n . getSize ( ) ; ++ leafCount ; } else if ( n . isExpanded ( ) ) { NodeItem c = ( NodeItem ) n . getFirstChild ( ) ; for ( ; c != null ; c = ( NodeItem ) c . getNextSibling ( ) ) { area += c . getDouble ( AREA ) ; ++ leafCount ; } } n . setDouble ( AREA , area ) ; } Rectangle2D b = getLayoutBounds ( ) ; double area = ( b . getWidth ( ) - 1 ) * ( b . getHeight ( ) - 1 ) ; double scale = area / root . getDouble ( AREA ) ; iter = new TreeNodeIterator ( root ) ; while ( iter . hasNext ( ) ) { NodeItem n = ( NodeItem ) iter . next ( ) ; n . setDouble ( AREA , n . getDouble ( AREA ) * scale ) ; } }
compute the pixel areas of nodes based on their size values .
