Java Platform 1.2
Beta 4

Class java.awt.geom.RectangularShape

java.lang.Object
  |
  +--java.awt.geom.RectangularShape
Direct Known Subclasses:
Arc2D, Ellipse2D, Rectangle2D, RoundRectangle2D

public abstract class RectangularShape
extends Object
implements Shape, Cloneable
The base class for a number of shapes 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 Shapes objects. The manipulation methods provided by this class allow you to query and modify the rectangular frame which provides a reference relative to which the subclasses define their geometry.


Constructor Summary
RectangularShape()
          This is an abstract class that cannot be instantiated directly.
 
Method Summary
 Object clone()
          Creates a new object of the same class as this object.
 boolean contains(Point2D p)
          Test if a given Point is inside the boundary of the shape.
 boolean contains(Rectangle2D r)
          Test if the interior of the Shape entirely contains the given Rectangle.
 Rectangle getBounds()
          Return the bounding box of the shape.
 double getCenterX()
          Returns the X coordinate of the center of the shape in double precision.
 double getCenterY()
          Returns the Y coordinate of the center of the shape in double precision.
 Rectangle2D getFrame()
          Returns the framing rectangle which defines the overall shape of this object.
abstract  double getHeight()
          Returns the height of the bounding rectangle in double precision.
 double getMaxX()
          Returns the X coordinate of the right edge of the shape in double precision.
 double getMaxY()
          Returns the Y coordinate of the bottom edge of the shape in double precision.
 double getMinX()
          Returns the X coordinate of the left edge of the shape in double precision.
 double getMinY()
          Returns the Y coordinate of the top edge of the shape in double precision.
 PathIterator getPathIterator(AffineTransform at, double flatness)
          Return an iterator object that iterates along the boundary of the shape and provides access to a flattened view of the geometry of the outline of the shape.
abstract  double getWidth()
          Returns the width of the bounding rectangle in double precision.
abstract  double getX()
          Returns the X coordinate of the bounding rectangle in double precision.
abstract  double getY()
          Returns the Y coordinate of the bounding rectangle in double precision.
 boolean intersects(Rectangle2D r)
          Test if the interior of the Shape intersects the interior of a given Rectangle.
abstract  boolean isEmpty()
          Determines whether the rectangular shape is empty.
abstract  void setFrame(double x, double y, double w, double h)
          Sets the location and size of the outer bounds of this shape to the specified rectangular values.
 void setFrame(Point2D loc, Dimension2D size)
          Sets the outer bounds of this shape to be the same as the specified Point and Dimension objects.
 void setFrame(Rectangle2D r)
          Sets the outer bounds of this shape to be the same as the specified Rectangle.
 void setFrameFromCenter(double centerX, double centerY, double cornerX, double cornerY)
          Sets the outer bounds of this shape based on a center point and a corner point.
 void setFrameFromCenter(Point2D center, Point2D corner)
          Sets the outer bounds of this shape based on a center point and a corner point.
 void setFrameFromDiagonal(double x1, double y1, double x2, double y2)
          Sets the outer bounds of this shape based on two points along one of its diagonals.
 void setFrameFromDiagonal(Point2D p1, Point2D p2)
          Sets the outer bounds of this shape based on two Point objects along one of its diagonals.
 
Methods inherited from class java.lang.Object
equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait
 

Constructor Detail

RectangularShape

protected RectangularShape()
This is an abstract class that cannot be instantiated directly.
See Also:
Arc2D, Ellipse2D, Rectangle2D, RoundRectangle2D
Method Detail

getX

public abstract double getX()
Returns the X coordinate of the bounding rectangle in double precision.

getY

public abstract double getY()
Returns the Y coordinate of the bounding rectangle in double precision.

getWidth

public abstract double getWidth()
Returns the width of the bounding rectangle in double precision.

getHeight

public abstract double getHeight()
Returns the height of the bounding rectangle in double precision.

getMinX

public double getMinX()
Returns the X coordinate of the left edge of the shape in double precision.

getMinY

public double getMinY()
Returns the Y coordinate of the top edge of the shape in double precision.

getMaxX

public double getMaxX()
Returns the X coordinate of the right edge of the shape in double precision.

getMaxY

public double getMaxY()
Returns the Y coordinate of the bottom edge of the shape in double precision.

getCenterX

public double getCenterX()
Returns the X coordinate of the center of the shape in double precision.

getCenterY

public double getCenterY()
Returns the Y coordinate of the center of the shape in double precision.

getFrame

public Rectangle2D getFrame()
Returns the framing rectangle which defines the overall shape of this object.

isEmpty

public abstract boolean isEmpty()
Determines whether the rectangular shape is empty.

setFrame

public abstract void setFrame(double x,
                              double y,
                              double w,
                              double h)
Sets the location and size of the outer bounds of this shape to the specified rectangular values.

setFrame

public void setFrame(Point2D loc,
                     Dimension2D size)
Sets the outer bounds of this shape to be the same as the specified Point and Dimension objects.

setFrame

public void setFrame(Rectangle2D r)
Sets the outer bounds of this shape to be the same as the specified Rectangle.

setFrameFromDiagonal

public void setFrameFromDiagonal(double x1,
                                 double y1,
                                 double x2,
                                 double y2)
Sets the outer bounds of this shape based on two points along one of its diagonals.

setFrameFromDiagonal

public void setFrameFromDiagonal(Point2D p1,
                                 Point2D p2)
Sets the outer bounds of this shape based on two Point objects along one of its diagonals.

setFrameFromCenter

public void setFrameFromCenter(double centerX,
                               double centerY,
                               double cornerX,
                               double cornerY)
Sets the outer bounds of this shape based on a center point and a corner point.

setFrameFromCenter

public void setFrameFromCenter(Point2D center,
                               Point2D corner)
Sets the outer bounds of this shape based on a center point and a corner point.

contains

public boolean contains(Point2D p)
Test if a given Point is inside the boundary of the shape.
Specified by:
contains in interface Shape

intersects

public boolean intersects(Rectangle2D r)
Test if the interior of the Shape intersects the interior of a given Rectangle.
Specified by:
intersects in interface Shape

contains

public boolean contains(Rectangle2D r)
Test if the interior of the Shape entirely contains the given Rectangle.
Specified by:
contains in interface Shape

getBounds

public Rectangle getBounds()
Return the bounding box of the shape.
Specified by:
getBounds in interface Shape

getPathIterator

public PathIterator getPathIterator(AffineTransform at,
                                    double flatness)
Return an iterator object that iterates along the boundary of the shape and provides access to a flattened view of the geometry of the outline of the shape. 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 ?REMIND?. An optional affine transform can be specified in which case the coordinates returned in the iteration will be transformed accordingly.
Specified by:
getPathIterator in interface Shape
Parameters:
at - an optional AffineTransform to be applied to the coordinates as they are returned in the iteration, or null if the untransformed coordinates are desired.
flatness - the maximum amount that the control points for a given curve can vary from colinear before a subdivided curve is replaced by a straight line connecting the endpoints.

clone

public Object clone()
Creates a new object of the same class as this object.
Returns:
a clone of this instance.
Throws:
OutOfMemoryError - if there is not enough memory.
Overrides:
clone in class Object
Since:
JDK1.2
See Also:
Cloneable

Java Platform 1.2
Beta 4

Submit a bug or feature
Submit comments/suggestions about new javadoc look
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.
This documentation was generated with a post-Beta4 version of Javadoc.