/** * Return a copy of this node's full bounds. These bounds are stored in the * parent coordinate system of this node and they include the union of this * node's bounds and all the bounds of it's descendants. * * @return a copy of this node's full bounds. */ public PBounds getFullBounds() { return (PBounds) getFullBoundsReference().clone(); }
/** * Return true if the full bounds of this node intersects with the specified * bounds. * * @param parentBounds the bounds to test for intersection against * (specified in parent's coordinate system) * @return true if this nodes full bounds intersect the given bounds. */ public boolean fullIntersects(final Rectangle2D parentBounds) { if (parentBounds == null) { return true; } return getFullBoundsReference().intersects(parentBounds); }
/** * Rotates this node by theta (in radians), and then translates the node so * that the x, y position of its fullBounds stays constant. * * @param theta the amount to rotate by in radians */ public void rotateInPlace(final double theta) { PBounds b = getFullBoundsReference(); final double px = b.x; final double py = b.y; rotateAboutPoint(theta, 0, 0); b = getFullBoundsReference(); offset(px - b.x, py - b.y); }
/** * Center the full bounds of this node so that they are centered on the * given point specified on the local coordinates of this nodes parent. Note * that this method will modify the nodes transform, while * centerBoundsOnPoint will modify the nodes bounds. * * @param parentX x position around which to center full bounds * @param parentY y position around which to center full bounds */ public void centerFullBoundsOnPoint(final double parentX, final double parentY) { final double dx = parentX - getFullBoundsReference().getCenterX(); final double dy = parentY - getFullBoundsReference().getCenterY(); offset(dx, dy); }
/** * Return a new Image representing this node and all of its children. The * image size will be equal to the size of this nodes full bounds. * * @return a new image representing this node and its descendants */ public Image toImage() { final PBounds b = getFullBoundsReference(); return toImage((int) Math.ceil(b.getWidth()), (int) Math.ceil(b.getHeight()), null); }
/** * Mark the area on the screen represented by this nodes full bounds as * needing a repaint. */ public void repaint() { TEMP_REPAINT_BOUNDS.setRect(getFullBoundsReference()); repaintFrom(TEMP_REPAINT_BOUNDS, this); }
/** * Compute and return the union of the full bounds of all the children of * this node. If the dstBounds parameter is not null then it will be used to * return the results instead of creating a new PBounds. * * @param dstBounds if not null the new bounds will be stored here * @return union of children bounds */ public PBounds getUnionOfChildrenBounds(final PBounds dstBounds) { PBounds resultBounds; if (dstBounds == null) { resultBounds = new PBounds(); } else { resultBounds = dstBounds; resultBounds.resetToZero(); } final int count = getChildrenCount(); for (int i = 0; i < count; i++) { final PNode each = (PNode) children.get(i); resultBounds.add(each.getFullBoundsReference()); } return resultBounds; }
nodeBounds.setRect(each.getFullBoundsReference());