|
||||||||||
| 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.Bow
public class Bow
Class Bow provides a DrawingItem that joins two points with a curved (bowed) line. The curve is specified by a "curve factor." If the curve factor is positive, the line curves to the right when going from the starting point to the ending point. If the curve factor is negative, the line curves to the left. The larger the magnitude of the curve factor, the farther the line curves. (The curve factor is the tangent of the angle at which the line leaves the starting point and approaches the ending point.) The line may have an Arrow at either or both ends. The line has an outline but no filled interior.
The static defaultCurve(), defaultStartArrow(), and defaultEndArrow() methods are provided to set the default curve factor, starting arrow, and ending arrow. If the curve factor, starting arrow, or ending arrow is not specified, the current default curve factor, starting arrow, or ending arrow is used.
| Field Summary | |
|---|---|
static double |
NORMAL_CURVE
The normal curve factor (0.5). |
static Arrow |
NORMAL_END_ARROW
The normal ending arrow: None. |
static Arrow |
NORMAL_START_ARROW
The normal starting arrow: None. |
| Fields inherited from class edu.rit.draw.item.OutlinedItem |
|---|
NORMAL_OUTLINE |
| Constructor Summary | |
|---|---|
Bow()
Construct a new bowed line. |
|
Bow(Bow theBow)
Construct a bowed line with the same points, outline, starting arrow, ending arrow, and curve factor as the given line. |
|
| Method Summary | |
|---|---|
Bow |
add()
Add this bowed line to the end of the default drawing's sequence of drawing items. |
Bow |
add(Drawing theDrawing)
Add this bowed line to the end of the given drawing's sequence of drawing items. |
Bow |
addFirst()
Add this bowed line to the beginning of the default drawing's sequence of drawing items. |
Bow |
addFirst(Drawing theDrawing)
Add this bowed line to the beginning of the given drawing's sequence of drawing items. |
double |
curve()
Returns this bowed line's curve factor. |
Bow |
curve(double theCurve)
Set this bowed line's curve factor. |
static double |
defaultCurve()
Returns the default curve factor. |
static void |
defaultCurve(double theCurve)
Set the default curve factor. |
static Arrow |
defaultEndArrow()
Returns the default ending arrow. |
static void |
defaultEndArrow(Arrow theArrow)
Set the default ending arrow. |
static Arrow |
defaultStartArrow()
Returns the default starting arrow. |
static void |
defaultStartArrow(Arrow theArrow)
Set the default starting arrow. |
void |
draw(Graphics2D g2d)
Draw this drawing item in the given graphics context. |
Point |
end()
Returns this bowed line's ending point. |
Bow |
end(double x,
double y)
Set this bowed line's ending point. |
Bow |
end(Point thePoint)
Set this bowed line's ending point. |
Arrow |
endArrow()
Returns this bowed line's ending arrow. |
Bow |
endArrow(Arrow theArrow)
Set this bowed line's ending arrow. |
Bow |
flip()
Flip this bowed line from curving right to curving left or vice versa. |
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. |
Bow |
outline(Outline theOutline)
Set this bowed line's outline. |
void |
readExternal(ObjectInput in)
Read this bowed line from the given object input stream. |
Size |
size()
Returns the size of this drawing item's bounding box. |
Point |
start()
Returns this bowed line's starting point. |
Bow |
start(double x,
double y)
Set this bowed line's starting point. |
Bow |
start(Point thePoint)
Set this bowed line's starting point. |
Arrow |
startArrow()
Returns this bowed line's starting arrow. |
Bow |
startArrow(Arrow theArrow)
Set this bowed line's starting arrow. |
double |
width()
Returns the width of this drawing item's bounding box. |
void |
writeExternal(ObjectOutput out)
Write this bowed line 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 Arrow NORMAL_START_ARROW
public static final Arrow NORMAL_END_ARROW
public static final double NORMAL_CURVE
| Constructor Detail |
|---|
public Bow()
public Bow(Bow theBow)
theBow - Bowed line.
NullPointerException - (unchecked exception) Thrown if theBow is null.| Method Detail |
|---|
public static Arrow defaultStartArrow()
public static void defaultStartArrow(Arrow theArrow)
theArrow - Default starting arrow.
NullPointerException - (unchecked exception) Thrown if theArrow is null.public static Arrow defaultEndArrow()
public static void defaultEndArrow(Arrow theArrow)
theArrow - Default ending arrow.
NullPointerException - (unchecked exception) Thrown if theArrow is null.public static double defaultCurve()
public static void defaultCurve(double theCurve)
theCurve - Default curve factor.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 Bow outline(Outline theOutline)
outline in class OutlinedItemtheOutline - Outline, or Outline.NONE.
public Point start()
public Bow start(double x,
double y)
x - Starting point X coordinate.y - Starting point Y coordinate.
public Bow start(Point thePoint)
thePoint - Starting point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.public Point end()
public Bow end(double x,
double y)
x - Ending point X coordinate.y - Ending point Y coordinate.
public Bow end(Point thePoint)
thePoint - Ending point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.public Arrow startArrow()
public Bow startArrow(Arrow theArrow)
theArrow - Starting arrow.
NullPointerException - (unchecked exception) Thrown if theArrow is null.public Arrow endArrow()
public Bow endArrow(Arrow theArrow)
theArrow - Ending arrow.
NullPointerException - (unchecked exception) Thrown if theArrow is null.public double curve()
public Bow curve(double theCurve)
theCurve - Curve factor.
public Bow flip()
public Bow add()
add in class OutlinedItemNullPointerException - (unchecked exception) Thrown if there is no default drawing.Drawing.defaultDrawing()public Bow add(Drawing theDrawing)
add in class OutlinedItemtheDrawing - Drawing.
NullPointerException - (unchecked exception) Thrown if theDrawing is null.public Bow addFirst()
addFirst in class OutlinedItemNullPointerException - (unchecked exception) Thrown if there is no default drawing.Drawing.defaultDrawing()public Bow 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 | |||||||||