public class PBounds extends Rectangle2D.Double implements Serializable
Rectangle2D.Double, Rectangle2D.Floatheight, width, x, yOUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP| Constructor and Description |
|---|
PBounds()
Creates an empty bounds.
|
PBounds(double x,
double y,
double width,
double height)
Constructs a PBounds object at the given coordinates with the given
dimensions.
|
PBounds(PBounds aBounds)
Creates a bounds identical to the one provided.
|
PBounds(Point2D aCenterPoint,
double insetX,
double insetY)
Constructs a PBounds object with the given center point and the specified
insets.
|
PBounds(Rectangle2D aBounds)
Creates a bounds with the same shape as the rectangle provided.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(double newx,
double newy)
Grows the bounds to contain the coordinate provided.
|
void |
add(PBounds bounds)
Changes this bounds to contain the provided bounds.
|
void |
add(Rectangle2D r)
Grows bounds to contain the rectangle if needed.
|
Object |
clone()
Returns a clone of this node.
|
PDimension |
deltaRequiredToCenter(Rectangle2D targetBounds)
Returns the required translation in order for this bounds origin to sit
on the center of the provided rectangle.
|
PDimension |
deltaRequiredToContain(Rectangle2D targetBounds)
Returns the required translation in order for these to contain the bounds
provided.
|
void |
expandNearestIntegerDimensions()
Rounds the rectangle to the next largest bounds who's measurements are
integers.
|
Point2D |
getCenter2D()
Returns the midpoint of the bounds.
|
Point2D |
getOrigin()
Returns the x,y coordinate of the bounds.
|
Dimension2D |
getSize()
Returns the size of the bounds.
|
PBounds |
inset(double dx,
double dy)
Adjust the measurements of this bounds so that they are the amounts given
"in" from their previous border.
|
boolean |
isEmpty()
Returns true if this bounds has been flagged as empty.
|
PBounds |
moveBy(double dx,
double dy)
Translates the bounds by the given deltas.
|
PBounds |
reset()
Flags this bounds as empty.
|
PBounds |
resetToZero()
Resets the bounds to (0,0,0,0) and flags it as empty.
|
PBounds |
setOrigin(double x,
double y)
Changes the origin of these bounds.
|
void |
setRect(double x,
double y,
double width,
double height)
Sets the shape of the bounds to the position and dimension provided.
|
void |
setRect(PBounds b)
Sets the bounds to the same shape as the bounds provided.
|
void |
setRect(Rectangle2D r)
Sets the bounds to the same shape as the rectangle.
|
void |
setSize(double width,
double height)
Changes the size of the bounds, but retains the origin.
|
String |
toString()
Returns a string representation of this PBounds for debugging purposes.
|
createIntersection, createUnion, getBounds2D, getHeight, getWidth, getX, getY, outcodeadd, contains, contains, equals, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, unioncontains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonalpublic PBounds()
public PBounds(PBounds aBounds)
aBounds - bounds to be copiedpublic PBounds(Rectangle2D aBounds)
aBounds - rectangle to be copiedpublic PBounds(Point2D aCenterPoint, double insetX, double insetY)
aCenterPoint - resulting center point of the PBounds objectinsetX - distance from left and right the center should beinsetY - distance from top and bottom the center should bepublic PBounds(double x,
double y,
double width,
double height)
x - left of boundsy - top of boundswidth - width of boundsheight - height of boundspublic Object clone()
clone in class RectangularShapepublic boolean isEmpty()
isEmpty in class Rectangle2D.Doublepublic PBounds reset()
public PBounds resetToZero()
public void setRect(Rectangle2D r)
setRect in class Rectangle2D.Doubler - rectangle to copypublic void setRect(PBounds b)
b - bounds to copypublic void setRect(double x,
double y,
double width,
double height)
setRect in class Rectangle2D.Doublex - new left of boundsy - new top of boundswidth - new width of boundsheight - new height of boundspublic void add(double newx,
double newy)
add in class Rectangle2Dnewx - x component of pointnewy - y component of pointpublic void add(Rectangle2D r)
add in class Rectangle2Dr - rectangle being addedpublic void add(PBounds bounds)
bounds - bounds being addedpublic Point2D getOrigin()
public PBounds setOrigin(double x, double y)
x - new x component of boundsy - new y component of the boundspublic Dimension2D getSize()
public void setSize(double width,
double height)
width - new width of the boundsheight - new height of the boundspublic Point2D getCenter2D()
public PBounds moveBy(double dx, double dy)
dx - amount to move xdy - amount to move ypublic void expandNearestIntegerDimensions()
public PBounds inset(double dx, double dy)
dx - amount to move in from border along horizontal axisdy - amount to move in from border along vertical axispublic PDimension deltaRequiredToCenter(Rectangle2D targetBounds)
targetBounds - rectangle to measure the center ofpublic PDimension deltaRequiredToContain(Rectangle2D targetBounds)
targetBounds - rectangle to measure the center ofpublic String toString()
toString in class Rectangle2D.DoubleCopyright © 1995-2013 Piccolo2D. All Rights Reserved.