jdraw.graphics
Class PolylineObject

java.lang.Object
  |
  +--jdraw.graphics.GraphicObject
        |
        +--jdraw.graphics.PolylineObject
All Implemented Interfaces:
java.io.Serializable

public class PolylineObject
extends GraphicObject

Class PolylineObject is the GraphicObject extension which holds a multi-line shape.

See Also:
Serialized Form

Fields inherited from class jdraw.graphics.GraphicObject
arrowsOn, backgroundColor, color, controlPoints, graphicType, paint, shape, stroke
 
Constructor Summary
PolylineObject(java.awt.Color c, java.awt.Color bgc, java.util.Vector p, java.util.Vector cPoints, java.awt.BasicStroke bs, int arrows)
          Construct this with the given Colors, FillStyle, and ControlPoints objects.
PolylineObject(java.awt.Point pt1, java.awt.Color c, java.awt.Color bgc, java.util.Vector p, java.awt.BasicStroke bs, int arrows)
          Construct this with the given Point, Colors, FillStyle, and ControlPoints objects.
 
Method Summary
 void addPoint(java.awt.Point clickedPoint)
          Adds the passed in Point object to the points in this.shape.
 java.lang.Object clone()
          returns - A copy of this.
 void draw(java.awt.Graphics2D g2D, float zoom)
          Draws this.shape on the given Graphics2D object.
 java.util.Vector getSaveBundle()
          Returns a saveBundle (Vector) derived from the information contained in this.
 boolean isPointOnShape(java.awt.Point clickedPoint)
          Returns a boolean value representing whether the given Point resides on this.shape.
 void setArrows(int arrows)
          Empty method which is overwritten in Line, Polyline, and Curve.
 void setControlPoints()
          Sets this.controlPoints based on the current PathIterator of this.shape.
 void setLastPoint(java.awt.Point dragPoint)
          Method setLastPoint is overwritten in PolygonObject, PolylineObject, CurveObject, and CurvedShapeObject.
 void setShape()
          Sets this.shape based on the points currently in this.controlPoints.
 
Methods inherited from class jdraw.graphics.GraphicObject
containedIn, deriveImage, flipHorizontally, flipVertically, getBackgroundColor, getColor, getControlPoints, getGraphicType, getMaxX, getMaxY, getMinX, getMinY, getShape, getStroke, getTouchedControlPoint, rotate, setBackgroundColor, setColor, setHorizontalCenter, setMaxX, setMaxY, setMinX, setMinY, setPaint, setSecondPoint, setStroke, setVerticalCenter, translate, translateControlPoint
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolylineObject

public PolylineObject(java.awt.Color c,
                      java.awt.Color bgc,
                      java.util.Vector p,
                      java.util.Vector cPoints,
                      java.awt.BasicStroke bs,
                      int arrows)
Construct this with the given Colors, FillStyle, and ControlPoints objects.
Parameters:
c - - The Color object to store in this.color.
bgc - - The Color object to store in this.backgroundColor.
p - - The Vector to store in this.paint.
cPoints - - Vector object to store in this.controlPoints.
bs - - The BasicStroke object to store in this.stroke.
arrows - - The int value indicating which (if any) arrow heads to draw.

PolylineObject

public PolylineObject(java.awt.Point pt1,
                      java.awt.Color c,
                      java.awt.Color bgc,
                      java.util.Vector p,
                      java.awt.BasicStroke bs,
                      int arrows)
Construct this with the given Point, Colors, FillStyle, and ControlPoints objects.
Parameters:
pt1 - - The Point object at which to start the GeneralPath.
c - - The Color object to store in this.color.
bgc - - The Color object to store in this.backgroundColor.
p - - The Vector to store in this.paint.
bs - - The BasicStroke object to store in this.stroke.
arrows - - The int value indicating which (if any) arrow heads to draw.
Method Detail

clone

public java.lang.Object clone()
returns - A copy of this.
Overrides:
clone in class GraphicObject

setLastPoint

public void setLastPoint(java.awt.Point dragPoint)
Description copied from class: GraphicObject
Method setLastPoint is overwritten in PolygonObject, PolylineObject, CurveObject, and CurvedShapeObject.
Overrides:
setLastPoint in class GraphicObject
Parameters:
dragPoint - - The Point object to store as the last of this.shape.

addPoint

public void addPoint(java.awt.Point clickedPoint)
Adds the passed in Point object to the points in this.shape.
Overrides:
addPoint in class GraphicObject
Parameters:
clickedPoint - - The Point object to add to this.shape.

isPointOnShape

public boolean isPointOnShape(java.awt.Point clickedPoint)
Returns a boolean value representing whether the given Point resides on this.shape.
Overrides:
isPointOnShape in class GraphicObject
Parameters:
clickedPoint - - The Point object represent the position of a mouse click.
Returns:
- The boolean value described above.

draw

public void draw(java.awt.Graphics2D g2D,
                 float zoom)
Draws this.shape on the given Graphics2D object.
Overrides:
draw in class GraphicObject
Parameters:
g2D - - The Graphics2D object on which to draw this.shape.

setShape

public void setShape()
Sets this.shape based on the points currently in this.controlPoints.
Overrides:
setShape in class GraphicObject

setControlPoints

public void setControlPoints()
Sets this.controlPoints based on the current PathIterator of this.shape.
Overrides:
setControlPoints in class GraphicObject

getSaveBundle

public java.util.Vector getSaveBundle()
Returns a saveBundle (Vector) derived from the information contained in this.
Overrides:
getSaveBundle in class GraphicObject

setArrows

public void setArrows(int arrows)
Description copied from class: GraphicObject
Empty method which is overwritten in Line, Polyline, and Curve.
Overrides:
setArrows in class GraphicObject
Parameters:
arrows - - The int value to be copied to this.arrowsOn.