|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--jdraw.graphics.GraphicObject
Class GraphicObject is the abstract class whose extensions are used to build the Graphics List. Each node contains a Shape object and all the relevant properties of that shape.
| Field Summary | |
protected int |
arrowsOn
A boolean to indicate whether arrows are to be drawn. |
protected java.awt.Color |
backgroundColor
A Color object which holds the background color of this.shape. |
protected java.awt.Color |
color
A Color object which holds the color of this.shape. |
protected java.util.Vector |
controlPoints
A Vector holding all of the control Points of this.shape. |
protected int |
graphicType
An int to indicate which type of graphic shape is. |
protected java.util.Vector |
paint
An int representing the paint used to fill this.shape. |
protected java.awt.Shape |
shape
A Shape object holds the Shape object of this Graphic. |
protected java.awt.BasicStroke |
stroke
A BasicStroke object used to draw this.shape. |
| Constructor Summary | |
GraphicObject(java.awt.Color c,
java.awt.Color bgc,
java.util.Vector paint,
java.util.Vector cPoints,
java.awt.BasicStroke bs)
Construct this with the given Shape, Color, FillStyle, and ControlPoints objects. |
|
| Method Summary | |
void |
addPoint(java.awt.Point p)
Method addPoint is overwritten in PolygonObject, PolylineObject, CurveObject, and CurvedShapeObject. |
java.lang.Object |
clone()
Method clone() is overwritten by each individual ShapeObject class. |
boolean |
containedIn(java.awt.Polygon selectionBounds)
Returns a boolean value representing whether this.shape resides within given Polygon. |
java.awt.geom.GeneralPath |
deriveImage(float zoom)
Method deriveImage creates the GeneralPath object which will represent this shape on screen, given the passed in zoom factor. |
void |
draw(java.awt.Graphics2D g2D,
float zoom)
Draws this.shape on the given Graphics2D object. |
void |
flipHorizontally()
Flips this.shape horizontally. |
void |
flipVertically()
Flips this.shape vertically. |
java.awt.Color |
getBackgroundColor()
|
java.awt.Color |
getColor()
|
java.util.Vector |
getControlPoints()
|
int |
getGraphicType()
|
int |
getMaxX()
|
int |
getMaxY()
|
int |
getMinX()
|
int |
getMinY()
|
java.util.Vector |
getSaveBundle()
Returns a saveBundle (Vector) derived from the information contained in this. |
java.awt.Shape |
getShape()
|
java.awt.BasicStroke |
getStroke()
|
int |
getTouchedControlPoint(java.awt.Point clickedPoint)
Returns the index of the last Point in Vector controlPoints which is close enough to Point clickedPoint to be considered "clicked". |
boolean |
isPointOnShape(java.awt.Point clickedPoint)
Returns a boolean value representing whether the given Point resides on this.shape. |
void |
rotate(double theta,
double anchorX,
double anchorY)
Rotates this.shape around point (anchorX, anchorY) by theta radians. |
void |
setArrows(int arrows)
Empty method which is overwritten in Line, Polyline, and Curve. |
void |
setBackgroundColor(java.awt.Color c)
|
void |
setColor(java.awt.Color c)
|
void |
setControlPoints()
Empty methods which are overwritten if needed. |
void |
setHorizontalCenter(float newCenterX)
Translates this.shape by the X-coordinate given by newCenterX - CenterOfThisX. |
void |
setLastPoint(java.awt.Point p)
Method setLastPoint is overwritten in PolygonObject, PolylineObject, CurveObject, and CurvedShapeObject. |
void |
setMaxX(int newMaxX)
|
void |
setMaxY(int newMaxY)
|
void |
setMinX(int newMinX)
|
void |
setMinY(int newMinY)
|
void |
setPaint(java.util.Vector p)
|
void |
setSecondPoint(java.awt.Point p)
Method setSecondPoint is overwritten in EllipseObject, RectangleObject, and LineObject. |
void |
setShape()
Empty methods which are overwritten if needed. |
void |
setStroke(java.awt.BasicStroke bs)
|
void |
setVerticalCenter(float newCenterY)
Translates this.shape by the Y-coordinate given by newCenterY - CenterOfThisY. |
void |
translate(float deltaX,
float deltaY)
Translates the position of this.shape by the given deltaX and deltaY values. |
void |
translateControlPoint(int controlPointIndex,
float deltaX,
float deltaY)
Translates the Control Point (in Vector controlPoints) whose index is passed in by the passed in values of deltaX and deltaY. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.awt.Shape shape
protected java.awt.Color color
protected java.awt.Color backgroundColor
protected java.util.Vector controlPoints
protected java.util.Vector paint
protected java.awt.BasicStroke stroke
protected int graphicType
protected int arrowsOn
| Constructor Detail |
public GraphicObject(java.awt.Color c,
java.awt.Color bgc,
java.util.Vector paint,
java.util.Vector cPoints,
java.awt.BasicStroke bs)
c - - The Color object to store in this.color.bgc - - The Color object to store in this.backgroundColor.paint - - The Vector object with the paint properties.cPoints - - Vector object to store in this.controlPoints.bs - - The BasicStroke object used to draw the shape to the screen.| Method Detail |
public int getTouchedControlPoint(java.awt.Point clickedPoint)
clickedPoint - - The Point object representing the position of a mouse click.public java.awt.geom.GeneralPath deriveImage(float zoom)
zoom - - The float value indicating the current zoom factor.
public void translateControlPoint(int controlPointIndex,
float deltaX,
float deltaY)
controlPointIndex - - The int value representing the index of the relevant
Point in controlPoints.deltaX - - The int value to be translated in the X direction.deltaY - - The int value to be translated in the Y direction.public boolean isPointOnShape(java.awt.Point clickedPoint)
clickedPoint - - The Point object represent the position of a mouse click.public boolean containedIn(java.awt.Polygon selectionBounds)
selectionBounds - - The Polygon which defines the bounds of selection.
public void translate(float deltaX,
float deltaY)
deltaX - - The int value by which to alter the X position of this.shape.deltaY - - The int value by which to alter the Y position of this.shape.
public void draw(java.awt.Graphics2D g2D,
float zoom)
g2D - - The Graphics2D object on which to draw this.shape.zoom - - The float value indicating the current zoom factor.public int getMinX()
public int getMinY()
public int getMaxX()
public int getMaxY()
public void setMinX(int newMinX)
newMinX - - The int value to be set as the left side of the Rectangle
which bounds this.shape.public void setMinY(int newMinY)
newMinY - - The int value to be set as the top side of the Rectangle
which bounds this.shape.public void setMaxX(int newMaxX)
newMaxX - - The int value to be set as the right side of the Rectangle
which bounds this.shape.public void setMaxY(int newMaxY)
newMaxY - - The int value to be set as the bottom side of the Rectangle
which bounds this.shape.public void setVerticalCenter(float newCenterY)
newCenterY - - The float value from which to determine deltaY.public void setHorizontalCenter(float newCenterX)
newCenterX - - The float value from which to determine deltaX.
public void rotate(double theta,
double anchorX,
double anchorY)
theta - - A double value representing an angle in radians.anchorX - - A double value representing the x-coordinate of the anchor point.anchorY - - A double value representing the y-coordinate of the anchor point.public void flipHorizontally()
public void flipVertically()
public java.util.Vector getSaveBundle()
public void setColor(java.awt.Color c)
c - - The Color object to store in this.color.public void setBackgroundColor(java.awt.Color c)
c - - The Color object to store in this.backgroundColor.public void setPaint(java.util.Vector p)
p - - The Vector object to store in this.paintType.public java.awt.Color getBackgroundColor()
public void setStroke(java.awt.BasicStroke bs)
bs - - The BasicStroke object to store in this.stroke.public java.awt.BasicStroke getStroke()
public java.awt.Shape getShape()
public java.awt.Color getColor()
public java.util.Vector getControlPoints()
public int getGraphicType()
public void setLastPoint(java.awt.Point p)
public void addPoint(java.awt.Point p)
public void setSecondPoint(java.awt.Point p)
public java.lang.Object clone()
clone in class java.lang.Objectpublic void setControlPoints()
public void setShape()
public void setArrows(int arrows)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||