|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--DrawPadDoc
CLASS: DrawPadDoc
PURPOSE: This class keep track of all the shapes and provide methods to
manipulate them
IMPORT: java.awt.Graphics, java.util.Vector, java.awt.Color, DrawableShape,
Point
EXPORT: New Class|DrawPadDoc
New Method|DrawPadDoc, addShape,
copySelectedShape, deleteSelectedShape, drawAllShapes,
getSelectedShapeColor, moveSelectedPointBox, moveSelectedShapeToBack,
moveSelectedShapeToFront, moveShape, pasteShape, selectNextShape,
selectPointBox, selectedPreviousShape, selectShape,
setSelectedShapeColor, setShapeEndPoint, unSelectShape
Field Summary | |
private boolean |
bSelectedPointBox
A flag to indicate if we have selected a point box in the selected shape |
private DrawableShape |
copyShape
A copied of a shape |
private DrawableShape |
selectedShape
The shape that is being selected |
private java.util.Vector |
shapeList
A vector list containing shapes |
Constructor Summary | |
DrawPadDoc()
PRE: None POST: Construct and initialize the DrawPadDoc Object |
Method Summary | |
void |
addShape(DrawableShape shape)
PRE: A valid DrawableShape object POST: Add a shape to the list |
void |
copySelectedShape()
PRE: NoneBR> POST: If an shape was selected, this class will save a copy of it |
void |
deleteSelectedShape()
PRE: None POST: Delete the selected shape from the list if there is one selected |
void |
drawAllShapes(java.awt.Graphics g)
PRE: A valid Graphics object POST: Draw all the shape in the list. |
java.awt.Color |
getSelectedShapeColor()
PRE: None POST: Return the color of the selectedShape color, if no shape is selected, it will return null |
void |
moveSelectedPointBox(int deltaX,
int deltaY)
PRE: None POST: Move the point box of the selected shape object |
void |
moveSelectedShapeToBack()
PRE: None POST: Move the selected shape one object to the back. |
void |
moveSelectedShapeToFront()
PRE: None POST: Move the selected shape one object to the front. |
void |
moveShape(int deltaX,
int deltaY)
PRE: None POST: Move the selected Shape of the input offsets |
boolean |
pasteShape()
PRE: NoneBR> POST: If there is a copied shape, will add it to the last in the list and place it to the top left corner and return true. |
boolean |
selectNextShape()
PRE: None POST: Select the next shape in the list. |
boolean |
selectPointBox(Point pt)
PRE: None POST: Check if the point in the pointbox of the selecetd shape. |
boolean |
selectPreviousShape()
PRE: None POST: Select the previous shape in the list. |
boolean |
selectShape(Point p)
PRE: A valid point POST: Go through the shape list from the top(LIFO) and do hit test on the shape. |
void |
setSelectedShapeColor(java.awt.Color color)
PRE: A valid Color object POST: Set the selected Shape's color from the input color object only if there is a selected shape |
void |
setShapeEndPoint(Point p)
PRE: A valid Point object POST: Set the endPoint of the select shape as the input, solely for Resizing |
void |
unSelectShape()
PRE: None POST: Don't keep track of the selected object |
Methods inherited from class java.lang.Object |
|
Field Detail |
private java.util.Vector shapeList
private DrawableShape selectedShape
private DrawableShape copyShape
private boolean bSelectedPointBox
Constructor Detail |
public DrawPadDoc()
Method Detail |
public void addShape(DrawableShape shape)
public void drawAllShapes(java.awt.Graphics g)
public boolean selectShape(Point p)
public void unSelectShape()
public void moveShape(int deltaX, int deltaY)
public void setShapeEndPoint(Point p)
public void deleteSelectedShape()
public boolean selectPointBox(Point pt)
public void moveSelectedPointBox(int deltaX, int deltaY)
public void moveSelectedShapeToFront()
public void moveSelectedShapeToBack()
public boolean selectNextShape()
public boolean selectPreviousShape()
public java.awt.Color getSelectedShapeColor()
public void setSelectedShapeColor(java.awt.Color color)
public void copySelectedShape()
public boolean pasteShape()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |