Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Class java.awt.geom.RectangularShape

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

public abstract class RectangularShape
extends Object
implements Shape, Cloneable
The base class for a number of shapes which inscribe a rectangular set of outer bounds. This class provides common manipulation routines for operating on a shape by querying and modifying its bounding rectangle.


Constructor Summary
 RectangularShape()
 
 

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.
double  getBottom()
Returns the Y coordinate of the bottom edge of the shape in double precision.
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.
double  getHeight()
Returns the height of the bounding rectangle in double precision.
double  getLeft()
Returns the X coordinate of the left 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.
double  getRight()
Returns the X coordinate of the right edge of the shape in double precision.
double  getTop()
Returns the Y coordinate of the top edge of the shape in double precision.
double  getWidth()
Returns the width of the bounding rectangle in double precision.
double  getX()
Returns the X coordinate of the bounding rectangle in double precision.
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.
boolean  isEmpty()
Determines whether the rectangular shape is empty.
void  setBounds(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  setBounds(Point2D loc, Dimension2D size)
Sets the outer bounds of this shape to be the same as the specified Point and Dimension objects.
void  setBounds(Rectangle2D r)
Sets the outer bounds of this shape to be the same as the specified Rectangle.
void  setBoundsFromCenter(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  setBoundsFromCenter(Point2D center, Point2D corner)
Sets the outer bounds of this shape based on a center point and a corner point.
void  setBoundsFromDiagonal(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  setBoundsFromDiagonal(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
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RectangularShape

protected RectangularShape()
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.

getLeft

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

getTop

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

getRight

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

getBottom

public double getBottom()
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.

isEmpty

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

setBounds

public abstract void setBounds(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.

setBounds

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

setBounds

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

setBoundsFromDiagonal

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

setBoundsFromDiagonal

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

setBoundsFromCenter

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

setBoundsFromCenter

public void setBoundsFromCenter(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.
Implements:
contains in interface Shape

intersects

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

contains

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

getBounds

public Rectangle getBounds()
Return the bounding box of the shape.
Implements:
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.
Implements:
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
See Also:
Cloneable

Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

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.