objectdraw
Class Arc

java.lang.Object
  extended by objectdraw.Drawable
      extended by objectdraw.Drawable2D
          extended by objectdraw.Resizable2D
              extended by objectdraw.Rectangular
                  extended by objectdraw.Arc
All Implemented Interfaces:
Serializable, Drawable2DInterface, DrawableInterface, Resizable2DInterface
Direct Known Subclasses:
FilledArc, FramedArc

abstract class Arc
extends Rectangular

Arc is an abstract class to be used as a superclass of FilledArc and FramedArc.

Version:
1.1.1 released February 2005

Field Summary
protected  double arcAngle
           
protected  double startAngle
           
 
Fields inherited from class objectdraw.Rectangular
height, width, x, y
 
Fields inherited from class objectdraw.Drawable
canvasContent, color, shown
 
Constructor Summary
Arc(double x, double y, double width, double height, double startAngle, double arcAngle, DrawingCanvas c)
          Creates a new FilledArc object.
Arc(Location origin, double width, double height, double startAngle, double arcAngle, DrawingCanvas c)
           
Arc(Location p0, Location p1, double startAngle, double arcAngle, DrawingCanvas c)
          Creates a new FilledArc object.
 
Method Summary
 boolean contains(Location point)
          Determines if a particular position on the DrawingCanvas is contained within the object.
 double getArcAngle()
          Determine the angle spanned by this arc
 double getStartAngle()
          Determine the starting angle for an arc
 void setArcAngle(double arcAngle)
          Change the angle spanned by this arc
 void setStartAngle(double startAngle)
          Change the starting position for this arc
 String toString()
          Generates a string representation of the object.
 
Methods inherited from class objectdraw.Rectangular
getBounds, getHeight, getWidth, setBounds, setHeight, setSize, setWidth
 
Methods inherited from class objectdraw.Resizable2D
move, moveTo
 
Methods inherited from class objectdraw.Drawable2D
draw, getLocation, getX, getY, overlaps
 
Methods inherited from class objectdraw.Drawable
addToCanvas, clearCanvasContent, getCanvas, getColor, hide, isHidden, moveTo, removeFromCanvas, sendBackward, sendForward, sendToBack, sendToFront, setCanvasContent, setColor, setStateChanged, show
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface objectdraw.Drawable2DInterface
getLocation, getX, getY, overlaps
 
Methods inherited from interface objectdraw.DrawableInterface
addToCanvas, getCanvas, getColor, hide, isHidden, move, moveTo, moveTo, removeFromCanvas, sendBackward, sendForward, sendToBack, sendToFront, setColor, show
 

Field Detail

arcAngle

protected double arcAngle

startAngle

protected double startAngle
Constructor Detail

Arc

public Arc(double x,
           double y,
           double width,
           double height,
           double startAngle,
           double arcAngle,
           DrawingCanvas c)
Creates a new FilledArc object.

Parameters:
x - coordinate of the upper left corner of the bounding rectangle.
y - coordinate of the upper left corner of the bounding rectangle.
width - the width of the bounding rectangle.
height - the height of the bounding rectangle.
startAngle - the starting angle of the arc.
arcAngle - the ending angle of the arc.
c - the canvas in which the object is created.

Arc

public Arc(Location origin,
           double width,
           double height,
           double startAngle,
           double arcAngle,
           DrawingCanvas c)

Arc

public Arc(Location p0,
           Location p1,
           double startAngle,
           double arcAngle,
           DrawingCanvas c)
Creates a new FilledArc object.

Parameters:
p0 - endpoint of a diagonal of the rectangle
p1 - other diagonal endpoint
startAngle - the starting angle of the arc.
arcAngle - the ending angle of the arc.
c - the canvas in which the object is created
Method Detail

contains

public boolean contains(Location point)
Description copied from interface: DrawableInterface
Determines if a particular position on the DrawingCanvas is contained within the object.

Specified by:
contains in interface DrawableInterface
Overrides:
contains in class Drawable2D
Parameters:
point - the position on the canvas.
Returns:
true if point is contained in the object, false otherwise.

getArcAngle

public double getArcAngle()
Determine the angle spanned by this arc

Returns:
arc angle of this arc.

getStartAngle

public double getStartAngle()
Determine the starting angle for an arc

Returns:
starting angle of this arc.

setArcAngle

public void setArcAngle(double arcAngle)
Change the angle spanned by this arc

Parameters:
arcAngle - - new total angle for this arc.

setStartAngle

public void setStartAngle(double startAngle)
Change the starting position for this arc

Parameters:
startAngle - - new starting angle for this arc.

toString

public String toString()
Generates a string representation of the object.

Overrides:
toString in class Object
Returns:
a string representation of the object.