objectdraw
Class AngLine

java.lang.Object
  extended by objectdraw.Line
      extended by objectdraw.AngLine
All Implemented Interfaces:
java.io.Serializable, Drawable1DInterface, DrawableInterface

public class AngLine
extends Line

AngLine is a variant of Line where the constructor takes a starting point and angle from the horizontal rather than two end points.

Version:
1.1.1 released February 2005
Author:
Kim Bruce
See Also:
Serialized Form

Constructor Summary
AngLine(double startX, double startY, double length, double radianAngle, DrawingCanvas canvas)
          Creates a new Line given a starting location, length and direction.
AngLine(Location start, double length, double radianAngle, DrawingCanvas canvas)
          Creates a new Line given a starting location, length and direction.
 
Method Summary
 void addToCanvas(DrawingCanvas c)
          Places an existing object on a specified DrawingCanvas.
 DrawingCanvas getCanvas()
          Determine which (if any) DrawingCanvas this object is positioned on
 java.awt.Color getColor()
          Retrieves the color of 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 moveTo(Location point)
          Moves the object within the canvas to the specified Location
 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 setColor(java.awt.Color c)
          Sets the color of the object.
 void show()
          Shows the object if it has been hidden.
 
Methods inherited from class objectdraw.Line
contains, getEnd, getStart, move, moveTo, setEnd, setEnd, setEndPoints, setEndPoints, setStart, setStart, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface objectdraw.DrawableInterface
addToCanvas, getCanvas, getColor, hide, isHidden, moveTo, removeFromCanvas, sendBackward, sendForward, sendToBack, sendToFront, setColor, show
 

Constructor Detail

AngLine

public AngLine(Location start,
               double length,
               double radianAngle,
               DrawingCanvas canvas)
Creates a new Line given a starting location, length and direction.

Parameters:
start - the starting point of the line.
length - the length of the line.
radianAngle - the angle the line makes with the horizontal
canvas - the canvas in which the line is created.

AngLine

public AngLine(double startX,
               double startY,
               double length,
               double radianAngle,
               DrawingCanvas canvas)
Creates a new Line given a starting location, length and direction.

Parameters:
startX - the x coordinate of the starting point of the line.
startY - the y coordinate of the starting point of the line.
length - the length of the line.
radianAngle - the angle the line makes with the horizontal
canvas - the canvas in which the line is created.
Method Detail

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(Location point)
Description copied from interface: DrawableInterface
Moves the object within the canvas to the specified Location

Specified by:
moveTo in interface DrawableInterface
Parameters:
point - the destination for moving the object.

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