edu.rit.slides.items
Class ArcItem

java.lang.Object
  extended by edu.rit.slides.items.SlideItem
      extended by edu.rit.slides.items.OutlinedItem
          extended by edu.rit.slides.items.ArcItem
All Implemented Interfaces:
Externalizable, Serializable

public class ArcItem
extends OutlinedItem
implements Externalizable

Class ArcItem provides a slide item that consists of a circular arc. The arc item has an outline but has no interior.

Class ArcItem keeps track of the "last arc item." The static ArcItem.last() method returns a reference to the last created arc item.

When an ArcItem is created, the "last point" (returned by the Point.last() method) is set to the arc item's center point.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.rit.slides.items.OutlinedItem
NORMAL_OUTLINE
 
Constructor Summary
ArcItem()
          Construct a new empty arc item.
ArcItem(Point center, double radius, double start, double extent)
          Construct a new arc item.
ArcItem(Point center, double radius, double start, double extent, Outline theOutline)
          Construct a new arc item with the given outline.
 
Method Summary
 void draw(Graphics2D g2d)
          Draw this arc item in the given graphics context.
static ArcItem last()
          Returns the last arc item created.
 Point location()
          Returns this arc item's location, namely its center point.
 void readExternal(ObjectInput in)
          Read this arc item from the given object input stream.
 void writeExternal(ObjectOutput out)
          Write this arc item to the given object output stream.
 
Methods inherited from class edu.rit.slides.items.OutlinedItem
setDefaultOutline
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArcItem

public ArcItem()
Construct a new empty arc item.


ArcItem

public ArcItem(Point center,
               double radius,
               double start,
               double extent)
Construct a new arc item. The default outline is used.

Parameters:
center - Center point.
radius - Radius.
start - Starting angle in radians. (0 degrees is the positive X axis; angles increase clockwise.)
extent - Angular extent in radians. (Angles increase clockwise.)
Throws:
NullPointerException - (unchecked exception) Thrown if center is null. Thrown if the default outline is Outline.NONE (null).
IllegalArgumentException - (unchecked exception) Thrown if radius <= 0.

ArcItem

public ArcItem(Point center,
               double radius,
               double start,
               double extent,
               Outline theOutline)
Construct a new arc item with the given outline.

Parameters:
center - Center point.
radius - Radius.
start - Starting angle in radians. (0 degrees is the positive X axis; angles increase clockwise.)
extent - Angular extent in radians. (Angles increase clockwise.)
theOutline - Outline.
Throws:
NullPointerException - (unchecked exception) Thrown if center is null. Thrown if theOutline is Outline.NONE (null).
IllegalArgumentException - (unchecked exception) Thrown if radius <= 0.
Method Detail

last

public static ArcItem last()
Returns the last arc item created. If no arc items have been created yet, null is returned.


location

public Point location()
Returns this arc item's location, namely its center point.


draw

public void draw(Graphics2D g2d)
Draw this arc item in the given graphics context. This method is allowed to change the graphics context's paint, stroke, and transform, and it doesn't have to change them back.

Specified by:
draw in class SlideItem
Parameters:
g2d - 2-D graphics context.

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Write this arc item to the given object output stream.

Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class OutlinedItem
Parameters:
out - Object output stream.
Throws:
IOException - Thrown if an I/O error occurred.

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Read this arc item from the given object input stream.

Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class OutlinedItem
Parameters:
in - Object input stream.
Throws:
IOException - Thrown if an I/O error occurred.
ClassNotFoundException - Thrown if any class needed to deserialize this outlined item cannot be found.


Copyright © 2001-2006 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.