java.awt
Interface Shape

All Known Implementing Classes:
Line, Line2D, Line2D.Double, Line2D.Float, Rectangle, Rectangle2D, Rectangle2D.Double, Rectangle2D.Float, RectangularShape

public interface Shape

Shape interface without getPathIterator methods

Author:
Lawrie Griffiths

Method Summary
 boolean contains(double x, double y)
          Test if the shape contains the point (x,y)
 boolean contains(double x, double y, double w, double h)
          Test if the shape contains the rectangle with top left at (x,y), width w and height h.
 boolean contains(Point2D p)
          Test if the shape contains the Point2D
 boolean contains(Rectangle2D r)
          Test if the shape contains the Rectangle2D
 Rectangle getBounds()
          Get the bounding Rectangle for the shape
 Rectangle2D getBounds2D()
          Get the bounding Rectangle2D for the shape
 boolean intersects(double x, double y, double w, double h)
          Test if the shape intersects the rectangle with top left at (x,y), width w and height h.
 boolean intersects(Rectangle2D r)
          Test if the shape intersects the Rectangle2D r
 

Method Detail

getBounds

Rectangle getBounds()
Get the bounding Rectangle for the shape

Returns:
the bounding Rectangle

getBounds2D

Rectangle2D getBounds2D()
Get the bounding Rectangle2D for the shape

Returns:
the bounding Rectangle2D

contains

boolean contains(double x,
                 double y)
Test if the shape contains the point (x,y)

Parameters:
x - the x co-ordinate of the point
y - the y co-ordinate of the point
Returns:
true iff the shape contains the point

contains

boolean contains(Point2D p)
Test if the shape contains the Point2D

Parameters:
p - the Point2D
Returns:
true iff the shape contains the point

intersects

boolean intersects(double x,
                   double y,
                   double w,
                   double h)
Test if the shape intersects the rectangle with top left at (x,y), width w and height h.

Parameters:
x - the x-coordinate of the top left point of the rectangle
y - the y-coordinate of the top left point of the rectangle
w - the width of the rectangle
h - the height of the rectangle
Returns:
true iff the shape intersects the rectangle

intersects

boolean intersects(Rectangle2D r)
Test if the shape intersects the Rectangle2D r

Parameters:
r - the Recangle2D
Returns:
true iff the shape intersects the Rectangle2D

contains

boolean contains(double x,
                 double y,
                 double w,
                 double h)
Test if the shape contains the rectangle with top left at (x,y), width w and height h.

Parameters:
x - the x-coordinate of the top left point of the rectangle
y - the y-coordinate of the top left point of the rectangle
w - the width of the rectangle
h - the height of the rectangle
Returns:
true iff the shape contains the rectangle

contains

boolean contains(Rectangle2D r)
Test if the shape contains the Rectangle2D

Parameters:
r - the Rectangle2D
Returns:
true iff the shape contains the Rectangle2D