Graphic Rendering System 1.0
A Java-based graphic rendering system implementing various design patterns
|
Public Member Functions | |
Drawing (Renderer renderer) | |
void | acceptVisitor (ShapeVisitor visitor) |
void | addObserver (ShapeObserver observer) |
void | addShape (Shape shape) |
Renderer | getRenderer () |
List< Shape > | getShapes () |
void | moveShape (Shape shape, int x, int y) |
boolean | redo () |
void | removeObserver (ShapeObserver observer) |
void | removeShape (Shape shape) |
void | render () |
void | setRenderer (Renderer renderer) |
boolean | undo () |
Private Attributes | |
final CommandManager | commandManager |
transient Renderer | renderer |
final List< Shape > | shapes |
final ShapeSubject | shapeSubject |
Static Private Attributes | |
static final long | serialVersionUID = 1L |
Main drawing class that manages shapes and rendering. This class integrates the various design patterns.
Definition at line 22 of file Drawing.java.
|
inline |
Constructor initializes the drawing
renderer | the renderer to use |
Definition at line 34 of file Drawing.java.
References renderer.
|
inline |
Apply a visitor to all shapes
visitor | the visitor to apply |
Definition at line 154 of file Drawing.java.
References shapes.
Referenced by com.example.graphics.Main.main().
|
inline |
Add an observer to be notified of shape changes
observer | the observer to add |
Definition at line 93 of file Drawing.java.
References shapeSubject.
Referenced by com.example.graphics.Main.main().
|
inline |
Add a shape to the drawing using the Command pattern
shape | the shape to add |
Definition at line 45 of file Drawing.java.
References commandManager, shapes, and shapeSubject.
Referenced by com.example.graphics.Main.main().
|
inline |
Get the current renderer
Definition at line 117 of file Drawing.java.
References renderer.
|
inline |
Get the list of shapes
Definition at line 125 of file Drawing.java.
References shapes.
|
inline |
Move a shape to a new position using the Command pattern
shape | the shape to move |
x | the new x coordinate |
y | the new y coordinate |
Definition at line 67 of file Drawing.java.
References commandManager, and shapeSubject.
Referenced by com.example.graphics.Main.main().
|
inline |
Redo the last undone command
Definition at line 85 of file Drawing.java.
References commandManager.
Referenced by com.example.graphics.Main.main().
|
inline |
Remove an observer from the notification list
observer | the observer to remove |
Definition at line 101 of file Drawing.java.
References shapeSubject.
|
inline |
Remove a shape from the drawing using the Command pattern
shape | the shape to remove |
Definition at line 55 of file Drawing.java.
References commandManager, shapes, and shapeSubject.
|
inline |
Render all shapes using the current renderer
Definition at line 132 of file Drawing.java.
References renderer, and shapes.
Referenced by com.example.graphics.Main.main().
|
inline |
Set the renderer to use
renderer | the renderer to use |
Definition at line 109 of file Drawing.java.
References renderer.
Referenced by com.example.graphics.Main.main().
|
inline |
Undo the last command
Definition at line 77 of file Drawing.java.
References commandManager.
Referenced by com.example.graphics.Main.main().
|
private |
Definition at line 26 of file Drawing.java.
Referenced by addShape(), moveShape(), redo(), removeShape(), and undo().
|
private |
Definition at line 28 of file Drawing.java.
Referenced by Drawing(), getRenderer(), render(), and setRenderer().
|
staticprivate |
Definition at line 23 of file Drawing.java.
|
private |
Definition at line 25 of file Drawing.java.
Referenced by acceptVisitor(), addShape(), getShapes(), removeShape(), and render().
|
private |
Definition at line 27 of file Drawing.java.
Referenced by addObserver(), addShape(), moveShape(), removeObserver(), and removeShape().