/** * Layout the given list of nodes in one column. * * @param l the list of nodes. * @param layoutHeight the height of the column. * @param layoutX the x start value. * @param layoutY the y start value. * @param areaScale the scale factor used to convert from node area to layout area. * @return the layout width of the column. */ private <T> double layoutList( List<ITreeMapNode<T>> l, double layoutHeight, double layoutX, double layoutY, double areaScale) { double nodeArea = 0; for (ITreeMapNode<T> node : l) { nodeArea += node.getArea(); } double layoutWidth = nodeArea * areaScale / layoutHeight; for (ITreeMapNode<T> node : l) { double nodeHeight = node.getArea() * areaScale / layoutWidth; node.setLayoutRectangle(new Rectangle2D.Double(layoutX, layoutY, layoutWidth, nodeHeight)); layoutY += nodeHeight; layoutChildren(node); } return layoutWidth; }
/** {@inheritDoc} */ @Override public <T> void layout(ITreeMapNode<T> tree, Rectangle2D target) { tree.setLayoutRectangle(target); layoutChildren(tree); }