objectdraw
Class FramedArc

java.lang.Object
  extended byobjectdraw.Drawable
      extended byobjectdraw.Drawable2D
          extended byobjectdraw.Resizable2D
              extended byobjectdraw.Rectangular
                  extended byobjectdraw.Arc
                      extended byobjectdraw.FramedArc
All Implemented Interfaces:
Drawable2DInterface, DrawableInterface, Resizable2DInterface, java.io.Serializable

public class FramedArc
extends objectdraw.Arc
implements Resizable2DInterface

FramedArc is an implementation of a drawable framed arc object. Only the arc itself is drawn. There are no lines connecting the ends of the arc to the center of the bounding rectangle.

Version:
1.1.2 released July 2006
See Also:
Serialized Form

Constructor Summary
FramedArc(double x, double y, double width, double height, double startAngle, double arcAngle, DrawingCanvas canvas)
          Creates a new FramedArc object.
FramedArc(Location origin, double width, double height, double startAngle, double arcAngle, DrawingCanvas canvas)
          Creates a new FramedArc object.
FramedArc(Location p0, Location p1, double startAngle, double arcAngle, DrawingCanvas canvas)
          Creates a new FramedArc object.
 
Method Summary
 void addToCanvas(DrawingCanvas c)
          Places an existing object on a specified DrawingCanvas.
 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
 DrawingCanvas getCanvas()
          Determine which (if any) DrawingCanvas this object is positioned on
 java.awt.Color getColor()
          Retrieves the color of the object.
 double getHeight()
          Get the height of a graphical object
 Location getLocation()
          Get a graphical object's position
 double getStartAngle()
          Determine the starting angle for an arc
 double getWidth()
          Get the width of a graphical object
 double getX()
          Get the x coordinate of left edge of rectangle bounding the object
 double getY()
          Get the y coordinate of top edge of rectangle bounding the object
 void hide()
          Temporarily hides an object on a DrawingCanvas from view.
 boolean isHidden()
          Determine whether an object is currently visible on its canvas
 void move(double dx, double dy)
          Moves the object within the canvas in the x and y direction by the amounts specified as parameters.
 void moveTo(double x, double y)
          Moves the object within the canvas to the x and y coordinates provided.
 void moveTo(Location point)
          Moves the object within the canvas to the specified Location
 boolean overlaps(Drawable2DInterface item)
          Determines if another Drawable's bounding rectangle overlaps with this object's bounding rectangle.
 void removeFromCanvas()
          Permanently removes the object from the canvas it is currently on.
 void sendBackward()
          Sends the object backward.
 void sendForward()
          Sends the object forward.
 void sendToBack()
          Sends the object to the back.
 void sendToFront()
          Sends the object to the front.
 void setArcAngle(double arcAngle)
          Change the angle spanned by this arc
 void setColor(java.awt.Color c)
          Sets the color of the object.
 void setHeight(double height)
          Sets the height of the object's bounding rectangle
 void setSize(double width, double height)
          Sets the width and height of the rectangle bounding the object.
 void setStartAngle(double startAngle)
          Change the starting position for this arc
 void setWidth(double width)
          Sets the width of the object's bounding rectangle
 void show()
          Shows the object if it has been hidden.
 java.lang.String toString()
          Generates a string representation of the object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface objectdraw.Resizable2DInterface
setHeight, setSize, setWidth
 
Methods inherited from interface objectdraw.Drawable2DInterface
getHeight, getLocation, getWidth, getX, getY, overlaps
 
Methods inherited from interface objectdraw.DrawableInterface
addToCanvas, contains, getCanvas, getColor, hide, isHidden, move, moveTo, moveTo, removeFromCanvas, sendBackward, sendForward, sendToBack, sendToFront, setColor, show
 

Constructor Detail

FramedArc

public FramedArc(Location origin,
                 double width,
                 double height,
                 double startAngle,
                 double arcAngle,
                 DrawingCanvas canvas)
Creates a new FramedArc object.

Parameters:
origin - 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 total angle of the arc.
canvas - the canvas in which the object is created.

FramedArc

public FramedArc(double x,
                 double y,
                 double width,
                 double height,
                 double startAngle,
                 double arcAngle,
                 DrawingCanvas canvas)
Creates a new FramedArc 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 total angle of the arc.
canvas - the canvas in which the object is created.

FramedArc

public FramedArc(Location p0,
                 Location p1,
                 double startAngle,
                 double arcAngle,
                 DrawingCanvas canvas)
Creates a new FramedArc object.

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

toString

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

Returns:
a string representation of the object.

getStartAngle

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

Returns:
starting angle of this arc.

getArcAngle

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

Returns:
arc angle of this arc.

setStartAngle

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

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

setArcAngle

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

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

contains

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


setSize

public void setSize(double width,
                    double height)
Description copied from interface: Resizable2DInterface
Sets the width and height of the rectangle bounding the object.

Specified by:
setSize in interface Resizable2DInterface

setWidth

public void setWidth(double width)
Description copied from interface: Resizable2DInterface
Sets the width of the object's bounding rectangle

Specified by:
setWidth in interface Resizable2DInterface

setHeight

public void setHeight(double height)
Description copied from interface: Resizable2DInterface
Sets the height of the object's bounding rectangle

Specified by:
setHeight in interface Resizable2DInterface

getWidth

public double getWidth()
Description copied from interface: Drawable2DInterface
Get the width of a graphical object

Specified by:
getWidth in interface Drawable2DInterface

getHeight

public double getHeight()
Description copied from interface: Drawable2DInterface
Get the height of a graphical object

Specified by:
getHeight in interface Drawable2DInterface

moveTo

public void moveTo(Location point)
Description copied from interface: DrawableInterface
Moves the object within the canvas to the specified Location


move

public void move(double dx,
                 double dy)
Description copied from interface: DrawableInterface
Moves the object within the canvas in the x and y direction by the amounts specified as parameters.


getX

public double getX()
Description copied from interface: Drawable2DInterface
Get the x coordinate of left edge of rectangle bounding the object

Specified by:
getX in interface Drawable2DInterface
Returns:
the x coordinate of the upper left corner of the object's bounding rectangle

getY

public double getY()
Description copied from interface: Drawable2DInterface
Get the y coordinate of top edge of rectangle bounding the object

Specified by:
getY in interface Drawable2DInterface
Returns:
the y coordinate of the upper left corner of the object's bounding rectangle

getLocation

public Location getLocation()
Description copied from interface: Drawable2DInterface
Get a graphical object's position

Specified by:
getLocation in interface Drawable2DInterface
Returns:
the location of the upper left corner of the object's bounding rectangle

overlaps

public boolean overlaps(Drawable2DInterface item)
Description copied from interface: Drawable2DInterface
Determines if another Drawable's bounding rectangle overlaps with this object's bounding rectangle.

Specified by:
overlaps in interface Drawable2DInterface
Parameters:
item - the other object
Returns:
true if item intersects this object; false otherwise.

addToCanvas

public void addToCanvas(DrawingCanvas c)
Description copied from interface: DrawableInterface
Places an existing object on a specified DrawingCanvas. This method will fail if the object is already on a canvas. Therefore, to move an object from one canvas to another one must use removeFromCanvas() followed by addToCanvas. This method can also be invoked to place a Drawable object on a DrawingCanvas after the object is loaded from a file or other stream.

Specified by:
addToCanvas in interface DrawableInterface
Parameters:
c - the canvas on which the object should be drawn

removeFromCanvas

public void removeFromCanvas()
Description copied from interface: DrawableInterface
Permanently removes the object from the canvas it is currently on. If you want to just make an object temporarily invisible, use hide() instead.

Specified by:
removeFromCanvas in interface DrawableInterface

getCanvas

public DrawingCanvas getCanvas()
Description copied from interface: DrawableInterface
Determine which (if any) DrawingCanvas this object is positioned on

Specified by:
getCanvas in interface DrawableInterface
Returns:
the DrawingCanvas holding this object or null if it the object is not currently associated with any canvas

hide

public void hide()
Description copied from interface: DrawableInterface
Temporarily hides an object on a DrawingCanvas from view. This method should only be used if the object may later be made visible again using the show() method. If the goal is to remove an object from the display permanently, the removeFromCanvas() method should be used instead.

Specified by:
hide in interface DrawableInterface

show

public void show()
Description copied from interface: DrawableInterface
Shows the object if it has been hidden.

Specified by:
show in interface DrawableInterface

isHidden

public boolean isHidden()
Description copied from interface: DrawableInterface
Determine whether an object is currently visible on its canvas

Specified by:
isHidden in interface DrawableInterface
Returns:
true if the object is currently hidden.

moveTo

public void moveTo(double x,
                   double y)
Description copied from interface: DrawableInterface
Moves the object within the canvas to the x and y coordinates provided.

Specified by:
moveTo in interface DrawableInterface
Parameters:
x - horizontal coordinate of destination.
y - horizontal coordinate of destination.

setColor

public void setColor(java.awt.Color c)
Description copied from interface: DrawableInterface
Sets the color of the object.

Specified by:
setColor in interface DrawableInterface
Parameters:
c - the color.

getColor

public java.awt.Color getColor()
Description copied from interface: DrawableInterface
Retrieves the color of the object.

Specified by:
getColor in interface DrawableInterface
Returns:
the object's color.

sendForward

public void sendForward()
Description copied from interface: DrawableInterface
Sends the object forward.

Specified by:
sendForward in interface DrawableInterface

sendBackward

public void sendBackward()
Description copied from interface: DrawableInterface
Sends the object backward.

Specified by:
sendBackward in interface DrawableInterface

sendToFront

public void sendToFront()
Description copied from interface: DrawableInterface
Sends the object to the front.

Specified by:
sendToFront in interface DrawableInterface

sendToBack

public void sendToBack()
Description copied from interface: DrawableInterface
Sends the object to the back.

Specified by:
sendToBack in interface DrawableInterface