public class IlvRect extends Rectangle2D.Double implements Serializable
IlvRect
class describes a rectangle
defined by a location (x, y) and dimension
(width x height).
This class is a serializable subclass of the Java class
Rectangle2D.Double
.
Rectangle2D.Double, Rectangle2D.Float
height, width, x, y
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
Constructor and Description |
---|
IlvRect()
Constructs a new
IlvRect , initialized to
location (0.0, 0.0) and size (0.0, 0.0). |
IlvRect(double x,
double y,
double width,
double height)
Constructs and initializes an
IlvRect
from the specified coordinates. |
IlvRect(IlvRect rect)
Creates a new
IlvRect by copying the specified one. |
Modifier and Type | Method and Description |
---|---|
void |
add(double px,
double py)
Adds a point, specified by the arguments
px and py , to this
IlvRect . |
void |
add(IlvRect rect)
Adds a
IlvRect object to this
IlvRect . |
boolean |
contains(IlvRect rect)
Tests if the rectangle contains the specified one.
|
boolean |
equalsOrNear(IlvRect otherRect)
Test equality of 2 IlvRect according default precision
|
void |
expand(double delta)
Expands current rectangle by
delta in x and y. |
void |
expand(double dx,
double dy)
Expands current rectangle by
dx in x and dy in y. |
void |
floor()
Modifies the rectangle so that the values becomes mathematical integers.
|
int |
heightFloor()
Returns the height of the rectangle as a mathematical integer.
|
boolean |
inside(double x,
double y)
Tests if a particular point lies inside the rectangle.
|
void |
intersection(IlvRect rect)
Computes the intersection of the rectangle with the specified rectangle.
|
boolean |
intersects(IlvRect rect)
Tests if the rectangle intersects another one.
|
void |
move(double x,
double y)
Changes the position of the rectangle.
|
void |
reshape(double x,
double y,
double width,
double height)
Reshapes the rectangle.
|
void |
resize(double width,
double height)
Changes the width and height of the rectangle.
|
String |
toString()
Returns a
String that represents the value
of this IlvRect . |
void |
translate(double dx,
double dy)
Translates the rectangle.
|
int |
widthFloor()
Returns the width of the rectangle as a mathematical integer.
|
int |
xFloor()
Returns the x coordinate of the rectangle as a mathematical integer.
|
int |
yFloor()
Returns the y coordinate of the rectangle as a mathematical integer.
|
createIntersection, createUnion, getBounds2D, getHeight, getWidth, getX, getY, isEmpty, outcode, setRect, setRect
add, add, contains, contains, equals, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, union
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
public IlvRect()
IlvRect
, initialized to
location (0.0, 0.0) and size (0.0, 0.0).public IlvRect(double x, double y, double width, double height)
IlvRect
from the specified coordinates.x
- the x coordinate of the
upper left corner of the newly constructed
IlvRect
y
- the y coordinate of the
upper left corner of the newly constructed
IlvRect
width
- the width of the newly constructed
IlvRect
height
- the height of the newly constructed
IlvRect
public IlvRect(IlvRect rect)
IlvRect
by copying the specified one.rect
- The copied rectangle.public final void add(double px, double py)
px
and py
, to this
IlvRect
. The resulting IlvRect
is the smallest IlvRect
that
contains both the original IlvRect
and the
specified point.add
in class Rectangle2D
public final void add(IlvRect rect)
IlvRect
object to this
IlvRect
. The resulting IlvRect
is the union of the two IlvRect
objects.rect
- the IlvRect
to add to this
IlvRect
.public final boolean inside(double x, double y)
public final void move(double x, double y)
public final void translate(double dx, double dy)
public final void resize(double width, double height)
public final void reshape(double x, double y, double width, double height)
public final void expand(double delta)
delta
in x and y.
If delta
is negative, and 2*delta
is bigger than the
current width, the new width is set to 0.
If delta
is negative, and 2*delta
is bigger than the
current height, the new height is set to 0.public final void expand(double dx, double dy)
dx
in x and dy
in y.
If dx
is negative, and 2*dx
is bigger than the
current width, the new width is set to 0.
If dy
is negative, and 2*dy
is bigger than the
current height, the new height is set to 0.public boolean equalsOrNear(IlvRect otherRect)
IlvUtil.isEqual(double, double)
public final boolean contains(IlvRect rect)
public final boolean intersects(IlvRect rect)
public final void intersection(IlvRect rect)
this
, the
rectangle passed as a parameter is not modified.public final void floor()
public final int xFloor()
public final int yFloor()
public final int widthFloor()
public final int heightFloor()
public String toString()
String
that represents the value
of this IlvRect
.toString
in class Rectangle2D.Double
IlvRect
.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.