|
JavaTM 2 Platform Std. Ed. v1.4.2 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.geom.RectangularShape
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.
Constructor Summary | |
protected |
RectangularShape()
This is an abstract class that cannot be instantiated directly. |
Method Summary | |
Object |
clone()
Creates a new object of the same class and with the same contents as this object. |
boolean |
contains(Point2D p)
Tests if a specified Point2D is inside the boundary
of the Shape . |
boolean |
contains(Rectangle2D r)
Tests if the interior of the Shape entirely contains the
specified Rectangle2D . |
Rectangle |
getBounds()
Returns the bounding box of the Shape . |
double |
getCenterX()
Returns the X coordinate of the center of the framing rectangle of the Shape in double
precision. |
double |
getCenterY()
Returns the Y coordinate of the center of the framing rectangle of the Shape in double
precision. |
Rectangle2D |
getFrame()
Returns the framing Rectangle2D
that defines the overall shape of this object. |
abstract double |
getHeight()
Returns the height of the framing rectangle in double precision. |
double |
getMaxX()
Returns the largest X coordinate of the framing rectangle of the Shape in double
precision. |
double |
getMaxY()
Returns the largest Y coordinate of the framing rectangle of the Shape in double
precision. |
double |
getMinX()
Returns the smallest X coordinate of the framing rectangle of the Shape in double
precision. |
double |
getMinY()
Returns the smallest Y coordinate of the framing rectangle of the Shape in double
precision. |
PathIterator |
getPathIterator(AffineTransform at,
double flatness)
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. |
abstract double |
getWidth()
Returns the width of the framing rectangle in double precision. |
abstract double |
getX()
Returns the X coordinate of the upper left corner of the framing rectangle in double precision. |
abstract double |
getY()
Returns the Y coordinate of the upper left corner of the framing rectangle in double precision. |
boolean |
intersects(Rectangle2D r)
Tests if the interior of the Shape intersects the
interior of a specified Rectangle2D . |
abstract boolean |
isEmpty()
Determines whether the RectangularShape is empty. |
abstract void |
setFrame(double x,
double y,
double w,
double h)
Sets the location and size of the framing rectangle of this Shape to the specified rectangular values. |
void |
setFrame(Point2D loc,
Dimension2D size)
Sets the location and size of the framing rectangle of this Shape to the specified Point2D and
Dimension2D , respectively. |
void |
setFrame(Rectangle2D r)
Sets the framing rectangle of this Shape to
be the specified Rectangle2D . |
void |
setFrameFromCenter(double centerX,
double centerY,
double cornerX,
double cornerY)
Sets the framing rectangle of this Shape
based on the specified center point coordinates and corner point
coordinates. |
void |
setFrameFromCenter(Point2D center,
Point2D corner)
Sets the framing rectangle of this Shape based on a
specified center Point2D and corner
Point2D . |
void |
setFrameFromDiagonal(double x1,
double y1,
double x2,
double y2)
Sets the diagonal of the framing rectangle of this Shape
based on the two specified coordinates. |
void |
setFrameFromDiagonal(Point2D p1,
Point2D p2)
Sets the diagonal of the framing rectangle of this Shape
based on two specified Point2D objects. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.awt.Shape |
contains, contains, getBounds2D, getPathIterator, intersects |
Constructor Detail |
protected RectangularShape()
Arc2D
,
Ellipse2D
,
Rectangle2D
,
RoundRectangle2D
Method Detail |
public abstract double getX()
double
precision.
public abstract double getY()
double
precision.
public abstract double getWidth()
double
precision.
public abstract double getHeight()
double
precision.
public double getMinX()
Shape
in double
precision.
Shape
.public double getMinY()
Shape
in double
precision.
Shape
.public double getMaxX()
Shape
in double
precision.
Shape
.public double getMaxY()
Shape
in double
precision.
Shape
.public double getCenterX()
Shape
in double
precision.
Shape
object's center.public double getCenterY()
Shape
in double
precision.
Shape
object's center.public Rectangle2D getFrame()
Rectangle2D
that defines the overall shape of this object.
Rectangle2D
, specified in
double
coordinates.setFrame(double, double, double, double)
,
setFrame(Point2D, Dimension2D)
,
setFrame(Rectangle2D)
public abstract boolean isEmpty()
RectangularShape
is empty.
When the RectangularShape
is empty, it encloses no
area.
true
if the RectangularShape
is empty;
false
otherwise.public abstract void setFrame(double x, double y, double w, double h)
Shape
to the specified rectangular values.
The framing rectangle is used by the subclasses of
RectangularShape
to define their geometry.
w
- the width of the specified rectangular shapeh
- the height of the specified rectangular shapegetFrame()
public void setFrame(Point2D loc, Dimension2D size)
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
getFrame()
public void setFrame(Rectangle2D r)
Shape
to
be the specified Rectangle2D
. The framing rectangle is
used by the subclasses of RectangularShape
to define
their geometry.
r
- the specified Rectangle2D
getFrame()
public void setFrameFromDiagonal(double x1, double y1, double x2, double y2)
Shape
based on the two specified coordinates. The framing rectangle is
used by the subclasses of RectangularShape
to define
their geometry.
public void setFrameFromDiagonal(Point2D p1, Point2D p2)
Shape
based on two specified Point2D
objects. The framing
rectangle is used by the subclasses of RectangularShape
to define their geometry.
public void setFrameFromCenter(double centerX, double centerY, double cornerX, double cornerY)
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.
public void setFrameFromCenter(Point2D center, Point2D corner)
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
public boolean contains(Point2D p)
Point2D
is inside the boundary
of the Shape
.
contains
in interface Shape
p
- the specified Point2D
true
if the Point2D
is inside the
Shape
object's boundary;
false
otherwise.public boolean intersects(Rectangle2D r)
Shape
intersects the
interior of a specified Rectangle2D
.
intersects
in interface Shape
r
- the specified Rectangle2D
true
if the Shape
and the
specified Rectangle2D
intersect each other;
false
otherwise.Shape.intersects(double, double, double, double)
public boolean contains(Rectangle2D r)
Shape
entirely contains the
specified Rectangle2D
.
contains
in interface Shape
r
- the specified Rectangle2D
true
if the Shape
entirely contains
the specified Rectangle2D
;
false
otherwise.Shape.contains(double, double, double, double)
public Rectangle getBounds()
Shape
.
getBounds
in interface Shape
Rectangle
object that bounds the
Shape
.Shape.getBounds2D()
public PathIterator getPathIterator(AffineTransform at, double flatness)
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.
getPathIterator
in interface Shape
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.public Object clone()
clone
in class Object
OutOfMemoryError
- if there is not enough memory.Cloneable
|
JavaTM 2 Platform Std. Ed. v1.4.2 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.