Graph g = (Graph)m_vis.getGroup(m_group);
TupleSet nodes = g.getNodes();
nodes.addColumns(AREA_SCHEMA);
// reset all sizes to zero
Iterator iter = new TreeNodeIterator(root);
while ( iter.hasNext() ) {
NodeItem n = (NodeItem)iter.next();
n.setDouble(AREA, 0);
}
// set raw sizes, compute leaf count
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);
}
// scale sizes by display area factor
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);
}
}