de.caff.maze
Class SvgMazePainter

java.lang.Object
  extended by de.caff.maze.SvgMazePainter
All Implemented Interfaces:
Constants, MazePainter

public class SvgMazePainter
extends java.lang.Object
implements MazePainter, Constants

Painter which outputs the maze into an SVG file.

 

Nested Class Summary
 
Nested classes/interfaces inherited from interface de.caff.maze.MazePainter
MazePainter.PaintObjectType
 
Field Summary
static SystemAccess.FileType FILE_TYPE
          File type for DXF files.
 
Fields inherited from interface de.caff.maze.Constants
VERSION, WEB_PAGE
 
Constructor Summary
SvgMazePainter(java.io.OutputStream out)
          Constructor.
 
Method Summary
 void draw(java.awt.Shape shape)
          Draw a shape with current paint and stroke.
 void drawArc(float x, float y, float w, float h, float start, float extent)
          Draw an open arc with current paint and stroke.
 void drawLine(float startX, float startY, float endX, float endY)
          Draw a line with current paint and stroke..
 void endPainting(MazePainter.PaintObjectType type)
          End painting the given type of paint objects.
 void endPaintingMaze()
          End painting the maze.
 void fill(java.awt.Shape shape)
          Fill a shape with the current paint.
 java.lang.Throwable getError()
          Get any error which happened during usage of the painter.
 void setPaint(java.awt.Paint paint)
          Set a paint.
 void setStroke(java.awt.Stroke stroke)
          Set a stroke.
 void startPainting(MazePainter.PaintObjectType type)
          Start painting the given type of paint objects.
 void startPaintingMaze(Maze maze)
          Start painting the maze.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_TYPE

public static final SystemAccess.FileType FILE_TYPE
File type for DXF files.

Constructor Detail

SvgMazePainter

public SvgMazePainter(java.io.OutputStream out)
Constructor.

Parameters:
out - output stream
Method Detail

getError

public java.lang.Throwable getError()
Get any error which happened during usage of the painter.

Returns:
error or null if the painter worked nicely

startPaintingMaze

public void startPaintingMaze(Maze maze)
Start painting the maze.

Specified by:
startPaintingMaze in interface MazePainter
Parameters:
maze - painted maze

endPaintingMaze

public void endPaintingMaze()
End painting the maze.

Specified by:
endPaintingMaze in interface MazePainter

startPainting

public void startPainting(MazePainter.PaintObjectType type)
Start painting the given type of paint objects.

Specified by:
startPainting in interface MazePainter
Parameters:
type - object type which painting starts

endPainting

public void endPainting(MazePainter.PaintObjectType type)
End painting the given type of paint objects.

Specified by:
endPainting in interface MazePainter
Parameters:
type - object type which painting has ended

setStroke

public void setStroke(java.awt.Stroke stroke)
Set a stroke.

Specified by:
setStroke in interface MazePainter
Parameters:
stroke - new stroke to use in upcoming drawing commands

setPaint

public void setPaint(java.awt.Paint paint)
Set a paint.

Specified by:
setPaint in interface MazePainter
Parameters:
paint - paint to use in upcoming drawing commands.

drawLine

public void drawLine(float startX,
                     float startY,
                     float endX,
                     float endY)
Draw a line with current paint and stroke..

Specified by:
drawLine in interface MazePainter
Parameters:
startX - starting point X coordinate
startY - starting point Y coordinate
endX - ending point X coordinate
endY - ending point Y coordinate

drawArc

public void drawArc(float x,
                    float y,
                    float w,
                    float h,
                    float start,
                    float extent)
Draw an open arc with current paint and stroke.

Specified by:
drawArc in interface MazePainter
Parameters:
x - x of rectangle enclosing ellipse
y - y of rectangle enclosing ellipse
w - width of rectangle enclosing ellipse
h - height of rectangle enclosing ellipse
start - start of angle in degrees, from x axis,
extent - extent of angle in degrees

draw

public void draw(java.awt.Shape shape)
Draw a shape with current paint and stroke.

Specified by:
draw in interface MazePainter
Parameters:
shape - shape to draw

fill

public void fill(java.awt.Shape shape)
Fill a shape with the current paint.

Specified by:
fill in interface MazePainter
Parameters:
shape - shape to fill