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.
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public Object | Returns: a clone of this instance.Overrides java. Creates a new object of the same class and with the same contents as this object. |
| public boolean | contains(Point2D p)
Implements java. Tests if a specified |
| public boolean | contains(Rectangle2D r)
Implements java. Tests if the interior of the |
| public Rectangle | getBounds()
Implements java. Returns an integer |
| public double | Returns: the X coordinate of the center of the framing rectangle of theShape.Returns the X coordinate of the center of the framing
rectangle of the |
| public double | Returns: the Y coordinate of the center of the framing rectangle of theShape.Returns the Y coordinate of the center of the framing
rectangle of the |
| public Rectangle2D | Returns: aRectangle2D, specified in
double coordinates.Returns the framing |
| public abstract double | Returns: the height of the framing rectangle.Returns the height of the framing rectangle
in |
| public double | Returns: the largest X coordinate of the framing rectangle of theShape.Returns the largest X coordinate of the framing
rectangle of the |
| public double | Returns: the largest Y coordinate of the framing rectangle of theShape.Returns the largest Y coordinate of the framing
rectangle of the |
| public double | Returns: the smallest X coordinate of the framing rectangle of theShape.Returns the smallest X coordinate of the framing
rectangle of the |
| public double | Returns: the smallest Y coordinate of the framing rectangle of theShape.Returns the smallest Y coordinate of the framing
rectangle of the |
| public PathIterator | Returns: aPathIterator object that provides access to
the Shape object's flattened geometry.an optional at, double AffineTransform to be applied to the
coordinates as they are returned in the iteration,
or null if untransformed coordinates are desired.the maximum distance that the line segments used to
approximate the curved segments are allowed to deviate
from any point on the original curve flatness)Implements java. Returns an iterator object that iterates along the
|
| public abstract double | Returns: the width of the framing rectangle.Returns the width of the framing rectangle in
|
| public abstract double | Returns: the X coordinate of the upper-left corner of the framing rectangle.Returns the X coordinate of the upper-left corner of
the framing rectangle in |
| public abstract double | Returns: the Y coordinate of the upper-left corner of the framing rectangle.Returns the Y coordinate of the upper-left corner of
the framing rectangle in |
| public boolean | intersects(Rectangle2D r)
Implements java. Tests if the interior of the |
| public abstract boolean | Returns: true if the RectangularShape is empty;
false otherwise.Determines whether the |
| public abstract void | setFrame(double
the X coordinate of the upper-left corner of the
specified rectangular shape x, double the Y coordinate of the upper-left corner of the
specified rectangular shape y, double the width of the specified rectangular shape w, double the height of the specified rectangular shape h)Sets the location and size of the framing rectangle of this
|
| public void | setFrame(Point2D
the specified loc, Dimension2D Point2Dthe specified size)Dimension2DSets the location and size of the framing rectangle of this
|
| public void | setFrame(Rectangle2D
the specified r)Rectangle2DSets the framing rectangle of this |
| public void | setFrameFromCenter(double
the X coordinate of the specified center point centerX, double the Y coordinate of the specified center point centerY, double the X coordinate of the specified corner point cornerX, double the Y coordinate of the specified corner point cornerY)Sets the framing rectangle of this |
| public void | setFrameFromCenter(Point2D
the specified center center, Point2D Point2Dthe specified corner corner)Point2DSets the framing rectangle of this |
| public void | setFrameFromDiagonal(double
the X coordinate of the start point of the specified diagonal x1, double the Y coordinate of the start point of the specified diagonal y1, double the X coordinate of the end point of the specified diagonal x2, double the Y coordinate of the end point of the specified diagonal y2)Sets the diagonal of the framing rectangle of this |
| public void | setFrameFromDiagonal(Point2D
the start p1, Point2D Point2D of the specified diagonalthe end p2)Point2D of the specified diagonalSets the diagonal of the framing rectangle of this |
| RectangularShape | back to summary |
|---|---|
| protected RectangularShape() This is an abstract class that cannot be instantiated directly.
| |
| clone | back to summary |
|---|---|
| public Object clone() Overrides java. Creates a new object of the same class and with the same contents as this object.
| |
| contains | back to summary |
|---|---|
| public boolean contains(Point2D p) Implements java. Doc from java. Tests if a specified
| |
| contains | back to summary |
|---|---|
| public boolean contains(Rectangle2D r) Implements java. Doc from java. Tests if the interior of the
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.
| |
| getBounds | back to summary |
|---|---|
| public Rectangle getBounds() Implements java. Doc from java. Returns an integer
Note that the
definition of insideness can lead to situations where points
on the defining outline of the
If a
If a
| |
| getCenterX | back to summary |
|---|---|
| public double getCenterX() Returns the X coordinate of the center of the framing
rectangle of the
| |
| getCenterY | back to summary |
|---|---|
| public double getCenterY() Returns the Y coordinate of the center of the framing
rectangle of the
| |
| getFrame | back to summary |
|---|---|
| public Rectangle2D getFrame() Returns the framing
| |
| getHeight | back to summary |
|---|---|
| public abstract double getHeight() Returns the height of the framing rectangle
in
| |
| getMaxX | back to summary |
|---|---|
| public double getMaxX() Returns the largest X coordinate of the framing
rectangle of the
| |
| getMaxY | back to summary |
|---|---|
| public double getMaxY() Returns the largest Y coordinate of the framing
rectangle of the
| |
| getMinX | back to summary |
|---|---|
| public double getMinX() Returns the smallest X coordinate of the framing
rectangle of the
| |
| getMinY | back to summary |
|---|---|
| public double getMinY() Returns the smallest Y coordinate of the framing
rectangle of the
| |
| getPathIterator | back to summary |
|---|---|
| public PathIterator getPathIterator(AffineTransform at, double flatness) Implements java. Returns an iterator object that iterates along the
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
| |
| getWidth | back to summary |
|---|---|
| public abstract double getWidth() Returns the width of the framing rectangle in
| |
| getX | back to summary |
|---|---|
| public abstract double getX() Returns the X coordinate of the upper-left corner of
the framing rectangle in
| |
| getY | back to summary |
|---|---|
| public abstract double getY() Returns the Y coordinate of the upper-left corner of
the framing rectangle in
| |
| intersects | back to summary |
|---|---|
| public boolean intersects(Rectangle2D r) Implements java. Doc from java. Tests if the interior of the
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.
| |
| isEmpty | back to summary |
|---|---|
| public abstract boolean isEmpty() Determines whether the
| |
| setFrame | back to summary |
|---|---|
| public abstract void setFrame(double x, double y, double w, double h) Sets the location and size of the framing rectangle of this
| |
| setFrame | back to summary |
|---|---|
| public void setFrame(Point2D loc, Dimension2D size) Sets the location and size of the framing rectangle of this
| |
| setFrame | back to summary |
|---|---|
| public void setFrame(Rectangle2D r) Sets the framing rectangle of this
| |
| setFrameFromCenter | back to summary |
|---|---|
| public void setFrameFromCenter(double centerX, double centerY, double cornerX, double cornerY) Sets the framing rectangle of this
| |
| setFrameFromCenter | back to summary |
|---|---|
| public void setFrameFromCenter(Point2D center, Point2D corner) Sets the framing rectangle of this | |
| setFrameFromDiagonal | back to summary |
|---|---|
| public void setFrameFromDiagonal(double x1, double y1, double x2, double y2) Sets the diagonal of the framing rectangle of this
| |
| setFrameFromDiagonal | back to summary |
|---|---|
| public void setFrameFromDiagonal(Point2D p1, Point2D p2) Sets the diagonal of the framing rectangle of this | |