Rectangle2D getBounds() { Rectangle2D vb = null; for (LineComponent lineComponent : components) { Rectangle2D componentVisualBounds = lineComponent.getGlyphVector().getVisualBounds(); Rectangle2D componentLogicalBounds = lineComponent.getGlyphVector().getLogicalBounds(); // the logical bounds include the spaces, we want them in the horizontal direction // in order to compose the element in the row, but we need the visual bounds for // vertical alignment Rectangle2D componentBounds = new Rectangle2D.Double( componentLogicalBounds.getX(), componentVisualBounds.getY(), componentLogicalBounds.getWidth(), componentVisualBounds.getHeight()); if (vb == null) { vb = componentBounds; } else { Rectangle2D other = new Rectangle2D.Double( vb.getMaxX(), vb.getMinY(), componentBounds.getWidth(), componentBounds.getHeight()); vb = vb.createUnion(other); } } return vb; }
public Rect getMetrics() { if (text == null || text.length() == 0) return new Rect(); TextLayoutIterator iterator = new TextLayoutIterator(); Rectangle2D bounds = new Rectangle2D.Double(); while (iterator.hasNext()) { TextLayout layout = iterator.next(); // TODO: Compensate X, Y bounds = bounds.createUnion(layout.getBounds()); } return new Rect(bounds); }
bounds = bounds.createUnion(shieldBounds);
boundsY += lineOffset; labelY += lineOffset; labelBounds = labelBounds.createUnion(translated);
private void addBoundsFor(Rectangle2D r) { if (bounds == null) { bounds = r; } else { bounds = bounds.createUnion(r); } } /** iterate over all children and update the bounds Called after removing from the collection */
static Rectangle2D boundingBox(Collection<Rectangle2D> rectangles) { Rectangle2D boundingBox = null; for (Rectangle2D rectangle : rectangles) { if (boundingBox == null) { boundingBox = rectangle; } else { boundingBox = boundingBox.createUnion(rectangle); } } return boundingBox; }
static <T> Rectangle2D entryBoundingBox(Collection<Map.Entry<T, Rectangle2D>> entries) { Rectangle2D boundingBox = null; for (Map.Entry<T, Rectangle2D> entry : entries) { Rectangle2D rectangle = entry.getValue(); if (boundingBox == null) { boundingBox = rectangle; } else { boundingBox = boundingBox.createUnion(rectangle); } } return boundingBox; }
private void updateBounds(Rectangle2D r) { if (bounds.isPresent()) { bounds = Optional.of(bounds.get().createUnion(r)); } else { bounds = Optional.of(r); } Rectangle2D b = bounds.get(); }
static <T> Rectangle2D nodeBoundingBox(Collection<Node<T>> nodes) { Rectangle2D boundingBox = null; for (Node<T> node : nodes) { Rectangle2D rectangle = node.getBounds(); if (boundingBox == null) { boundingBox = rectangle; } else { boundingBox = boundingBox.createUnion(rectangle); } } return boundingBox; }
static Rectangle2D union(Collection<? extends Bounded> boundedItems) { Rectangle2D union = null; for (Bounded r : boundedItems) { if (union == null) { union = r.getBounds(); } else { union = r.getBounds().createUnion(union); } } return union; }
private Rectangle2D getBounds(Collection<? extends Bounded> nodes) { Rectangle2D bounds = null; for (Bounded b : nodes) { if (bounds == null) bounds = b.getBounds(); else { bounds = bounds.createUnion(b.getBounds()); } } return bounds; }
private void addBoundsFor(B kid) { if (bounds == null) { bounds = kid.getBounds(); } else { bounds = bounds.createUnion(kid.getBounds()); } } /** iterate over all children and update the bounds Called after removing from the collection */
@Override public Rectangle2D boundingBox() { Rectangle2D res = null; AttributeSet style = renderStyle(); for (O o : primitive) { Rectangle2D oBounds = renderer.boundingBox(o, style); res = res == null ? oBounds : res.createUnion(oBounds); } return res; }
@Override public Rectangle2D getLogicalBounds() { if (getNumGlyphs() == 0) { return new Rectangle(); } return getGlyphLogicalBounds(0).getBounds2D().createUnion( getGlyphLogicalBounds(getNumGlyphs() - 1).getBounds2D()); }
@Override public Rectangle2D getVisualBounds() { if (getNumGlyphs() == 0) { return new Rectangle(); } return getGlyphVisualBounds(0).getBounds2D().createUnion( getGlyphVisualBounds(getNumGlyphs() - 1).getBounds2D()); }
/** * Returns the rectangular bounds of the completed glyph layout, * inclusive of "decoration" (underline, overline, etc.) */ public Rectangle2D getGeometricBounds() { syncLayout(); Rectangle2D gvB, decB; gvB = gv.getGeometricBounds(); decB = getDecorationOutline(DECORATION_ALL).getBounds2D(); return gvB.createUnion(decB); }
/** * Returns the rectangular bounds of the completed glyph layout, * inclusive of "decoration" (underline, overline, etc.) */ public Rectangle2D getGeometricBounds() { syncLayout(); Rectangle2D gvB, decB; gvB = gv.getGeometricBounds(); decB = getDecorationOutline(DECORATION_ALL).getBounds2D(); return gvB.createUnion(decB); }
/** * Returns the rectangular bounds of the completed glyph layout, * inclusive of "decoration" (underline, overline, etc.) */ public Rectangle2D getGeometricBounds() { syncLayout(); Rectangle2D gvB, decB; gvB = gv.getGeometricBounds(); decB = getDecorationOutline(DECORATION_ALL).getBounds2D(); return gvB.createUnion(decB); }
public static Rectangle getBoundingBox(SpatialEntity... entities) { Rectangle2D combination = entities[0].getBoundingBox(); for(int i = 1; i < entities.length; i++) { combination = combination.createUnion(entities[i].getBoundingBox()); } return new Rectangle(combination); }
public Rectangle2D getBounds(){ Rectangle2D bounds=size()>0?getBounds(0):new Rectangle2D.Double(0,0,0,0); for(int i=1;i<size();i++){ bounds=bounds.createUnion(getBounds(i)); } return bounds; }