computational.geometry
Interface Shape

All Known Implementing Classes:
ConvexPolygon, HorizontalRay, MergePoint, MyPoint, Point, Polygon, Polygon.Edge, Polygon.Vertex, Ray, Rectangle, Segment, SimplePolygon, Square, SweepingLine.SegmentEndPoint, Triangle, Vertex

public interface Shape


Method Summary
 boolean contains(Point p)
          Tells whether the shape encloses a given point.
 void draw(java.awt.Graphics gfx)
          Draws the shape, using the current graphics context's color.
 void drawLabels(java.awt.Graphics gfx)
          Draws the shape's associated labels, using the graphics context's color.
 void drawPoints(java.awt.Graphics gfx)
          Draws the shape's defining points, using the graphics context's color.
 java.lang.String getLabel()
          Returns the text label associated to this shape.
 java.util.List getPoints()
          Returns a list containing copies of the shape's defining points.
 void setLabel(java.lang.String label)
          Associates this shape with a given text label.
 void translate(int dx, int dy)
          Translates the shape by the given amount.
 

Method Detail

contains

boolean contains(Point p)
Tells whether the shape encloses a given point. To the aims of this test, we consider the shape to be closed, so that a point lying on the shape's boundaries results as enclosed in the shape.

Parameters:
p - the point we test for encloseness.
Returns:
true iff the point is enclosed in the shape.

draw

void draw(java.awt.Graphics gfx)
Draws the shape, using the current graphics context's color.

Parameters:
gfx - the graphics context where this shape has to be drawn.

drawLabels

void drawLabels(java.awt.Graphics gfx)
Draws the shape's associated labels, using the graphics context's color.

Parameters:
gfx - the graphics context where this shape's labels have to be drawn.

drawPoints

void drawPoints(java.awt.Graphics gfx)
Draws the shape's defining points, using the graphics context's color.

Parameters:
gfx - the graphics context where this shape's points have to be drawn.

getLabel

java.lang.String getLabel()
Returns the text label associated to this shape.

Returns:
the shape's label.

getPoints

java.util.List getPoints()
Returns a list containing copies of the shape's defining points.

Returns:
the shape's cloned defining points.

setLabel

void setLabel(java.lang.String label)
Associates this shape with a given text label.

Parameters:
label - the shape's new label.

translate

void translate(int dx,
               int dy)
Translates the shape by the given amount.

Parameters:
dx - the amount to translate along the X-axis
dx - the amount to translate along the Y-axis