Graphic Rendering System 1.0
A Java-based graphic rendering system implementing various design patterns
Loading...
Searching...
No Matches
com.example.graphics.Drawing Class Reference
Inheritance diagram for com.example.graphics.Drawing:
Inheritance graph
Collaboration diagram for com.example.graphics.Drawing:
Collaboration graph

Public Member Functions

 Drawing (Renderer renderer)
void acceptVisitor (ShapeVisitor visitor)
void addObserver (ShapeObserver observer)
void addShape (Shape shape)
Renderer getRenderer ()
List< ShapegetShapes ()
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< Shapeshapes
final ShapeSubject shapeSubject

Static Private Attributes

static final long serialVersionUID = 1L

Detailed Description

Main drawing class that manages shapes and rendering. This class integrates the various design patterns.

Definition at line 22 of file Drawing.java.

Constructor & Destructor Documentation

◆ Drawing()

com.example.graphics.Drawing.Drawing ( Renderer renderer)
inline

Constructor initializes the drawing

Parameters
rendererthe renderer to use

Definition at line 34 of file Drawing.java.

References renderer.

Member Function Documentation

◆ acceptVisitor()

void com.example.graphics.Drawing.acceptVisitor ( ShapeVisitor visitor)
inline

Apply a visitor to all shapes

Parameters
visitorthe visitor to apply

Definition at line 154 of file Drawing.java.

References shapes.

Referenced by com.example.graphics.Main.main().

Here is the caller graph for this function:

◆ addObserver()

void com.example.graphics.Drawing.addObserver ( ShapeObserver observer)
inline

Add an observer to be notified of shape changes

Parameters
observerthe observer to add

Definition at line 93 of file Drawing.java.

References shapeSubject.

Referenced by com.example.graphics.Main.main().

Here is the caller graph for this function:

◆ addShape()

void com.example.graphics.Drawing.addShape ( Shape shape)
inline

Add a shape to the drawing using the Command pattern

Parameters
shapethe shape to add

Definition at line 45 of file Drawing.java.

References commandManager, shapes, and shapeSubject.

Referenced by com.example.graphics.Main.main().

Here is the caller graph for this function:

◆ getRenderer()

Renderer com.example.graphics.Drawing.getRenderer ( )
inline

Get the current renderer

Returns
the current renderer

Definition at line 117 of file Drawing.java.

References renderer.

◆ getShapes()

List< Shape > com.example.graphics.Drawing.getShapes ( )
inline

Get the list of shapes

Returns
the list of shapes

Definition at line 125 of file Drawing.java.

References shapes.

◆ moveShape()

void com.example.graphics.Drawing.moveShape ( Shape shape,
int x,
int y )
inline

Move a shape to a new position using the Command pattern

Parameters
shapethe shape to move
xthe new x coordinate
ythe new y coordinate

Definition at line 67 of file Drawing.java.

References commandManager, and shapeSubject.

Referenced by com.example.graphics.Main.main().

Here is the caller graph for this function:

◆ redo()

boolean com.example.graphics.Drawing.redo ( )
inline

Redo the last undone command

Returns
true if a command was redone, false if there are no commands to redo

Definition at line 85 of file Drawing.java.

References commandManager.

Referenced by com.example.graphics.Main.main().

Here is the caller graph for this function:

◆ removeObserver()

void com.example.graphics.Drawing.removeObserver ( ShapeObserver observer)
inline

Remove an observer from the notification list

Parameters
observerthe observer to remove

Definition at line 101 of file Drawing.java.

References shapeSubject.

◆ removeShape()

void com.example.graphics.Drawing.removeShape ( Shape shape)
inline

Remove a shape from the drawing using the Command pattern

Parameters
shapethe shape to remove

Definition at line 55 of file Drawing.java.

References commandManager, shapes, and shapeSubject.

◆ render()

void com.example.graphics.Drawing.render ( )
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().

Here is the caller graph for this function:

◆ setRenderer()

void com.example.graphics.Drawing.setRenderer ( Renderer renderer)
inline

Set the renderer to use

Parameters
rendererthe renderer to use

Definition at line 109 of file Drawing.java.

References renderer.

Referenced by com.example.graphics.Main.main().

Here is the caller graph for this function:

◆ undo()

boolean com.example.graphics.Drawing.undo ( )
inline

Undo the last command

Returns
true if a command was undone, false if there are no commands to undo

Definition at line 77 of file Drawing.java.

References commandManager.

Referenced by com.example.graphics.Main.main().

Here is the caller graph for this function:

Member Data Documentation

◆ commandManager

final CommandManager com.example.graphics.Drawing.commandManager
private

Definition at line 26 of file Drawing.java.

Referenced by addShape(), moveShape(), redo(), removeShape(), and undo().

◆ renderer

transient Renderer com.example.graphics.Drawing.renderer
private

Definition at line 28 of file Drawing.java.

Referenced by Drawing(), getRenderer(), render(), and setRenderer().

◆ serialVersionUID

final long com.example.graphics.Drawing.serialVersionUID = 1L
staticprivate

Definition at line 23 of file Drawing.java.

◆ shapes

final List<Shape> com.example.graphics.Drawing.shapes
private

Definition at line 25 of file Drawing.java.

Referenced by acceptVisitor(), addShape(), getShapes(), removeShape(), and render().

◆ shapeSubject

final ShapeSubject com.example.graphics.Drawing.shapeSubject
private

Definition at line 27 of file Drawing.java.

Referenced by addObserver(), addShape(), moveShape(), removeObserver(), and removeShape().


The documentation for this class was generated from the following file: