/** * Compute the tree map layout. */ private void layout(NodeItem p, Rectangle2D r) { // create sorted list of children Iterator childIter = p.children(); while ( childIter.hasNext() ) m_kids.add(childIter.next()); Collections.sort(m_kids, s_cmp); // do squarified layout of siblings double w = Math.min(r.getWidth(),r.getHeight()); squarify(m_kids, m_row, w, r); m_kids.clear(); // clear m_kids // recurse childIter = p.children(); while ( childIter.hasNext() ) { NodeItem c = (NodeItem)childIter.next(); if ( c.getChildCount() > 0 && c.getDouble(AREA) > 0 ) { updateArea(c,r); layout(c, r); } } }
setY(n, p, y+d); double nw = n.getDouble(AREA)/h; if ( horiz ) { setNodeDimensions(n,nw,h);
NodeItem c = (NodeItem)n.getFirstChild(); for (; c!=null; c = (NodeItem)c.getNextSibling()) { area += c.getDouble(AREA); ++leafCount; 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);