|
Java Platform 1.2 Beta 4 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.awt.geom.RectangularShape
|
+--java.awt.geom.Rectangle2D
This class is only the abstract superclass for all objects which store a 2D rectangle. The actual storage representation of the coordinates is left to the subclass.
| Inner Class Summary | |
| static | Rectangle2D.Double
A rectangle specified in double coordinates. |
| static | Rectangle2D.Float
A rectangle specified in float coordinates. |
| Field Summary | |
| static int | OUT_BOTTOM
The bitmask which indicates that a point lies below this Rectangle. |
| static int | OUT_LEFT
The bitmask which indicates that a point lies to the left of this Rectangle. |
| static int | OUT_RIGHT
The bitmask which indicates that a point lies to the right of this Rectangle. |
| static int | OUT_TOP
The bitmask which indicates that a point lies above this Rectangle. |
| Constructor Summary | |
| Rectangle2D()
This is an abstract class that cannot be instantiated directly. |
|
| Method Summary | |
| void | add(double newx,
double newy)
Adds a point, specified by the double precision arguments newx and newy, to this rectangle.
|
| void | add(Point2D pt)
Adds the Point2D object pt to this rectangle.
|
| void | add(Rectangle2D r)
Adds a Rectangle2D object to this rectangle. |
| boolean | contains(double x,
double y,
double w,
double h)
Test if the interior of the Shape entirely contains the given set of rectangular coordinates. |
| boolean | contains(double x,
double y)
Test if a given coordinate is inside the boundary of the shape. |
| abstract Rectangle2D | createIntersection(Rectangle2D r)
Return a new Rectangle2D object representing the intersection of this rectangle with the given rectangle. |
| abstract Rectangle2D | createUnion(Rectangle2D r)
Return a new Rectangle2D object representing the union of this rectangle with the given rectangle. |
| boolean | equals(Object obj)
Determines whether two rectangles are equal. |
| Rectangle2D | getBounds2D()
Return the high precision bounding box of the shape. |
| PathIterator | getPathIterator(AffineTransform at,
double flatness)
Return an iteration object that defines the boundary of the flattened shape. |
| PathIterator | getPathIterator(AffineTransform at)
Return an iteration object that defines the boundary of the shape. |
| static void | intersect(Rectangle2D src1,
Rectangle2D src2,
Rectangle2D dest)
Intersect the pair of Rectangles and put the result into the indicated destination Rectangle2D object. |
| boolean | intersects(double x,
double y,
double w,
double h)
Test if the interior of the Shape intersects the interior of a given set of rectangular coordinates. |
| boolean | intersectsLine(double x1,
double y1,
double x2,
double y2)
Tests if the given line segment intersects the interior of this Rectangle. |
| boolean | intersectsLine(Line2D l)
Tests if the given line segment intersects the interior of this Rectangle. |
| abstract int | outcode(double x,
double y)
Determines where the specified coordinates lie with respect to this Rectangle. |
| int | outcode(Point2D p)
Determines where the specified point lies with respect to this Rectangle. |
| void | setFrame(double x,
double y,
double w,
double h)
Sets the location and size of the outer bounds of this shape to the specified rectangular values. |
| abstract void | setRect(double x,
double y,
double w,
double h)
Sets the location and size of this rectangle to the specified double values. |
| void | setRect(Rectangle2D r)
Sets this rectangle to be the same as the specified Rectangle. |
| static void | union(Rectangle2D src1,
Rectangle2D src2,
Rectangle2D dest)
Union the pair of Rectangles and put the result into the indicated destination Rectangle2D object. |
| Methods inherited from class java.awt.geom.RectangularShape | |
| clone , contains , contains , getBounds , getCenterX , getCenterY , getFrame , getHeight , getMaxX , getMaxY , getMinX , getMinY , getWidth , getX , getY , intersects , isEmpty , setFrame , setFrame , setFrameFromCenter , setFrameFromCenter , setFrameFromDiagonal , setFrameFromDiagonal | |
| Methods inherited from class java.lang.Object | |
| finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait | |
| Field Detail |
public static final int OUT_LEFT
public static final int OUT_TOP
public static final int OUT_RIGHT
public static final int OUT_BOTTOM
| Constructor Detail |
protected Rectangle2D()
Rectangle2D.Float,
Rectangle2D.Double,
Rectangle| Method Detail |
public abstract void setRect(double x,
double y,
double w,
double h)
public void setRect(Rectangle2D r)
public boolean intersectsLine(double x1,
double y1,
double x2,
double y2)
public boolean intersectsLine(Line2D l)
public abstract int outcode(double x,
double y)
OUT_LEFT,
OUT_TOP,
OUT_RIGHT,
OUT_BOTTOMpublic int outcode(Point2D p)
OUT_LEFT,
OUT_TOP,
OUT_RIGHT,
OUT_BOTTOM
public void setFrame(double x,
double y,
double w,
double h)
public Rectangle2D getBounds2D()
public boolean contains(double x,
double y)
public boolean intersects(double x,
double y,
double w,
double h)
public boolean contains(double x,
double y,
double w,
double h)
public abstract Rectangle2D createIntersection(Rectangle2D r)
r
- the rectangle to be intersected with
public static void intersect(Rectangle2D src1,
Rectangle2D src2,
Rectangle2D dest)
src1
- the first rectangle to be intersected
src2
- the second rectangle to be intersected
dest
- the rectangle to store the results inpublic abstract Rectangle2D createUnion(Rectangle2D r)
r
- the rectangle to be combined with
public static void union(Rectangle2D src1,
Rectangle2D src2,
Rectangle2D dest)
src1
- the first rectangle to be combined
src2
- the second rectangle to be combined
dest
- the rectangle to store the results in
public void add(double newx,
double newy)
newx and newy, to this rectangle.
The resulting rectangle is the smallest rectangle that
contains both the original rectangle and the specified point.
After adding a point, a call to contains with the
added point as an argument will not necessarily return
true. The contains method does not
return true for points on the right or bottom
edges of a rectangle. Therefore if the added point falls on
the left or bottom edge of the enlarged rectangle,
contains will return false for that point.
newx
- the x coordinate of the new point.
newy
- the y coordinate of the new point.
public void add(Point2D pt)
pt to this rectangle.
The resulting rectangle is the smallest rectangle that
contains both the original rectangle and the specified point.
After adding a point, a call to contains with the
added point as an argument will not necessarily return
true. The contains method does not
return true for points on the right or bottom
edges of a rectangle. Therefore if the added point falls on
the left or bottom edge of the enlarged rectangle,
contains will return false for that point.
pt
- the new point to add to the rectangle.
public void add(Rectangle2D r)
a
- rectangle.public PathIterator getPathIterator(AffineTransform at)
at
- the AffineTransform by which to transform the points
public PathIterator getPathIterator(AffineTransform at,
double flatness)
at
- the AffineTransform by which to transform the points
flatness
- the maximum approximation error desired for the
flattened pathpublic boolean equals(Object obj)
Rectangle2D are equal if their location and size
are the same.
obj
- an object to be compared with this rectangle.true if the object to be compared is
an instance of Rectangle2D and has
the same values; false otherwise.
|
Java Platform 1.2 Beta 4 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||