protected Rectangle getRectWithOlds ( Rectangle r , List < BubbleGlyph > oldbubs ) { int n = oldbubs . size ( ) ; // if no old bubs, just return the new one. if ( n == 0 ) { return r ; } // otherwise, encompass all the oldies Rectangle bigR = null ; for ( int ii = 0 ; ii < n ; ii ++ ) { BubbleGlyph bub = oldbubs . get ( ii ) ; if ( ii == 0 ) { bigR = bub . getBubbleBounds ( ) ; } else { bigR = bigR . union ( bub . getBubbleBounds ( ) ) ; } } // and add space for the new boy bigR . width = Math . max ( bigR . width , r . width ) ; bigR . height += r . height ; return bigR ; }
Get a rectangle based on the old bubbles but with room for the new one .