| java.lang.Object java.awt.geom.RectangularShape java.awt.geom.Rectangle2D
All known Subclasses: java.awt.Rectangle,
Rectangle2D | abstract public class Rectangle2D extends RectangularShape (Code) | | The Rectangle2D class describes a rectangle
defined by a location
(x,y) and dimension
(w x h) .
This class is only the abstract superclass for all objects that
store a 2D rectangle.
The actual storage representation of the coordinates is left to
the subclass.
version: 1.38, 05/05/07 author: Jim Graham since: 1.2 |
Field Summary | |
final public static int | OUT_BOTTOM The bitmask that indicates that a point lies below
this Rectangle2D . | final public static int | OUT_LEFT The bitmask that indicates that a point lies to the left of
this Rectangle2D . | final public static int | OUT_RIGHT The bitmask that indicates that a point lies to the right of
this Rectangle2D . | final public static int | OUT_TOP The bitmask that indicates that a point lies above
this Rectangle2D . |
Constructor Summary | |
protected | Rectangle2D() This is an abstract class that cannot be instantiated directly. |
Method Summary | |
public void | add(double newx, double newy) Adds a point, specified by the double precision arguments
newx and newy , to this
Rectangle2D . | public void | add(Point2D pt) Adds the Point2D object pt to this
Rectangle2D .
The resulting Rectangle2D is the smallest
Rectangle2D that contains both the original
Rectangle2D and the specified Point2D .
After adding a point, a call to contains with the
added point as an argument does not necessarily return
true . | public void | add(Rectangle2D r) Adds a Rectangle2D object to this
Rectangle2D . | public boolean | contains(double x, double y) | public boolean | contains(double x, double y, double w, double h) | abstract public Rectangle2D | createIntersection(Rectangle2D r) Returns a new Rectangle2D object representing the
intersection of this Rectangle2D with the specified
Rectangle2D . | abstract public Rectangle2D | createUnion(Rectangle2D r) Returns a new Rectangle2D object representing the
union of this Rectangle2D with the specified
Rectangle2D . | public boolean | equals(Object obj) Determines whether or not the specified Object is
equal to this Rectangle2D . | public Rectangle2D | getBounds2D() | public PathIterator | getPathIterator(AffineTransform at) Returns an iteration object that defines the boundary of this
Rectangle2D . | public PathIterator | getPathIterator(AffineTransform at, double flatness) Returns an iteration object that defines the boundary of the
flattened Rectangle2D . | public int | hashCode() Returns the hashcode for this Rectangle2D . | public static void | intersect(Rectangle2D src1, Rectangle2D src2, Rectangle2D dest) Intersects the pair of specified source Rectangle2D
objects and puts the result into the specified destination
Rectangle2D object. | public boolean | intersects(double x, double y, double w, double h) | public boolean | intersectsLine(double x1, double y1, double x2, double y2) Tests if the specified line segment intersects the interior of this
Rectangle2D . | public boolean | intersectsLine(Line2D l) Tests if the specified line segment intersects the interior of this
Rectangle2D . | abstract public int | outcode(double x, double y) Determines where the specified coordinates lie with respect
to this Rectangle2D . | public int | outcode(Point2D p) Determines where the specified
Point2D lies with
respect to this Rectangle2D . | public void | setFrame(double x, double y, double w, double h) Sets the location and size of the outer bounds of this
Rectangle2D to the specified rectangular values. | abstract public void | setRect(double x, double y, double w, double h) Sets the location and size of this Rectangle2D
to the specified double values. | public void | setRect(Rectangle2D r) Sets this Rectangle2D to be the same as the specified
Rectangle2D . | public static void | union(Rectangle2D src1, Rectangle2D src2, Rectangle2D dest) Unions the pair of source Rectangle2D objects
and puts the result into the specified destination
Rectangle2D object. |
OUT_BOTTOM | final public static int OUT_BOTTOM(Code) | | The bitmask that indicates that a point lies below
this Rectangle2D .
since: 1.2 |
OUT_LEFT | final public static int OUT_LEFT(Code) | | The bitmask that indicates that a point lies to the left of
this Rectangle2D .
since: 1.2 |
OUT_RIGHT | final public static int OUT_RIGHT(Code) | | The bitmask that indicates that a point lies to the right of
this Rectangle2D .
since: 1.2 |
OUT_TOP | final public static int OUT_TOP(Code) | | The bitmask that indicates that a point lies above
this Rectangle2D .
since: 1.2 |
Rectangle2D | protected Rectangle2D()(Code) | | This is an abstract class that cannot be instantiated directly.
Type-specific implementation subclasses are available for
instantiation and provide a number of formats for storing
the information necessary to satisfy the various accessor
methods below.
See Also: java.awt.geom.Rectangle2D.Float See Also: java.awt.geom.Rectangle2D.Double See Also: java.awt.Rectangle since: 1.2 |
add | public void add(double newx, double newy)(Code) | | Adds a point, specified by the double precision arguments
newx and newy , to this
Rectangle2D . The resulting Rectangle2D
is the smallest Rectangle2D that
contains both the original Rectangle2D and the
specified point.
After adding a point, a call to contains with the
added point as an argument does 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 returns false for that point.
Parameters: newx - the X coordinate of the new point Parameters: newy - the Y coordinate of the new point since: 1.2 |
add | public void add(Point2D pt)(Code) | | Adds the Point2D object pt to this
Rectangle2D .
The resulting Rectangle2D is the smallest
Rectangle2D that contains both the original
Rectangle2D and the specified Point2D .
After adding a point, a call to contains with the
added point as an argument does 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 returns false for that point.
Parameters: pt - the new Point2D to add to thisRectangle2D . since: 1.2 |
add | public void add(Rectangle2D r)(Code) | | Adds a Rectangle2D object to this
Rectangle2D . The resulting Rectangle2D
is the union of the two Rectangle2D objects.
Parameters: r - the Rectangle2D to add to thisRectangle2D . since: 1.2 |
contains | public boolean contains(double x, double y)(Code) | | since: 1.2 |
contains | public boolean contains(double x, double y, double w, double h)(Code) | | since: 1.2 |
createIntersection | abstract public Rectangle2D createIntersection(Rectangle2D r)(Code) | | Returns a new Rectangle2D object representing the
intersection of this Rectangle2D with the specified
Rectangle2D .
Parameters: r - the Rectangle2D to be intersected withthis Rectangle2D the largest Rectangle2D contained in both the specified Rectangle2D and in thisRectangle2D . since: 1.2 |
createUnion | abstract public Rectangle2D createUnion(Rectangle2D r)(Code) | | Returns a new Rectangle2D object representing the
union of this Rectangle2D with the specified
Rectangle2D .
Parameters: r - the Rectangle2D to be combined withthis Rectangle2D the smallest Rectangle2D containing both the specified Rectangle2D and this Rectangle2D . since: 1.2 |
equals | public boolean equals(Object obj)(Code) | | Determines whether or not the specified Object is
equal to this Rectangle2D . The specified
Object is equal to this Rectangle2D
if it is an instance of Rectangle2D and if its
location and size are the same as this Rectangle2D .
Parameters: obj - an Object to be compared with thisRectangle2D . true if obj is an instanceof Rectangle2D and hasthe same values; false otherwise. since: 1.2 |
getPathIterator | public PathIterator getPathIterator(AffineTransform at)(Code) | | Returns an iteration object that defines the boundary of this
Rectangle2D .
The iterator for this class is multi-threaded safe, which means
that this Rectangle2D class guarantees that
modifications to the geometry of this Rectangle2D
object do not affect any iterations of that geometry that
are already in process.
Parameters: at - an optional AffineTransform to be applied tothe coordinates as they are returned in the iteration, ornull if untransformed coordinates are desired the PathIterator object that returns thegeometry of the outline of thisRectangle2D , one segment at a time. since: 1.2 |
getPathIterator | public PathIterator getPathIterator(AffineTransform at, double flatness)(Code) | | Returns an iteration object that defines the boundary of the
flattened Rectangle2D . Since rectangles are already
flat, the flatness parameter is ignored.
The iterator for this class is multi-threaded safe, which means
that this Rectangle2D class guarantees that
modifications to the geometry of this Rectangle2D
object do not affect any iterations of that geometry that
are already in process.
Parameters: at - an optional AffineTransform to be applied tothe coordinates as they are returned in the iteration, ornull if untransformed coordinates are desired Parameters: flatness - the maximum distance that the line segments used toapproximate the curved segments are allowed to deviate from anypoint on the original curve. Since rectangles are already flat,the flatness parameter is ignored. the PathIterator object that returns thegeometry of the outline of thisRectangle2D , one segment at a time. since: 1.2 |
hashCode | public int hashCode()(Code) | | Returns the hashcode for this Rectangle2D .
the hashcode for this Rectangle2D . since: 1.2 |
intersect | public static void intersect(Rectangle2D src1, Rectangle2D src2, Rectangle2D dest)(Code) | | Intersects the pair of specified source Rectangle2D
objects and puts the result into the specified destination
Rectangle2D object. One of the source rectangles
can also be the destination to avoid creating a third Rectangle2D
object, but in this case the original points of this source
rectangle will be overwritten by this method.
Parameters: src1 - the first of a pair of Rectangle2D objects to be intersected with each other Parameters: src2 - the second of a pair of Rectangle2D objects to be intersected with each other Parameters: dest - the Rectangle2D that holds theresults of the intersection of src1 andsrc2 since: 1.2 |
intersects | public boolean intersects(double x, double y, double w, double h)(Code) | | since: 1.2 |
intersectsLine | public boolean intersectsLine(double x1, double y1, double x2, double y2)(Code) | | Tests if the specified line segment intersects the interior of this
Rectangle2D .
Parameters: x1 - the X coordinate of the start point of the specifiedline segment Parameters: y1 - the Y coordinate of the start point of the specifiedline segment Parameters: x2 - the X coordinate of the end point of the specifiedline segment Parameters: y2 - the Y coordinate of the end point of the specifiedline segment true if the specified line segment intersectsthe interior of this Rectangle2D ; false otherwise. since: 1.2 |
intersectsLine | public boolean intersectsLine(Line2D l)(Code) | | Tests if the specified line segment intersects the interior of this
Rectangle2D .
Parameters: l - the specified Line2D to test for intersectionwith the interior of this Rectangle2D true if the specified Line2D intersects the interior of this Rectangle2D ;false otherwise. since: 1.2 |
outcode | abstract public int outcode(double x, double y)(Code) | | Determines where the specified coordinates lie with respect
to this Rectangle2D .
This method computes a binary OR of the appropriate mask values
indicating, for each side of this Rectangle2D ,
whether or not the specified coordinates are on the same side
of the edge as the rest of this Rectangle2D .
Parameters: x - the specified X coordinate Parameters: y - the specified Y coordinate the logical OR of all appropriate out codes. See Also: Rectangle2D.OUT_LEFT See Also: Rectangle2D.OUT_TOP See Also: Rectangle2D.OUT_RIGHT See Also: Rectangle2D.OUT_BOTTOM since: 1.2 |
outcode | public int outcode(Point2D p)(Code) | | Determines where the specified
Point2D lies with
respect to this Rectangle2D .
This method computes a binary OR of the appropriate mask values
indicating, for each side of this Rectangle2D ,
whether or not the specified Point2D is on the same
side of the edge as the rest of this Rectangle2D .
Parameters: p - the specified Point2D the logical OR of all appropriate out codes. See Also: Rectangle2D.OUT_LEFT See Also: Rectangle2D.OUT_TOP See Also: Rectangle2D.OUT_RIGHT See Also: Rectangle2D.OUT_BOTTOM since: 1.2 |
setFrame | public void setFrame(double x, double y, double w, double h)(Code) | | Sets the location and size of the outer bounds of this
Rectangle2D to the specified rectangular values.
Parameters: x - the X coordinate of the upper-left cornerof this Rectangle2D Parameters: y - the Y coordinate of the upper-left cornerof this Rectangle2D Parameters: w - the width of this Rectangle2D Parameters: h - the height of this Rectangle2D since: 1.2 |
setRect | abstract public void setRect(double x, double y, double w, double h)(Code) | | Sets the location and size of this Rectangle2D
to the specified double values.
Parameters: x - the X coordinate of the upper-left cornerof this Rectangle2D Parameters: y - the Y coordinate of the upper-left cornerof this Rectangle2D Parameters: w - the width of this Rectangle2D Parameters: h - the height of this Rectangle2D since: 1.2 |
setRect | public void setRect(Rectangle2D r)(Code) | | Sets this Rectangle2D to be the same as the specified
Rectangle2D .
Parameters: r - the specified Rectangle2D since: 1.2 |
union | public static void union(Rectangle2D src1, Rectangle2D src2, Rectangle2D dest)(Code) | | Unions the pair of source Rectangle2D objects
and puts the result into the specified destination
Rectangle2D object. One of the source rectangles
can also be the destination to avoid creating a third Rectangle2D
object, but in this case the original points of this source
rectangle will be overwritten by this method.
Parameters: src1 - the first of a pair of Rectangle2D objects to be combined with each other Parameters: src2 - the second of a pair of Rectangle2D objects to be combined with each other Parameters: dest - the Rectangle2D that holds theresults of the union of src1 and src2 since: 1.2 |
Methods inherited from java.awt.geom.RectangularShape | public Object clone()(Code)(Java Doc) public boolean contains(Point2D p)(Code)(Java Doc) public boolean contains(Rectangle2D r)(Code)(Java Doc) public Rectangle getBounds()(Code)(Java Doc) public double getCenterX()(Code)(Java Doc) public double getCenterY()(Code)(Java Doc) public Rectangle2D getFrame()(Code)(Java Doc) abstract public double getHeight()(Code)(Java Doc) public double getMaxX()(Code)(Java Doc) public double getMaxY()(Code)(Java Doc) public double getMinX()(Code)(Java Doc) public double getMinY()(Code)(Java Doc) public PathIterator getPathIterator(AffineTransform at, double flatness)(Code)(Java Doc) abstract public double getWidth()(Code)(Java Doc) abstract public double getX()(Code)(Java Doc) abstract public double getY()(Code)(Java Doc) public boolean intersects(Rectangle2D r)(Code)(Java Doc) abstract public boolean isEmpty()(Code)(Java Doc) abstract public void setFrame(double x, double y, double w, double h)(Code)(Java Doc) public void setFrame(Point2D loc, Dimension2D size)(Code)(Java Doc) public void setFrame(Rectangle2D r)(Code)(Java Doc) public void setFrameFromCenter(double centerX, double centerY, double cornerX, double cornerY)(Code)(Java Doc) public void setFrameFromCenter(Point2D center, Point2D corner)(Code)(Java Doc) public void setFrameFromDiagonal(double x1, double y1, double x2, double y2)(Code)(Java Doc) public void setFrameFromDiagonal(Point2D p1, Point2D p2)(Code)(Java Doc)
|
|
|