public class IlvRect extends Rectangle2D.Float 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.Float
.
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(float x,
float y,
float width,
float 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(float px,
float 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.
|
void |
expand(float delta)
Expands current rectangle by
delta in x and y. |
void |
expand(float dx,
float 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(float x,
float 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(float x,
float y)
Changes the position of the rectangle.
|
void |
reshape(float x,
float y,
float width,
float height)
Reshapes the rectangle.
|
void |
resize(float width,
float height)
Changes the width and height of the rectangle.
|
String |
toString()
Returns a
String that represents the value
of this IlvRect . |
void |
translate(float dx,
float 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, setRect
add, 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(float x, float y, float width, float 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(float px, float py)
px
and py
, to this
IlvRect
. The resulting IlvRect
is the smallest IlvRect
that
contains both the original IlvRect
and the
specified point.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(float x, float y)
public final void move(float x, float y)
public final void translate(float dx, float dy)
public final void resize(float width, float height)
public final void reshape(float x, float y, float width, float height)
public final void expand(float 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(float dx, float 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 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.Float
IlvRect
.© Copyright Rogue Wave Software, Inc. 1997, 2016. All Rights Reserved.