public class Rectangle
extends java.lang.Object
Rectangle
class defines a rectangle specified in Rectangle
coordinates.Modifier and Type | Field and Description |
---|---|
double |
height
The height of this
Rectangle . |
static int |
OUT_BOTTOM
The bitmask that indicates that a point lies below this
Rectangle2D . |
static int |
OUT_LEFT
The bitmask that indicates that a point lies to the left of this
Rectangle2D . |
static int |
OUT_RIGHT
The bitmask that indicates that a point lies to the right of this
Rectangle2D . |
static int |
OUT_TOP
The bitmask that indicates that a point lies above this
Rectangle2D . |
double |
width
The width of this
Rectangle . |
double |
x
The x coordinate of this
Rectangle . |
double |
y
The y coordinate of this
Rectangle . |
Constructor and Description |
---|
Rectangle()
Constructs a new
Rectangle , initialized to location
(0, 0) and size (0, 0). |
Rectangle(BoundingBox bb) |
Rectangle(double x,
double y,
double w,
double h)
Constructs and initializes a
Rectangle from the specified
Rectangle coordinates. |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Point lo) |
Rectangle |
createIntersection(Rectangle r)
Returns a new
Rectangle object representing the
intersection of this Rectangle with the specified
Rectangle . |
Rectangle |
createUnion(Rectangle r)
Returns a new
Rectangle object representing the union of
this Rectangle with the specified Rectangle . |
Bounds |
getBounds() |
Rectangle |
getBounds2D()
Returns the high precision bounding box of this
Rectangle . |
double |
getHeight()
Returns the height of this
Rectangle in Rectangle
precision. |
double |
getMaxX()
Returns the largest X coordinate of the framing rectangle of the
Rectangle in double precision. |
double |
getMaxY()
Returns the largest Y coordinate of the framing rectangle of the
Rectangle in double precision. |
double |
getMinX()
Returns the smallest X coordinate of the framing rectangle of the
Rectangle in double precision. |
double |
getMinY()
Returns the smallest Y coordinate of the framing rectangle of the
Rectangle in double precision. |
double |
getWidth()
Returns the width of this
Rectangle in Rectangle
precision. |
double |
getX()
Returns the X coordinate of this
Rectangle in Rectangle
precision. |
double |
getY()
Returns the Y coordinate of this
Rectangle in Rectangle
precision. |
boolean |
isEmpty()
Determines whether or not this
Rectangle is empty. |
int |
outcode(double x,
double y)
Determines where the specified Rectangle coordinates lie with respect to
this
Rectangle . |
void |
setRect(double x,
double y,
double w,
double h)
Sets the location and size of this
Rectangle to the
specified Rectangle values. |
void |
setRect(Rectangle r)
Sets this
Rectangle to be the same as the specified
Rectangle . |
java.lang.String |
toString()
Returns the
String representation of this
Rectangle . |
void |
union(Rectangle rect) |
static Rectangle |
union(Rectangle rect1,
Rectangle rect2) |
public static final int OUT_LEFT
Rectangle2D
.public static final int OUT_TOP
Rectangle2D
.public static final int OUT_RIGHT
Rectangle2D
.public static final int OUT_BOTTOM
Rectangle2D
.public double x
Rectangle
.public double y
Rectangle
.public double width
Rectangle
.public double height
Rectangle
.public Rectangle()
Rectangle
, initialized to location
(0, 0) and size (0, 0).public Rectangle(BoundingBox bb)
public Rectangle(double x, double y, double w, double h)
Rectangle
from the specified
Rectangle coordinates.x, y
- the coordinates of the upper left corner of the newly
constructed Rectangle
w
- the width of the newly constructed Rectangle
h
- the height of the newly constructed Rectangle
public Bounds getBounds()
public double getX()
Rectangle
in Rectangle
precision.Rectangle
.public double getY()
Rectangle
in Rectangle
precision.Rectangle
.public double getWidth()
Rectangle
in Rectangle
precision.Rectangle
.public double getHeight()
Rectangle
in Rectangle
precision.Rectangle
.public boolean isEmpty()
Rectangle
is empty.true
if this Rectangle
is empty;
false
otherwise.public void setRect(double x, double y, double w, double h)
Rectangle
to the
specified Rectangle values.x, y
- the coordinates to which to set the upper left corner of this
Rectangle
w
- the value to use to set the width of this double
h
- the value to use to set the height of this double
public void setRect(Rectangle r)
Rectangle
to be the same as the specified
Rectangle
.r
- the specified Rectangle
public int outcode(double x, double y)
Rectangle
. This method computes a binary OR of the
appropriate mask values indicating, for each side of this
Rectangle
, whether or not the specified coordinates are
on the same side of the edge as the rest of this Rectangle
.x, y
- the specified coordinatesOUT_LEFT
,
OUT_TOP
,
OUT_RIGHT
,
OUT_BOTTOM
public Rectangle getBounds2D()
Rectangle
.Rectangle
.public Rectangle createIntersection(Rectangle r)
Rectangle
object representing the
intersection of this Rectangle
with the specified
Rectangle
.r
- the Rectangle
to be intersected with this
Rectangle
Rectangle
contained in both the
specified Rectangle
and in this
Rectangle
.public Rectangle createUnion(Rectangle r)
Rectangle
object representing the union of
this Rectangle
with the specified Rectangle
.r
- the Rectangle
to be combined with this
Rectangle
Rectangle
containing both the
specified Rectangle
and this
Rectangle
.public void union(Rectangle rect)
public java.lang.String toString()
String
representation of this
Rectangle
.toString
in class java.lang.Object
String
representing this Rectangle
.public double getMinX()
Rectangle
in double
precision.Rectangle
.public double getMinY()
Rectangle
in double
precision.Rectangle
.public double getMaxX()
Rectangle
in double
precision.Rectangle
.public double getMaxY()
Rectangle
in double
precision.Rectangle
.public boolean contains(Point lo)
Copyright © 2005-2008 Actuate Corp. All rights reserved.