java.lang.Object | |
↳ | java.awt.geom.RectangularShape |
Known Direct Subclasses |
Known Indirect Subclasses |
RectangularShape
is the base class for a number of
Shape
objects whose geometry is defined by a rectangular frame.
This class does not directly specify any specific geometry by
itself, but merely provides manipulation methods inherited by
a whole category of Shape
objects.
The manipulation methods provided by this class can be used to
query and modify the rectangular frame, which provides a reference
for the subclasses to define their geometry.
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This is an abstract class that cannot be instantiated directly.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new object of the same class and with the same
contents as this object.
| |||||||||||
Tests if a specified
Point2D is inside the boundary
of the Shape . | |||||||||||
Tests if the interior of the
Shape entirely contains the
specified Rectangle2D . | |||||||||||
Returns an integer
Rectangle that completely encloses the
Shape . | |||||||||||
Returns the X coordinate of the center of the framing
rectangle of the
Shape in double
precision. | |||||||||||
Returns the Y coordinate of the center of the framing
rectangle of the
Shape in double
precision. | |||||||||||
Returns the framing
Rectangle2D
that defines the overall shape of this object. | |||||||||||
Returns the height of the framing rectangle
in
double precision. | |||||||||||
Returns the largest X coordinate of the framing
rectangle of the
Shape in double
precision. | |||||||||||
Returns the largest Y coordinate of the framing
rectangle of the
Shape in double
precision. | |||||||||||
Returns the smallest X coordinate of the framing
rectangle of the
Shape in double
precision. | |||||||||||
Returns the smallest Y coordinate of the framing
rectangle of the
Shape in double
precision. | |||||||||||
Returns an iterator object that iterates along the
Shape object's boundary and provides access to a
flattened view of the outline of the Shape
object's geometry. | |||||||||||
Returns the width of the framing rectangle in
double precision. | |||||||||||
Returns the X coordinate of the upper-left corner of
the framing rectangle in
double precision. | |||||||||||
Returns the Y coordinate of the upper-left corner of
the framing rectangle in
double precision. | |||||||||||
Tests if the interior of the
Shape intersects the
interior of a specified Rectangle2D . | |||||||||||
Determines whether the
RectangularShape is empty. | |||||||||||
Sets the location and size of the framing rectangle of this
Shape to the specified Point2D and
Dimension2D , respectively. | |||||||||||
Sets the framing rectangle of this
Shape to
be the specified Rectangle2D . | |||||||||||
Sets the location and size of the framing rectangle of this
Shape to the specified rectangular values. | |||||||||||
Sets the framing rectangle of this
Shape
based on the specified center point coordinates and corner point
coordinates. | |||||||||||
Sets the framing rectangle of this
Shape based on a
specified center Point2D and corner
Point2D . | |||||||||||
Sets the diagonal of the framing rectangle of this
Shape
based on the two specified coordinates. | |||||||||||
Sets the diagonal of the framing rectangle of this
Shape
based on two specified Point2D objects. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.awt.Shape
|
This is an abstract class that cannot be instantiated directly.
Creates a new object of the same class and with the same contents as this object.
OutOfMemoryError | if there is not enough memory. |
---|
Tests if a specified Point2D
is inside the boundary
of the Shape
.
p | the specified Point2D to be tested |
---|
true
if the specified Point2D
is
inside the boundary of the Shape
;
false
otherwise.Tests if the interior of the Shape
entirely contains the
specified Rectangle2D
.
The Shape.contains()
method allows a Shape
implementation to conservatively return false
when:
intersect
method returns true
and
Shape
entirely contains the Rectangle2D
are prohibitively expensive.
Shapes
this method might
return false
even though the Shape
contains
the Rectangle2D
.
The Area
class performs
more accurate geometric computations than most
Shape
objects and therefore can be used if a more precise
answer is required.r | The specified Rectangle2D |
---|
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.Returns an integer Rectangle
that completely encloses the
Shape
. Note that there is no guarantee that the
returned Rectangle
is the smallest bounding box that
encloses the Shape
, only that the Shape
lies entirely within the indicated Rectangle
. The
returned Rectangle
might also fail to completely
enclose the Shape
if the Shape
overflows
the limited range of the integer data type. The
getBounds2D
method generally returns a
tighter bounding box due to its greater flexibility in
representation.
Rectangle
that completely encloses
the Shape
.Returns the X coordinate of the center of the framing
rectangle of the Shape
in double
precision.
Shape
.Returns the Y coordinate of the center of the framing
rectangle of the Shape
in double
precision.
Shape
.Returns the framing Rectangle2D
that defines the overall shape of this object.
Rectangle2D
, specified in
double
coordinates.Returns the height of the framing rectangle
in double
precision.
Returns the largest X coordinate of the framing
rectangle of the Shape
in double
precision.
Shape
.Returns the largest Y coordinate of the framing
rectangle of the Shape
in double
precision.
Shape
.Returns the smallest X coordinate of the framing
rectangle of the Shape
in double
precision.
Shape
.Returns the smallest Y coordinate of the framing
rectangle of the Shape
in double
precision.
Shape
.Returns an iterator object that iterates along the
Shape
object's boundary and provides access to a
flattened view of the outline of the Shape
object's geometry.
Only SEG_MOVETO, SEG_LINETO, and SEG_CLOSE point types will be returned by the iterator.
The amount of subdivision of the curved segments is controlled
by the flatness
parameter, which specifies the
maximum distance that any point on the unflattened transformed
curve can deviate from the returned flattened path segments.
An optional AffineTransform
can
be specified so that the coordinates returned in the iteration are
transformed accordingly.
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 |
PathIterator
object that provides access to
the Shape
object's flattened geometry.Returns the width of the framing rectangle in
double
precision.
Returns the X coordinate of the upper-left corner of
the framing rectangle in double
precision.
Returns the Y coordinate of the upper-left corner of
the framing rectangle in double
precision.
Tests if the interior of the Shape
intersects the
interior of a specified Rectangle2D
.
The Shape.intersects()
method allows a Shape
implementation to conservatively return true
when:
Rectangle2D
and the
Shape
intersect, but
Shapes
this method might
return true
even though the Rectangle2D
does not
intersect the Shape
.
The Area
class performs
more accurate computations of geometric intersection than most
Shape
objects and therefore can be used if a more precise
answer is required.r | the specified Rectangle2D |
---|
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.Determines whether the RectangularShape
is empty.
When the RectangularShape
is empty, it encloses no
area.
true
if the RectangularShape
is empty;
false
otherwise.Sets the location and size of the framing rectangle of this
Shape
to the specified Point2D
and
Dimension2D
, respectively. The framing rectangle is used
by the subclasses of RectangularShape
to define
their geometry.
loc | the specified Point2D |
---|---|
size | the specified Dimension2D |
Sets the framing rectangle of this Shape
to
be the specified Rectangle2D
. The framing rectangle is
used by the subclasses of RectangularShape
to define
their geometry.
r | the specified Rectangle2D |
---|
Sets the location and size of the framing rectangle of this
Shape
to the specified rectangular values.
x | the X coordinate of the upper-left corner of the specified rectangular shape |
---|---|
y | the Y coordinate of the upper-left corner of the specified rectangular shape |
w | the width of the specified rectangular shape |
h | the height of the specified rectangular shape |
Sets the framing rectangle of this Shape
based on the specified center point coordinates and corner point
coordinates. The framing rectangle is used by the subclasses of
RectangularShape
to define their geometry.
centerX | the X coordinate of the specified center point |
---|---|
centerY | the Y coordinate of the specified center point |
cornerX | the X coordinate of the specified corner point |
cornerY | the Y coordinate of the specified corner point |
Sets the framing rectangle of this Shape
based on a
specified center Point2D
and corner
Point2D
. The framing rectangle is used by the subclasses
of RectangularShape
to define their geometry.
center | the specified center Point2D |
---|---|
corner | the specified corner Point2D |
Sets the diagonal of the framing rectangle of this Shape
based on the two specified coordinates. The framing rectangle is
used by the subclasses of RectangularShape
to define
their geometry.
x1 | the X coordinate of the start point of the specified diagonal |
---|---|
y1 | the Y coordinate of the start point of the specified diagonal |
x2 | the X coordinate of the end point of the specified diagonal |
y2 | the Y coordinate of the end point of the specified diagonal |
Sets the diagonal of the framing rectangle of this Shape
based on two specified Point2D
objects. The framing
rectangle is used by the subclasses of RectangularShape
to define their geometry.
p1 | the start Point2D of the specified diagonal |
---|---|
p2 | the end Point2D of the specified diagonal |