algoanim.primitives
Class Polygon

java.lang.Object
  extended by algoanim.primitives.Primitive
      extended by algoanim.primitives.Polygon

public class Polygon
extends Primitive

Represents a polygon defined by an arbitrary number of Nodes. In contrast to a Polyline the figure is closed. The first and the last Node are automatically connected.

Author:
Stephan Mehlhase

Field Summary
 
Fields inherited from class algoanim.primitives.Primitive
gen
 
Constructor Summary
Polygon(PolygonGenerator pg, Node[] theNodes, java.lang.String name, DisplayOptions display, PolygonProperties pp)
          Instantiates the Polygon and calls the create() method of the associated PolygonGenerator.
 
Method Summary
 Node[] getNodes()
          Returns the nodes of this Polygon.
 PolygonProperties getProperties()
          Returns the properties of this Polygon.
 void setName(java.lang.String newName)
          Sets the name of this Primitive.
 
Methods inherited from class algoanim.primitives.Primitive
changeColor, exchange, getDisplayOptions, getName, hide, hide, moveBy, moveTo, moveVia, rotate, rotate, show, show
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Polygon

public Polygon(PolygonGenerator pg,
               Node[] theNodes,
               java.lang.String name,
               DisplayOptions display,
               PolygonProperties pp)
        throws NotEnoughNodesException
Instantiates the Polygon and calls the create() method of the associated PolygonGenerator.

Parameters:
pg - the appropriate code Generator.
theNodes - the nodes of this Polygon.
name - the name of this Polygon.
display - [optional] the DisplayOptions of this Polygon.
pp - [optional] the properties of this Polygon.
Throws:
NotEnoughNodesException
Method Detail

getNodes

public Node[] getNodes()
Returns the nodes of this Polygon.

Returns:
the nodes of this Polygon.

getProperties

public PolygonProperties getProperties()
Returns the properties of this Polygon.

Returns:
the properties of this Polygon.

setName

public void setName(java.lang.String newName)
Description copied from class: Primitive
Sets the name of this Primitive.

Overrides:
setName in class Primitive
Parameters:
newName - the new name for this Primitive.
See Also:
Primitive.setName(java.lang.String)