|
||||||||||
| 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.Arc
public class Arc
Class Arc provides a DrawingItem that is a circular arc. The arc has an outline but no filled interior. The arc is defined by the following attributes:
Angles increase from the positive X axis towards the positive Y axis. Since the positive X axis points to the right and the positive Y axis points down, angles increase in the clockwise direction. (This is the opposite of the usual mathematical convention, where the positive Y axis points upwards.)
The static defaultCenter(), defaultRadius(), defaultStart(), and defaultExtent() methods are provided to set the default center point, radius, starting angle, and angular extent. If the center point, radius, starting angle, or angular extent is not specified, the current default center point, radius, starting angle, or angular extent is used.
| Field Summary | |
|---|---|
static Point |
NORMAL_CENTER
The normal center point: (0,0). |
static double |
NORMAL_EXTENT
The normal angular extent: π/2. |
static double |
NORMAL_RADIUS
The normal radius: 1. |
static double |
NORMAL_START
The normal starting angle: 0. |
| Fields inherited from class edu.rit.draw.item.OutlinedItem |
|---|
NORMAL_OUTLINE |
| Constructor Summary | |
|---|---|
Arc()
Construct a new arc. |
|
Arc(Arc theArc)
Construct a new arc with the same center point, radius, starting angle, and angular extent as the given arc. |
|
| Method Summary | |
|---|---|
Arc |
add()
Add this arc to the end of the default drawing's sequence of drawing items. |
Arc |
add(Drawing theDrawing)
Add this arc to the end of the given drawing's sequence of drawing items. |
Arc |
addFirst()
Add this arc to the beginning of the default drawing's sequence of drawing items. |
Arc |
addFirst(Drawing theDrawing)
Add this arc to the beginning of the given drawing's sequence of drawing items. |
Point |
center()
Returns this arc's center point. |
Arc |
center(Point theCenter)
Set this arc's center point. |
static Point |
defaultCenter()
Returns the default center point. |
static void |
defaultCenter(Point theCenter)
Set the default center point. |
static double |
defaultExtent()
Returns the default angular extent. |
static void |
defaultExtent(double theExtent)
Set the default angular extent. |
static double |
defaultRadius()
Returns the default radius. |
static void |
defaultRadius(double theRadius)
Set the default radius. |
static double |
defaultStart()
Returns the default starting angle. |
static void |
defaultStart(double theStart)
Set the default starting angle. |
void |
draw(Graphics2D g2d)
Draw this drawing item in the given graphics context. |
double |
extent()
Returns this arc's angular extent. |
Arc |
extent(double theExtent)
Set this arc's angular extent. |
double |
height()
Returns the height of this drawing item's bounding box. |
Point |
nw()
Returns the northwest corner point of this drawing item's bounding box. |
Arc |
outline(Outline theOutline)
Set this arc's outline. |
double |
radius()
Returns this arc's radius. |
Arc |
radius(double theRadius)
Set this arc's radius. |
void |
readExternal(ObjectInput in)
Read this arc from the given object input stream. |
Size |
size()
Returns the size of this drawing item's bounding box. |
double |
start()
Returns this arc's starting angle. |
Arc |
start(double theStart)
Set this arc's starting angle. |
double |
width()
Returns the width of this drawing item's bounding box. |
void |
writeExternal(ObjectOutput out)
Write this arc to the given object output stream. |
| 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 |
| Field Detail |
|---|
public static final Point NORMAL_CENTER
public static final double NORMAL_RADIUS
public static final double NORMAL_START
public static final double NORMAL_EXTENT
| Constructor Detail |
|---|
public Arc()
public Arc(Arc theArc)
theArc - Arc.
NullPointerException - (unchecked exception) Thrown if theArc is null.| Method Detail |
|---|
public static Point defaultCenter()
public static void defaultCenter(Point theCenter)
theCenter - Default center point.
NullPointerException - (unchecked exception) Thrown if theCenter is null.public static double defaultRadius()
public static void defaultRadius(double theRadius)
theRadius - Default radius.
IllegalArgumentException - (unchecked exception) Thrown if theRadius <= 0.public static double defaultStart()
public static void defaultStart(double theStart)
theStart - Default starting angle (radians).public static double defaultExtent()
public static void defaultExtent(double theExtent)
theExtent - Default angular extent (radians).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 Arc outline(Outline theOutline)
outline in class OutlinedItemtheOutline - Outline, or Outline.NONE.
public Point center()
public Arc center(Point theCenter)
theCenter - Center point.
NullPointerException - (unchecked exception) Thrown if theCenter is null.public double radius()
public Arc radius(double theRadius)
theRadius - Radius.
IllegalArgumentException - (unchecked exception) Thrown if theRadius <= 0.public double start()
public Arc start(double theStart)
theStart - Starting angle (radians).
public double extent()
public Arc extent(double theExtent)
theExtent - Angular extent (radians).
public Arc add()
add in class OutlinedItemNullPointerException - (unchecked exception) Thrown if there is no default drawing.Drawing.defaultDrawing()public Arc add(Drawing theDrawing)
add in class OutlinedItemtheDrawing - Drawing.
NullPointerException - (unchecked exception) Thrown if theDrawing is null.public Arc addFirst()
addFirst in class OutlinedItemNullPointerException - (unchecked exception) Thrown if there is no default drawing.Drawing.defaultDrawing()public Arc addFirst(Drawing theDrawing)
addFirst in class OutlinedItemtheDrawing - Drawing.
NullPointerException - (unchecked exception) Thrown if theDrawing is null.
public void writeExternal(ObjectOutput out)
throws IOException
writeExternal in interface ExternalizablewriteExternal in class OutlinedItemout - 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 OutlinedItemin - Object input stream.
IOException - Thrown if an I/O error occurred.
ClassNotFoundException - Thrown if any class needed to deserialize this line cannot be found.public void draw(Graphics2D g2d)
draw in class DrawingItemg2d - 2-D graphics context.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||