sddl.hierarchy
Class Canvas

java.lang.Object
  extended by sddl.hierarchy.Shape
      extended by sddl.hierarchy.Canvas

public class Canvas
extends Shape

This Shape only represents a container. It has its own coordinate system and can be used to construct complex shapes.

Version:
1.00
Author:
Mathieu Bourgeois

Constructor Summary
Canvas()
          Standard SDDL constructor
 
Method Summary
 void addCanvas(Canvas added, AbstractPoint location)
          Not used
 Drawing addShape(Shape s, AbstractPoint location)
          Adds a Shape in the current Canvas
 Drawing addShape(Shape s, AbstractPoint location, java.lang.String name)
          Adds a Shape in the current Canvas
 Canvas copy()
          Returns a copy of this Canvas
 void draw(AbstractPoint location, java.io.PrintWriter out)
          Standard SDDL draw function.
 void drawCanvas(AbstractPoint location, java.util.LinkedList<Drawing> remainingDraws, java.io.PrintWriter out)
          Draws this specific canvas
 void drawMain(java.io.PrintWriter out)
          Starts the drawing of the main canvas and everything linked to it
 Canvas getCanvas(int i)
          Not used
 AbstractPoint getCanvasLocation(int i)
          Not used
 Drawing getDrawing(int i)
          Gets a specific drawing with its index
 Drawing getDrawing(java.lang.String name)
          Get one of the drawing in this canvas with its specific name
 AbstractPoint getDrawingLocation(int i)
          Get the location of a drawing from its index
 AbstractPoint getDrawingLocation(java.lang.String name)
          Get the location of one of the drawing in this canvas with its specific name
 Drawing getDrawingOrNull(java.lang.String name)
          Get the drawing of this name or return null
 int getNumberOfCanvas()
          Not used
 int getNumberOfDrawings()
          Returns the number of drawings in this canvas
 boolean isMain()
          Verifies if this canvas is the main canvas
 Path obtainPath()
          Not implemented on a canvas
 void setCanvasPosition(AbstractPoint position)
          Sets the position at which the canvas is positionned compared to its father canvas
 void setMain()
          Sets the Canvas as the main canvas
 
Methods inherited from class sddl.hierarchy.Shape
isVisible, setVisible
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Canvas

public Canvas()
Standard SDDL constructor

Method Detail

copy

public Canvas copy()
Returns a copy of this Canvas

Specified by:
copy in class Shape
Returns:
A copy of this Canvas

setCanvasPosition

public void setCanvasPosition(AbstractPoint position)
Sets the position at which the canvas is positionned compared to its father canvas

Parameters:
position - The position relative to its father

setMain

public void setMain()
Sets the Canvas as the main canvas


isMain

public boolean isMain()
Verifies if this canvas is the main canvas

Returns:
If this canvas is the main canvas

addCanvas

public void addCanvas(Canvas added,
                      AbstractPoint location)
Not used


getCanvas

public Canvas getCanvas(int i)
Not used


getCanvasLocation

public AbstractPoint getCanvasLocation(int i)
Not used


getNumberOfCanvas

public int getNumberOfCanvas()
Not used


addShape

public Drawing addShape(Shape s,
                        AbstractPoint location)
Adds a Shape in the current Canvas

Parameters:
s - The Shape to be added
location - The location at which to add it (respective to its father canvas)
Returns:
A Drawing describing this positioned Shape

addShape

public Drawing addShape(Shape s,
                        AbstractPoint location,
                        java.lang.String name)
Adds a Shape in the current Canvas

Parameters:
s - The Shape to be added
location - The location at which to add it (respective to its father canvas)
name - A name to give to the resulting drawing
Returns:
A Drawing describing this positioned Shape

getDrawing

public Drawing getDrawing(int i)
Gets a specific drawing with its index

Parameters:
i - The index of the drawing (starting at 0)
Returns:
The drawing at index i

getDrawing

public Drawing getDrawing(java.lang.String name)
Get one of the drawing in this canvas with its specific name

Parameters:
name - The name of the drawing
Returns:
The drawing with this name

getDrawingLocation

public AbstractPoint getDrawingLocation(java.lang.String name)
Get the location of one of the drawing in this canvas with its specific name

Parameters:
name - The name of the drawing
Returns:
The location of the drawing with this name

getDrawingOrNull

public Drawing getDrawingOrNull(java.lang.String name)
Get the drawing of this name or return null

Parameters:
name - The name of the drawing
Returns:
The drawing with this name

getDrawingLocation

public AbstractPoint getDrawingLocation(int i)
Get the location of a drawing from its index

Parameters:
i - Index of the drawing
Returns:
Location of this drawing

getNumberOfDrawings

public int getNumberOfDrawings()
Returns the number of drawings in this canvas

Returns:
The number of drawings in this canvas

draw

public void draw(AbstractPoint location,
                 java.io.PrintWriter out)
Description copied from class: Shape
Standard SDDL draw function. Every shape must implement this

Specified by:
draw in class Shape
Parameters:
location - The location of the Shape on the main drawing
out - The file to be written to

drawMain

public void drawMain(java.io.PrintWriter out)
Starts the drawing of the main canvas and everything linked to it

Parameters:
out - The file to write to

drawCanvas

public void drawCanvas(AbstractPoint location,
                       java.util.LinkedList<Drawing> remainingDraws,
                       java.io.PrintWriter out)
Draws this specific canvas

Parameters:
location - The location relative to the main drawing
remainingDraws - Drawing remaining to be drawn
out - File to write to

obtainPath

public Path obtainPath()
Not implemented on a canvas

Specified by:
obtainPath in class Shape
Returns:
A Path describing the outer boundary of the Shape