jcckit.graphic
Class Polygon

java.lang.Object
  extended byjcckit.graphic.BasicGraphicalElement
      extended byjcckit.graphic.Polygon
All Implemented Interfaces:
GraphicalElement

public class Polygon
extends BasicGraphicalElement

A polygon or polyline.

Author:
Franz-Josef Elmer

Constructor Summary
Polygon(GraphicAttributes attributes, boolean closed)
          Creates an instance of the specified graphic attributes.
 
Method Summary
 void addPoint(GraphPoint point)
          Adds a new point to the end of the list of points.
 int getNumberOfPoints()
          Returns the number points.
 GraphPoint getPoint(int index)
          Returns the point for the specified index.
 boolean isClosed()
          Returns true if this polygon is closed.
 void removeAllPoints()
          Removes all points.
 void renderWith(Renderer renderer)
          Renders this line with the specified Renderer.
 void replacePointAt(int index, GraphPoint point)
          Replaces the point at the specified index by a new one.
 
Methods inherited from class jcckit.graphic.BasicGraphicalElement
getGraphicAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Polygon

public Polygon(GraphicAttributes attributes,
               boolean closed)
Creates an instance of the specified graphic attributes.

Parameters:
closed - true if this polygon is closed.
Method Detail

isClosed

public boolean isClosed()
Returns true if this polygon is closed.

Overrides:
isClosed in class BasicGraphicalElement
Returns:
true if the shape is closed.

getNumberOfPoints

public int getNumberOfPoints()
Returns the number points.


getPoint

public GraphPoint getPoint(int index)
Returns the point for the specified index.


addPoint

public void addPoint(GraphPoint point)
Adds a new point to the end of the list of points.


removeAllPoints

public void removeAllPoints()
Removes all points.


replacePointAt

public void replacePointAt(int index,
                           GraphPoint point)
Replaces the point at the specified index by a new one.


renderWith

public void renderWith(Renderer renderer)
Renders this line with the specified Renderer.

Parameters:
renderer - An instance of PolygonRenderer.
Throws:
java.lang.IllegalArgumentException - if renderer is not an instance of PolygonRenderer.