/** * Return the y position (in local coords) of this node's bounds. * * @return local y position of bounds */ public double getY() { return getBoundsReference().getY(); }
/** * Return the width (in local coords) of this node's bounds. * * @return local width of bounds */ public double getWidth() { return getBoundsReference().getWidth(); }
/** * Return a copy of this node's bounds. These bounds are stored in the local * coordinate system of this node and do not include the bounds of any of * this node's children. * * @return copy of this node's local bounds */ public PBounds getBounds() { return (PBounds) getBoundsReference().clone(); }
/** * Return the x position (in local coords) of this node's bounds. * * @return local x position of bounds */ public double getX() { return getBoundsReference().getX(); }
/** * Return the height (in local coords) of this node's bounds. * * @return local width of bounds */ public double getHeight() { return getBoundsReference().getHeight(); }
/** * Paint this node behind any of its children nodes. Subclasses that define * a different appearance should override this method and paint themselves * there. * * @param paintContext the paint context to use for painting the node */ protected void paint(final PPaintContext paintContext) { if (paint != null) { final Graphics2D g2 = paintContext.getGraphics(); g2.setPaint(paint); g2.fill(getBoundsReference()); } }
/** * Return true if this node intersects the given rectangle specified in * local bounds. If the geometry of this node is complex this method can * become expensive, it is therefore recommended that * <code>fullIntersects</code> is used for quick rejects before calling this * method. * * @param localBounds the bounds to test for intersection against * @return true if the given rectangle intersects this nodes geometry. */ public boolean intersects(final Rectangle2D localBounds) { if (localBounds == null) { return true; } return getBoundsReference().intersects(localBounds); }
/** {@inheritDoc} */ public PBounds getBoundsReference() { final PBounds targetBounds = target.getFullBounds(); camera.viewToLocal(targetBounds); camera.globalToLocal(targetBounds); final PBounds bounds = super.getBoundsReference(); bounds.setRect(targetBounds); return super.getBoundsReference(); }
/** * Compute and return the full bounds 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 the full bounds in the parent coordinate system of this node */ public PBounds computeFullBounds(final PBounds dstBounds) { final PBounds result = getUnionOfChildrenBounds(dstBounds); result.add(getBoundsReference()); localToParent(result); return result; }
nodeBounds.setRect(each.getBoundsReference());