gishur.gui2
Interface Shape

All Superinterfaces:
java.lang.Cloneable, Cloneable, java.awt.Shape
All Known Implementing Classes:
EllipseShape, PolygonShape, RectangleShape, ShapeContainer

public interface Shape
extends java.awt.Shape, Cloneable

The Shape interface provides definitions for objects that represent some form of geometric shape in the screens integer coordinate space. Every Shape stores a name to identify the element. Shapes are meant to be static and should not be changed after creation.

Version:
1.0
Author:
Thomas Wolf

Method Summary
 boolean contains(int x, int y)
          Tests if a given coordinate is inside the boundary of the Shape.
 boolean contains(int x, int y, int w, int h)
          Tests if the interior of the Shape entirely contains the specified rectangular area.
 boolean contains(java.awt.Point p)
          Tests if a specified Point is inside the boundary of the Shape.
 void draw(java.awt.Graphics g)
          Strokes the outline of the Shape using the settings of the Graphics context.
 void fill(java.awt.Graphics g)
          Fills the interior of the Shape using the settings of the Graphics context.
 RectangleShape getBoundShape()
          Return the bounding box of the Shape.
 java.awt.Point getCenter()
          Returns the center point of the framing rectangle of the Shape.
 int getCenterX()
          Returns the X coordinate of the center of the framing rectangle of the Shape.
 int getCenterY()
          Returns the Y coordinate of the center of the framing rectangle of the Shape.
 boolean intersects(int x, int y, int w, int h)
          Tests if the interior of the Shape intersects the interior of a specified rectangular area.
 void setLocation(int x, int y)
          Moves the this Shape to the specified location.
 void translate(int dx, int dy)
          Translates this Shape by the vector (x,y).
 
Methods inherited from interface java.awt.Shape
contains, contains, contains, contains, getBounds, getBounds2D, getPathIterator, getPathIterator, intersects, intersects
 
Methods inherited from interface gishur.core.Cloneable
clone
 

Method Detail

contains

public boolean contains(int x,
                        int y)
Tests if a given coordinate is inside the boundary of the Shape.
Parameters:
x - x-coordinate of the point
y - y-coordinate of the point
Returns:
true if the specified point is inside the boundary of the Shape; false otherwise.

contains

public boolean contains(java.awt.Point p)
Tests if a specified Point is inside the boundary of the Shape.
Parameters:
p - a specified point
Returns:
true if the specified point is inside the boundary of the Shape; false otherwise.

intersects

public boolean intersects(int x,
                          int y,
                          int w,
                          int h)
Tests if the interior of the Shape intersects the interior of a specified rectangular area. The rectangular area is considered to intersect the Shape if any point is contained in both the interior of the Shape and the specified rectangular area.
Parameters:
x, y - the coordinates of the specified rectangular area
w - the width of the specified rectangular area
h - the height of the specified rectangular area
Returns:
true if the interior of the Shape and the interior of the rectangular area intersect; false otherwise.

contains

public boolean contains(int x,
                        int y,
                        int w,
                        int h)
Tests if the interior of the Shape entirely contains the specified rectangular area. All coordinates that lie inside the rectangular area must lie within the Shape for the entire rectanglar area to be considered contained within the Shape.
Parameters:
x, y - the coordinates of the specified rectangular area
w - the width of the specified rectangular area
h - the height of the specified rectangular area
Returns:
true if the interior of the Shape entirely contains the specified rectangular area; false otherwise.
See Also:
intersects(int, int, int, int)

getBoundShape

public RectangleShape getBoundShape()
Return the bounding box of the Shape.
Returns:
bounding box.

getCenterX

public int getCenterX()
Returns the X coordinate of the center of the framing rectangle of the Shape.
Returns:
X coordinate of the Shape

getCenterY

public int getCenterY()
Returns the Y coordinate of the center of the framing rectangle of the Shape.
Returns:
Y coordinate of the Shape

getCenter

public java.awt.Point getCenter()
Returns the center point of the framing rectangle of the Shape.
Returns:
center point of the shape

translate

public void translate(int dx,
                      int dy)
Translates this Shape by the vector (x,y).
Parameters:
dx - x coordinate of the translation vector
dy - y coordinate of the translation vector

setLocation

public void setLocation(int x,
                        int y)
Moves the this Shape to the specified location.
Parameters:
dx - x coordinate of point to move to
dy - y coordinate of point to move to

draw

public void draw(java.awt.Graphics g)
Strokes the outline of the Shape using the settings of the Graphics context. This does nothing, if the Shape is not visible (see #visible).
Parameters:
g - Graphics context

fill

public void fill(java.awt.Graphics g)
Fills the interior of the Shape using the settings of the Graphics context. This does nothing, if the Shape is not visible (see #visible).
Parameters:
g - Graphics context