diff options
author | Sven Gothel <[email protected]> | 2023-04-29 03:18:25 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-04-29 03:18:25 +0200 |
commit | 45298f3d4ef14cf3cc8eafb568f8b891c0aa4b41 (patch) | |
tree | b19c371ecd9155bd4736ce01d0eb5e3c46ef3bfb /src/graphui/classes/com | |
parent | a9c76153fd9a472679c1fc85189f6d4ecda7979e (diff) |
GraphUI GridLayout: Remove old unused layout0(..) method
Diffstat (limited to 'src/graphui/classes/com')
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java | 134 |
1 files changed, 0 insertions, 134 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java b/src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java index acc82208f..6990ac75d 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java +++ b/src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java @@ -118,9 +118,6 @@ public class GridLayout implements Group.Layout { @Override public void layout(final Group g, final AABBox box, final PMVMatrix pmv) { - layout1(g, box, pmv); - } - private void layout1(final Group g, final AABBox box, final PMVMatrix pmv) { final Vec3f zeroVec3 = new Vec3f(); final boolean hasCellWidth = !FloatUtil.isZero(cellWidth); final boolean hasCellHeight = !FloatUtil.isZero(cellHeight); @@ -319,137 +316,6 @@ public class GridLayout implements Group.Layout { } } - /** - * A fast path layout for set cellWidth > 0 && cellHeight > 0, - * w/o consideration of individual shape height. - */ - @SuppressWarnings("unused") - private void layout0(final Group g, final AABBox box, final PMVMatrix pmv) { - final Vec3f zeroVec3 = new Vec3f(); - final boolean hasCellWidth = !FloatUtil.isZero(cellWidth); - final boolean hasCellHeight = !FloatUtil.isZero(cellHeight); - if( !hasCellWidth || !hasCellHeight ) { - throw new IllegalArgumentException(toString()); - } - final boolean isCenteredHoriz = hasCellWidth && alignment.isSet(Alignment.Bit.Center); - final boolean isCenteredVert = hasCellHeight && alignment.isSet(Alignment.Bit.Center); - final boolean isScaled = alignment.isSet(Alignment.Bit.Fill) && ( hasCellWidth || hasCellHeight ); - final List<Shape> shapes = g.getShapes(); - if( Order.COLUMN == order ) { - row_count = (int) Math.ceil( (double)shapes.size() / (double)col_limit ); - col_count = col_limit; - } else { // Order.ROW_MAJOR == order - row_count = row_limit; - col_count = (int) Math.ceil( (double)shapes.size() / (double)row_limit ); - } - if( TRACE_LAYOUT ) { - System.err.println("gl.00: "+row_count+" x "+col_count+", "+box); - } - int col_i = 0, row_i = 0; - final AABBox sbox = new AABBox(); - final Vec3f diffBL = new Vec3f(); - for(int i=0; i < shapes.size(); ++i) { - final Shape s = shapes.get(i); - - // measure size - pmv.glPushMatrix(); - s.setTransform(pmv); - { - final AABBox sbox0 = s.getBounds(); - sbox0.transformMv(pmv, sbox); - - if( !diffBL.set( sbox0.getLow().x(), sbox0.getLow().y(), 0).min( zeroVec3 ).isZero() ) { - // pmv.mulMvMatVec3f(diffBL).scale(-1f, -1f, 0f); - final Vec3f ss = s.getScale(); - diffBL.scale(-1f*ss.x(), -1f*ss.y(), 0f); - } - } - pmv.glPopMatrix(); - final float zPos = sbox.getCenter().z(); - - if( TRACE_LAYOUT ) { - System.err.println("gl["+i+"].0: "+s); - System.err.println("gl["+i+"].0: sbox "+sbox+", diffBL "+diffBL); - } - - // IF hasCell{Width|Height}: Uniform scale w/ lowest axis scale and center position on lower-scale axis - final float sxy; - float dxh = 0, dyh = 0; - if( isScaled ) { - // scaling to cell size - final float shapeWidthU = sbox.getWidth(); - final float shapeHeightU = sbox.getHeight(); - final float cellWidthU = hasCellWidth ? cellWidth : shapeWidthU; - final float cellHeightU = hasCellHeight ? cellHeight : shapeHeightU; - final float sx = cellWidthU / shapeWidthU; - final float sy = cellHeightU/ shapeHeightU; - sxy = sx < sy ? sx : sy; - dxh += shapeWidthU * ( sx - sxy ) * 0.5f; // adjustment for scale-axis - dyh += shapeHeightU * ( sy - sxy ) * 0.5f; // ditto - if( TRACE_LAYOUT ) { - System.err.println("gl["+i+"].s: "+sx+" x "+sy+" -> "+sxy+": +"+dxh+" / "+dyh+", U: s "+shapeWidthU+" x "+shapeHeightU+", sz "+cellWidthU+" x "+cellHeightU); - } - } else { - sxy = 1; - } - final float shapeWidthS = sxy*sbox.getWidth(); - final float shapeHeightS = sxy*sbox.getHeight(); - final float cellWidthS = hasCellWidth ? cellWidth : shapeWidthS; - final float cellHeightS = hasCellHeight ? cellHeight : shapeHeightS; - - final float x = ( ( col_i ) * ( cellWidthS + gap.width() ) ); - final float y = ( ( row_count - row_i - 1 ) * ( cellHeightS + gap.height() ) ); - - if( isCenteredHoriz ) { - dxh += 0.5f * ( cellWidthS - shapeWidthS ); // actual horiz-centered - } - if( isCenteredVert ) { - dyh += 0.5f * ( cellHeightS - shapeHeightS ); // actual vert-centered - } - if( TRACE_LAYOUT ) { - System.err.println("gl["+i+"].m: "+x+" / "+y+" + "+dxh+" / "+dyh+", S: s "+shapeWidthS+" x "+shapeHeightS+", sz "+cellWidthS+" x "+cellHeightS+", box "+box.getWidth()+" x "+box.getHeight()); - } - { - // New shape position, relative to previous position - final float aX = x + dxh; - final float aY = y + dyh; - s.moveTo( aX, aY, 0f ); - s.move( diffBL.scale(sxy) ); // remove the bottom-left delta - // s.move( sbox.getLow().mul(-1f) ); // remove the bottom-left delta - - // resize bounds including padding, excluding margin - box.resize( aX, aY, zPos); - box.resize( aX + cellWidthS, aY + cellHeightS, zPos); - } - s.scale( sxy, sxy, 1f); - - if( TRACE_LAYOUT ) { - System.err.println("gl["+i+"].x: "+x+" / "+y+" + "+dxh+" / "+dyh+" -> "+s.getPosition()+", p3 "+shapeWidthS+" x "+shapeHeightS+", sz3 "+cellWidthS+" x "+cellHeightS+", box "+box.getWidth()+" x "+box.getHeight()); - System.err.println("gl["+i+"].x: "+s); - } - - // position for next cell - if( Order.COLUMN == order ) { - if( col_i + 1 == col_count ) { - col_i = 0; - row_i++; - } else { - col_i++; - } - } else { // Order.ROW_MAJOR == order - if( row_i + 1 == row_count ) { - row_i = 0; - col_i++; - } else { - row_i++; - } - } - } - if( TRACE_LAYOUT ) { - System.err.println("gl.xx: "+box); - } - } - @Override public String toString() { return "Grid["+col_count+"x"+row_count+", "+order+", cell["+cellWidth+" x "+cellHeight+", a "+alignment+"], "+gap+"]"; |