Package jcckit.graphic
Class Polygon
java.lang.Object
jcckit.graphic.BasicGraphicalElement
jcckit.graphic.Polygon
- All Implemented Interfaces:
GraphicalElement
A polygon or polyline.
-
Constructor Summary
ConstructorsConstructorDescriptionPolygon(GraphicAttributes attributes, boolean closed) Creates an instance of the specified graphic attributes. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPoint(GraphPoint point) Adds a new point to the end of the list of points.intReturns the number points.getPoint(int index) Returns the point for the specified index.booleanisClosed()Returns true if this polygon is closed.voidRemoves all points.voidrenderWith(Renderer renderer) Renders this line with the specifiedRenderer.voidreplacePointAt(int index, GraphPoint point) Replaces the point at the specified index by a new one.Methods inherited from class jcckit.graphic.BasicGraphicalElement
getGraphicAttributes
-
Constructor Details
-
Polygon
Creates an instance of the specified graphic attributes.- Parameters:
attributes- attributes of the instance to be createdclosed- true if this polygon is closed.
-
-
Method Details
-
isClosed
public boolean isClosed()Returns true if this polygon is closed.- Overrides:
isClosedin classBasicGraphicalElement- Returns:
- true if the shape is closed.
-
getNumberOfPoints
public int getNumberOfPoints()Returns the number points. -
getPoint
Returns the point for the specified index. -
addPoint
Adds a new point to the end of the list of points. -
removeAllPoints
public void removeAllPoints()Removes all points. -
replacePointAt
Replaces the point at the specified index by a new one. -
renderWith
Renders this line with the specifiedRenderer.- Parameters:
renderer- An instance ofPolygonRenderer.- Throws:
IllegalArgumentException- if renderer is not an instance of PolygonRenderer.
-