|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rit.draw.item.DrawingItem
edu.rit.draw.item.OutlinedItem
edu.rit.draw.item.FilledItem
edu.rit.draw.item.ShapeItem
edu.rit.draw.item.Polygon
public class Polygon
Class Polygon provides a polygon DrawingItem whose boundary consists of one or more straight line segments. The polygon has an outline and a filled interior.
| Field Summary |
|---|
| Fields inherited from class edu.rit.draw.item.FilledItem |
|---|
NORMAL_FILL |
| Fields inherited from class edu.rit.draw.item.OutlinedItem |
|---|
NORMAL_OUTLINE |
| Constructor Summary | |
|---|---|
Polygon()
Construct a new polygon. |
|
Polygon(Polygon thePolygon)
Construct a new polygon with the same points, outline, and fill paint as the given polygon. |
|
| Method Summary | |
|---|---|
Polygon |
add()
Add this polygon to the end of the default drawing's sequence of drawing items. |
Polygon |
add(Drawing theDrawing)
Add this polygon to the end of the given drawing's sequence of drawing items. |
Polygon |
addFirst()
Add this polygon to the beginning of the default drawing's sequence of drawing items. |
Polygon |
addFirst(Drawing theDrawing)
Add this polygon to the beginning of the given drawing's sequence of drawing items. |
Polygon |
by(double dx,
double dy)
Add a line segment to this polygon. |
Polygon |
by(Size theSize)
Add a line segment to this polygon. |
Polygon |
clear()
Clear this polygon. |
Polygon |
fill(Fill theFill)
Set this polygon's fill paint. |
Polygon |
hby(double dx)
Add a horizontal line segment to this polygon. |
Polygon |
hby(Size theSize)
Add a horizontal line segment to this polygon. |
double |
height()
Returns the height of this polygon's bounding box. |
Polygon |
hto(double x)
Add a horizontal line segment to this polygon. |
Polygon |
hto(Point thePoint)
Add a horizontal line segment to this polygon. |
Point |
nw()
Returns the northwest corner point of this polygon's bounding box. |
Polygon |
outline(Outline theOutline)
Set this polygon's outline. |
void |
readExternal(ObjectInput in)
Read this polygon from the given object input stream. |
Size |
size()
Returns the size of this polygon's bounding box. |
Polygon |
to(double x,
double y)
Add a line segment to this polygon. |
Polygon |
to(Point thePoint)
Add a line segment to this polygon. |
Polygon |
vby(double dy)
Add a vertical line segment to this polygon. |
Polygon |
vby(Size theSize)
Add a vertical line segment to this polygon. |
Polygon |
vto(double y)
Add a vertical line segment to this polygon. |
Polygon |
vto(Point thePoint)
Add a vertical line segment to this polygon. |
double |
width()
Returns the width of this polygon's bounding box. |
void |
writeExternal(ObjectOutput out)
Write this polygon to the given object output stream. |
| Methods inherited from class edu.rit.draw.item.ShapeItem |
|---|
draw |
| Methods inherited from class edu.rit.draw.item.FilledItem |
|---|
defaultFill, defaultFill, fill |
| Methods inherited from class edu.rit.draw.item.OutlinedItem |
|---|
defaultOutline, defaultOutline, outline |
| Methods inherited from class edu.rit.draw.item.DrawingItem |
|---|
boundingBox, c, e, n, ne, s, se, sw, w |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Polygon()
public Polygon(Polygon thePolygon)
thePolygon - Polygon.
NullPointerException - (unchecked exception) Thrown if thePolygon is null.| Method Detail |
|---|
public Size size()
size in class DrawingItempublic double width()
width in class DrawingItempublic double height()
height in class DrawingItempublic Point nw()
nw in class DrawingItempublic Polygon outline(Outline theOutline)
outline in class ShapeItemtheOutline - Outline, or Outline.NONE.
public Polygon fill(Fill theFill)
fill in class ShapeItemtheFill - Fill paint, or Fill.NONE.
public Polygon clear()
public Polygon to(double x,
double y)
x - Endpoint's X coordinate.y - Endpoint's Y coordinate.
public Polygon to(Point thePoint)
thePoint - Endpoint.
NullPointerException - (unchecked exception) Thrown if thePoint is null.public Polygon hto(double x)
x - Endpoint's X coordinate.
NullPointerException - (unchecked exception) Thrown if there is no previous endpoint.public Polygon hto(Point thePoint)
thePoint - Endpoint.
NullPointerException - (unchecked exception) Thrown if thePoint is null. Thrown if
there is no previous endpoint.public Polygon vto(double y)
y - Endpoint's Y coordinate.
NullPointerException - (unchecked exception) Thrown if there is no previous endpoint.public Polygon vto(Point thePoint)
thePoint - Endpoint.
NullPointerException - (unchecked exception) Thrown if thePoint is null. Thrown if
there is no previous endpoint.
public Polygon by(double dx,
double dy)
dx - X distance.dy - Y distance.
NullPointerException - (unchecked exception) Thrown if there is no previous endpoint.public Polygon by(Size theSize)
theSize - Distance.
NullPointerException - (unchecked exception) Thrown if theSize is null. Thrown if
there is no previous endpoint.public Polygon hby(double dx)
dx - X distance.
NullPointerException - (unchecked exception) Thrown if there is no previous endpoint.public Polygon hby(Size theSize)
theSize - Distance.
NullPointerException - (unchecked exception) Thrown if theSize is null. Thrown if
there is no previous endpoint.public Polygon vby(double dy)
dy - Y distance.
NullPointerException - (unchecked exception) Thrown if there is no previous endpoint.public Polygon vby(Size theSize)
theSize - Distance.
NullPointerException - (unchecked exception) Thrown if theSize is null. Thrown if
there is no previous endpoint.public Polygon add()
add in class ShapeItemNullPointerException - (unchecked exception) Thrown if there is no default drawing.Drawing.defaultDrawing()public Polygon add(Drawing theDrawing)
add in class ShapeItemtheDrawing - Drawing.
NullPointerException - (unchecked exception) Thrown if theDrawing is null.public Polygon addFirst()
addFirst in class ShapeItemNullPointerException - (unchecked exception) Thrown if there is no default drawing.Drawing.defaultDrawing()public Polygon addFirst(Drawing theDrawing)
addFirst in class ShapeItemtheDrawing - Drawing.
NullPointerException - (unchecked exception) Thrown if theDrawing is null.
public void writeExternal(ObjectOutput out)
throws IOException
writeExternal in interface ExternalizablewriteExternal in class FilledItemout - Object output stream.
IOException - Thrown if an I/O error occurred.
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
readExternal in interface ExternalizablereadExternal in class FilledItemin - Object input stream.
IOException - Thrown if an I/O error occurred.
ClassNotFoundException - Thrown if any class needed to deserialize this polygon cannot be
found.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||