private double spacing(NodeItem l, NodeItem r, boolean siblings) { boolean w = ( m_orientation == Constants.ORIENT_TOP_BOTTOM || m_orientation == Constants.ORIENT_BOTTOM_TOP ); return (siblings ? m_bspace : m_tspace) + 0.5 * ( w ? l.getBounds().getWidth() + r.getBounds().getWidth() : l.getBounds().getHeight() + r.getBounds().getHeight() ); }
private void updateDepths(int depth, NodeItem item) { boolean v = ( m_orientation == Constants.ORIENT_TOP_BOTTOM || m_orientation == Constants.ORIENT_BOTTOM_TOP ); double d = ( v ? item.getBounds().getHeight() : item.getBounds().getWidth() ); if ( m_depths.length <= depth ) m_depths = ArrayLib.resize(m_depths, 3*depth/2); m_depths[depth] = Math.max(m_depths[depth], d); m_maxDepth = Math.max(m_maxDepth, depth); }
private void arrangeChildVertically( NodeItem parent ) { double maxW = 0; for( int i = 0; i < parent.getChildCount(); i++ ) { NodeItem node = (NodeItem) parent.getChild( i ); Rectangle2D bounds = node.getBounds(); maxW = Math.max( maxW, bounds.getWidth() ); } for( int i = 0; i < parent.getChildCount(); i++ ) { NodeItem node = (NodeItem) parent.getChild( i ); Rectangle2D bounds = node.getBounds(); node.setBounds( bounds.getX(), bounds.getY(), maxW, bounds.getHeight() ); } }
private void arrangeChildHorizontally( NodeItem parent ) { double maxH = 0; for( int i = 0; i < parent.getChildCount(); i++ ) { NodeItem node = (NodeItem) parent.getChild( i ); Rectangle2D bounds = node.getBounds(); maxH = Math.max( maxH, bounds.getHeight() ); } for( int i = 0; i < parent.getChildCount(); i++ ) { NodeItem node = (NodeItem) parent.getChild( i ); Rectangle2D bounds = node.getBounds(); node.setBounds( bounds.getX(), bounds.getY(), bounds.getWidth(), maxH ); } } }
/** * Computes relative measures of the angular widths of each * expanded subtree. Node diameters are taken into account * to improve space allocation for variable-sized nodes. * * This method also updates the base angle value for nodes * to ensure proper ordering of nodes. */ private double calcAngularWidth(NodeItem n, int d) { if ( d > m_maxDepth ) m_maxDepth = d; double aw = 0; Rectangle2D bounds = n.getBounds(); double w = bounds.getWidth(), h = bounds.getHeight(); double diameter = d==0 ? 0 : Math.sqrt(w*w+h*h) / d; if ( n.isExpanded() && n.getChildCount() > 0 ) { Iterator childIter = n.children(); while ( childIter.hasNext() ) { NodeItem c = (NodeItem)childIter.next(); aw += calcAngularWidth(c,d+1); } aw = Math.max(diameter, aw); } else { aw = diameter; } ((Params)n.get(PARAMS)).width = aw; return aw; }
private void updateArea(NodeItem n, Rectangle2D r) { Rectangle2D b = n.getBounds(); if ( m_frame == 0.0 ) {
@Override public void run( double frac ) { // setup NodeItem root = getLayoutRoot(); layout( root, 0, 0 ); Rectangle2D bounds = root.getBounds(); Display display = this.getVisualization().getDisplay( 0 ); Dimension size = new Dimension( (int) bounds.getWidth(), (int) bounds.getHeight() ); display.setSize( size ); if( !display.isValid() ) { display.validate(); } }
Rectangle2D b = p.getBounds(); switch ( m_orientation ) { case Constants.ORIENT_LEFT_RIGHT:
Rectangle2D bounds = stackedLayout.getLayoutRoot().getBounds();