java::awt::geom::Rectangle2D Class Reference

Inheritance diagram for java::awt::geom::Rectangle2D:

Inheritance graph
java::awt::geom::Rectangle2D::Doublejava::awt::geom::Rectangle2D::Floatjava::awt::Rectanglejava::awt::geom::RectangularShapejava::awt::Shapejava::lang::Interfacejava::lang::Object
[legend]
Collaboration diagram for java::awt::geom::Rectangle2D:

Collaboration graph
java::awt::geom::RectangularShapejava::awt::Shapejava::lang::Interfacejava::lang::Object
[legend]

List of all members.


Detailed Description

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.28, 01/23/03
Author:
Jim Graham

Public Types

enum  POINT_INDICATOR { OUT_LEFT = 1, OUT_TOP = 2, OUT_RIGHT = 4, OUT_BOTTOM = 8 }

Public Member Functions

virtual void setRect (jdouble x, jdouble y, jdouble w, jdouble)=0
 Sets the location and size of this Rectangle2D to the specified double values.
virtual void setRect (const Rectangle2D &r)
 Sets this Rectangle2D to be the same as the specified Rectangle2D.
virtual jboolean intersectsLine (jdouble x1, jdouble y1, jdouble x2, jdouble y2) const
 Tests if the specified line segment intersects the interior of this Rectangle2D.
virtual jboolean intersectsLine (const Line2D &l) const
 Tests if the specified line segment intersects the interior of this Rectangle2D.
virtual jint outcode (jdouble x, jdouble) const =0
 Determines where the specified coordinates lie with respect to this Rectangle2D.
virtual jint outcode (const Point2D &p) const
 Determines where the specified Point2D lies with respect to this Rectangle2D.
virtual void setFrame (jdouble x, jdouble y, jdouble w, jdouble h)
 Sets the location and size of the outer bounds of this Rectangle2D to the specified rectangular values.
virtual void setFrame (const Point2D &loc, const Dimension2D &size)
 Sets the location and size of the framing rectangle of this Rectangle2D to the specified Point2D and Dimension2D, respectively.
virtual void setFrame (const Rectangle2D &r)
 Sets the framing rectangle of this Rectangle2D to be the specified Rectangle2D.
virtual Ref
< Rectangle2D
getBounds2D () const
 Returns the high precision bounding box of this Rectangle2D.
virtual jboolean contains (jdouble x, jdouble y) const
 Tests if a specified coordinate is inside the boundary of this Rectangle2D.
virtual jboolean contains (const Point2D &p) const
 Tests if the specified coordinates are inside the boundary of the Rectangle2D.
virtual jboolean intersects (jdouble x, jdouble y, jdouble w, jdouble h) const
 Tests if the interior of this Rectangle2D intersects the interior of a specified set of rectangular coordinates.
virtual jboolean intersects (const Rectangle2D &r) const
 Tests if the interior of the Rectangle2D intersects the interior of a specified Rectangle2D.
virtual jboolean contains (jdouble x, jdouble y, jdouble w, jdouble h) const
 Tests if the interior of this Rectangle2D entirely contains the specified set of rectangular coordinates.
virtual jboolean contains (const Rectangle2D &r) const
 Tests if the interior of the Rectangle2D entirely contains the specified Rectangle2D.
virtual Ref
< Rectangle2D
createIntersection (const Rectangle2D &r) const =0
 Returns a new Rectangle2D object representing the intersection of this Rectangle2D with the specified Rectangle2D.
virtual Ref
< Rectangle2D
createUnion (const Rectangle2D &r) const =0
 Returns a new Rectangle2D object representing the union of this Rectangle2D with the specified Rectangle2D.
virtual void add (jdouble newx, jdouble newy)
 Adds a point, specified by the double precision arguments newx and newy, to this Rectangle2D.
virtual void add (const Point2D &pt)
 Adds the Point2D object pt to this Rectangle2D.
virtual void add (const Rectangle2D &r)
 Adds a Rectangle2D object to this Rectangle2D.
virtual Ref
< PathIterator
getPathIterator (const AffineTransform &at, jdouble flatness=-1.0) const
 Returns an iteration object that defines the boundary of the flattened Rectangle2D.
virtual jint hashCode () const
 Returns the hashcode for this Rectangle2D.
virtual jboolean equals (const Object &obj) const
 Determines whether or not the specified Object is equal to this Rectangle2D.

Static Public Member Functions

static void intersect (const Rectangle2D &src1, const Rectangle2D &src2, Rectangle2D &dest)
 Intersects the pair of specified source Rectangle2D objects and puts the result into the specified destination Rectangle2D object.
static void unionOf (const Rectangle2D &src1, const Rectangle2D &src2, Rectangle2D &dest)
 Unions the pair of source Rectangle2D objects and puts the result into the specified destination Rectangle2D object.

Classes

class  Double
class  Float

Member Enumeration Documentation

enum java::awt::geom::Rectangle2D::POINT_INDICATOR

Enumerator:
OUT_LEFT 
OUT_TOP 
OUT_RIGHT 
OUT_BOTTOM 


Member Function Documentation

virtual void java::awt::geom::Rectangle2D::setRect ( jdouble  x,
jdouble  y,
jdouble  w,
jdouble   
) [pure virtual]

Sets the location and size of this Rectangle2D to the specified double values.

Parameters:
x,&nbsp;y the coordinates to which to set the location of the upper left corner of this Rectangle2D
w the value to use to set the width of this Rectangle2D
h the value to use to set the height of this Rectangle2D
Since:
1.2

Implemented in java::awt::Rectangle, java::awt::geom::Rectangle2D::Float, and java::awt::geom::Rectangle2D::Double.

virtual void java::awt::geom::Rectangle2D::setRect ( const Rectangle2D r  )  [virtual]

Sets this Rectangle2D to be the same as the specified Rectangle2D.

Parameters:
r the specified Rectangle2D
Since:
1.2

Reimplemented in java::awt::geom::Rectangle2D::Float, and java::awt::geom::Rectangle2D::Double.

virtual jboolean java::awt::geom::Rectangle2D::intersectsLine ( jdouble  x1,
jdouble  y1,
jdouble  x2,
jdouble  y2 
) const [virtual]

Tests if the specified line segment intersects the interior of this Rectangle2D.

Parameters:
x1,&nbsp;y1 the first endpoint of the specified line segment
x2,&nbsp;y2 the second endpoint of the specified line segment
Returns:
true if the specified line segment intersects the interior of this Rectangle2D; false otherwise.
Since:
1.2

virtual jboolean java::awt::geom::Rectangle2D::intersectsLine ( const Line2D l  )  const [virtual]

Tests if the specified line segment intersects the interior of this Rectangle2D.

Parameters:
l the specified Line2D to test for intersection with the interior of this Rectangle2D
Returns:
true if the specified Line2D intersects the interior of this Rectangle2D; false otherwise.
Since:
1.2

virtual jint java::awt::geom::Rectangle2D::outcode ( jdouble  x,
jdouble   
) const [pure virtual]

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,&nbsp;y the specified coordinates
Returns:
the logical OR of all appropriate out codes.
See also:
OUT_LEFT

OUT_TOP

OUT_RIGHT

OUT_BOTTOM

Since:
1.2

Implemented in java::awt::Rectangle, java::awt::geom::Rectangle2D::Float, and java::awt::geom::Rectangle2D::Double.

virtual jint java::awt::geom::Rectangle2D::outcode ( const Point2D p  )  const [virtual]

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
Returns:
the logical OR of all appropriate out codes.
See also:
OUT_LEFT

OUT_TOP

OUT_RIGHT

OUT_BOTTOM

Since:
1.2

Reimplemented in java::awt::geom::Rectangle2D::Float, and java::awt::geom::Rectangle2D::Double.

virtual void java::awt::geom::Rectangle2D::setFrame ( jdouble  x,
jdouble  y,
jdouble  w,
jdouble  h 
) [virtual]

Sets the location and size of the outer bounds of this Rectangle2D to the specified rectangular values.

Parameters:
x,&nbsp;y the coordinates to which to set the location of the upper left corner of the outer bounds of this Rectangle2D
w the value to use to set the width of the outer bounds of this Rectangle2D
h the value to use to set the height of the outer bounds of this Rectangle2D
Since:
1.2

Implements java::awt::geom::RectangularShape.

virtual void java::awt::geom::Rectangle2D::setFrame ( const Point2D loc,
const Dimension2D size 
) [virtual]

Sets the location and size of the framing rectangle of this Rectangle2D to the specified Point2D and Dimension2D, respectively.

The framing rectangle is used by the subclasses of RectangularShape to define their geometry.

Parameters:
loc the specified Point2D
size the specified Dimension2D
See also:
getFrame

Reimplemented from java::awt::geom::RectangularShape.

virtual void java::awt::geom::Rectangle2D::setFrame ( const Rectangle2D r  )  [virtual]

Sets the framing rectangle of this Rectangle2D to be the specified Rectangle2D.

The framing rectangle is used by the subclasses of RectangularShape to define their geometry.

Parameters:
r the specified Rectangle2D
See also:
getFrame

Reimplemented from java::awt::geom::RectangularShape.

virtual Ref<Rectangle2D> java::awt::geom::Rectangle2D::getBounds2D (  )  const [virtual]

Returns the high precision bounding box of this Rectangle2D.

Returns:
the bounding box of this Rectangle2D.
Since:
1.2

Implements java::awt::Shape.

Reimplemented in java::awt::Rectangle, java::awt::geom::Rectangle2D::Float, and java::awt::geom::Rectangle2D::Double.

virtual jboolean java::awt::geom::Rectangle2D::contains ( jdouble  x,
jdouble  y 
) const [virtual]

Tests if a specified coordinate is inside the boundary of this Rectangle2D.

Parameters:
x,&nbsp;y the coordinates to test
Returns:
true if the specified coordinates are inside the boundary of this Rectangle2D; false otherwise.
Since:
1.2

Implements java::awt::Shape.

virtual jboolean java::awt::geom::Rectangle2D::contains ( const Point2D p  )  const [virtual]

Tests if the specified coordinates are inside the boundary of the Rectangle2D.

Parameters:
x the specified x coordinate
y the specified y coordinate
Returns:
true if the specified coordinates are inside the Shape boundary; false otherwise.

Reimplemented from java::awt::Shape.

virtual jboolean java::awt::geom::Rectangle2D::intersects ( jdouble  x,
jdouble  y,
jdouble  w,
jdouble  h 
) const [virtual]

Tests if the interior of this Rectangle2D intersects the interior of a specified set of rectangular coordinates.

Parameters:
x,&nbsp;y the coordinates of the upper left corner of the specified set of rectangular coordinates
w the width of the specified set of rectangular coordinates
h the height of the specified set of rectangular coordinates
Returns:
true if this Rectangle2D intersects the interior of a specified set of rectangular coordinates; false otherwise.
Since:
1.2

Implements java::awt::Shape.

virtual jboolean java::awt::geom::Rectangle2D::intersects ( const Rectangle2D r  )  const [virtual]

Tests if the interior of the Rectangle2D intersects the interior of a specified Rectangle2D.

This method might conservatively return true when:

This means that this method might return true even though the Rectangle2D does not intersect the Shape.
Parameters:
r the specified Rectangle2D
Returns:
true if the interior of the Shape and the interior of the specified Rectangle2D intersect, or are both highly likely to intersect and intersection calculations would be too expensive to perform; false otherwise.
See also:
intersects(double, double, double, double)

Reimplemented from java::awt::Shape.

virtual jboolean java::awt::geom::Rectangle2D::contains ( jdouble  x,
jdouble  y,
jdouble  w,
jdouble  h 
) const [virtual]

Tests if the interior of this Rectangle2D entirely contains the specified set of rectangular coordinates.

Parameters:
x,&nbsp;y the coordinates of the upper left corner of the specified set of rectangular coordinates
w the width of the specified set of rectangular coordinates
h the height of the specified set of rectangular coordinates
Returns:
true if this Rectangle2D entirely contains specified set of rectangular coordinates; false otherwise.
Since:
1.2

Implements java::awt::Shape.

virtual jboolean java::awt::geom::Rectangle2D::contains ( const Rectangle2D r  )  const [virtual]

Tests if the interior of the Rectangle2D entirely contains the specified Rectangle2D.

This method might conservatively return false when:

This means that this method might return false even though the Shape contains the Rectangle2D. The Area class can be used to perform more accurate computations of geometric intersection for any Shape object if a more precise answer is required.
Parameters:
r The specified Rectangle2D
Returns:
true if the interior of the Shape entirely contains the Rectangle2D; false otherwise or, if the Shape contains the Rectangle2D and the intersects method returns true and the containment calculations would be too expensive to perform.
See also:
contains(double, double, double, double)

Reimplemented from java::awt::Shape.

virtual Ref<Rectangle2D> java::awt::geom::Rectangle2D::createIntersection ( const Rectangle2D r  )  const [pure virtual]

Returns a new Rectangle2D object representing the intersection of this Rectangle2D with the specified Rectangle2D.

Parameters:
r the Rectangle2D to be intersected with this Rectangle2D
Returns:
the largest Rectangle2D contained in both the specified Rectangle2D and in this Rectangle2D.
Since:
1.2

Implemented in java::awt::Rectangle, java::awt::geom::Rectangle2D::Float, and java::awt::geom::Rectangle2D::Double.

static void java::awt::geom::Rectangle2D::intersect ( const Rectangle2D src1,
const Rectangle2D src2,
Rectangle2D dest 
) [static]

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
src2 the second of a pair of Rectangle2D objects to be intersected with each other
dest the Rectangle2D that holds the results of the intersection of src1 and src2
Since:
1.2

virtual Ref<Rectangle2D> java::awt::geom::Rectangle2D::createUnion ( const Rectangle2D r  )  const [pure virtual]

Returns a new Rectangle2D object representing the union of this Rectangle2D with the specified Rectangle2D.

Parameters:
r the Rectangle2D to be combined with this Rectangle2D
Returns:
the smallest Rectangle2D containing both the specified Rectangle2D and this Rectangle2D.
Since:
1.2

Implemented in java::awt::Rectangle, java::awt::geom::Rectangle2D::Float, and java::awt::geom::Rectangle2D::Double.

static void java::awt::geom::Rectangle2D::unionOf ( const Rectangle2D src1,
const Rectangle2D src2,
Rectangle2D dest 
) [static]

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
src2 the second of a pair of Rectangle2D objects to be combined with each other
dest the Rectangle2D that holds the results of the union of src1 and src2
Since:
1.2

virtual void java::awt::geom::Rectangle2D::add ( jdouble  newx,
jdouble  newy 
) [virtual]

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,&nbsp;newy the coordinates of the new point
Since:
JDK1.0

virtual void java::awt::geom::Rectangle2D::add ( const Point2D pt  )  [virtual]

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 this Rectangle2D.
Since:
JDK1.0

virtual void java::awt::geom::Rectangle2D::add ( const Rectangle2D r  )  [virtual]

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 this Rectangle2D.
Since:
JDK1.0

virtual Ref<PathIterator> java::awt::geom::Rectangle2D::getPathIterator ( const AffineTransform at,
jdouble  flatness = -1.0 
) const [virtual]

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 to the coordinates as they are returned in the iteration, or null if untransformed coordinates are desired
flatness the maximum distance that the line segments used to approximate the curved segments are allowed to deviate from any point on the original curve. Since rectangles are already flat, the flatness parameter is ignored.
Returns:
the PathIterator object that returns the geometry of the outline of this Rectangle2D, one segment at a time.
Since:
1.2

Implements java::awt::Shape.

virtual jint java::awt::geom::Rectangle2D::hashCode (  )  const [virtual]

Returns the hashcode for this Rectangle2D.

Returns:
the hashcode for this Rectangle2D.

Reimplemented from java::lang::Object.

Reimplemented in java::awt::Rectangle.

virtual jboolean java::awt::geom::Rectangle2D::equals ( const Object obj  )  const [virtual]

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 this Rectangle2D.
Returns:
true if obj is an instance of Rectangle2D and has the same values; false otherwise.
Since:
1.2

Reimplemented from java::lang::Object.

Reimplemented in java::awt::Rectangle.


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:56:22 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3