de.cau.cs.kieler.kiml.ui.util
Class DebugCanvas

java.lang.Object
  extended by de.cau.cs.kieler.kiml.ui.util.DebugCanvas
All Implemented Interfaces:
IDebugCanvas

public class DebugCanvas
extends Object
implements IDebugCanvas

A canvas for drawing debug information on the active diagram. Currently the offset of hierarchical nodes is only computed correctly if the root node of the layout is the diagram.

Rating proposed yellow
(2011-01-13) msp

Nested Class Summary
 
Nested classes/interfaces inherited from interface de.cau.cs.kieler.kiml.util.IDebugCanvas
IDebugCanvas.Color
 
Constructor Summary
DebugCanvas()
           
 
Method Summary
 void clear()
          Clears the canvas and the figure buffer.
 void drawBuffer()
          Draws the buffered figures and clears the buffer.
 void drawCircle(float x, float y, float d, IDebugCanvas.Color color)
          Draws a non-filled circle on the canvas.
 void drawEllipse(float x, float y, float w, float h, IDebugCanvas.Color color)
          Draws a non-filled ellipse on the canvas.
 void drawFilledCircle(float x, float y, float d, IDebugCanvas.Color color)
          Draws a filled circle on the canvas.
 void drawFilledEllipse(float x, float y, float w, float h, IDebugCanvas.Color color)
          Draws a filled ellipse on the canvas.
 void drawFilledRectangle(float x, float y, float w, float h, IDebugCanvas.Color color)
          Draws a filled rectangle on the canvas.
 void drawLine(float x1, float y1, float x2, float y2, IDebugCanvas.Color color)
          Draws a line on the canvas.
 void drawRectangle(float x, float y, float w, float h, IDebugCanvas.Color color)
          Draws a non-filled rectangle one the canvas.
 void drawString(String string, float x, float y, IDebugCanvas.Color color)
          Draws a string on the canvas.
 void setBuffered(boolean buffered)
          Sets the canvas to buffered mode or non-buffered mode.
 void setMapping(LayoutMapping<?> layoutMapping)
          Sets the canvas up for the given layout manager.
 void setOffset(KNode parentNode, float addx, float addy)
          Sets an offset for this canvas.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DebugCanvas

public DebugCanvas()
Method Detail

setMapping

public void setMapping(LayoutMapping<?> layoutMapping)
Sets the canvas up for the given layout manager. This Method must be called before any drawing can be done.

Parameters:
layoutMapping - a layout mapping

setOffset

public void setOffset(KNode parentNode,
                      float addx,
                      float addy)
Sets an offset for this canvas.

Specified by:
setOffset in interface IDebugCanvas
Parameters:
parentNode - the parent node that defines the current offset
addx - additional horizontal offset
addy - additional vertical offset

drawFilledRectangle

public void drawFilledRectangle(float x,
                                float y,
                                float w,
                                float h,
                                IDebugCanvas.Color color)
Draws a filled rectangle on the canvas.

Specified by:
drawFilledRectangle in interface IDebugCanvas
Parameters:
x - the x-coordinate
y - the y-coordinate
w - the width
h - the height
color - the color

drawRectangle

public void drawRectangle(float x,
                          float y,
                          float w,
                          float h,
                          IDebugCanvas.Color color)
Draws a non-filled rectangle one the canvas.

Specified by:
drawRectangle in interface IDebugCanvas
Parameters:
x - the x-coordinate
y - the y-coordinate
w - the width
h - the height
color - the color

drawFilledEllipse

public void drawFilledEllipse(float x,
                              float y,
                              float w,
                              float h,
                              IDebugCanvas.Color color)
Draws a filled ellipse on the canvas.

Specified by:
drawFilledEllipse in interface IDebugCanvas
Parameters:
x - the x-coordinate
y - the y-coordinate
w - the width
h - the height
color - the color

drawEllipse

public void drawEllipse(float x,
                        float y,
                        float w,
                        float h,
                        IDebugCanvas.Color color)
Draws a non-filled ellipse on the canvas.

Specified by:
drawEllipse in interface IDebugCanvas
Parameters:
x - the x-coordinate
y - the y-coordinate
w - the width
h - the height
color - the color

drawFilledCircle

public void drawFilledCircle(float x,
                             float y,
                             float d,
                             IDebugCanvas.Color color)
Draws a filled circle on the canvas.

Specified by:
drawFilledCircle in interface IDebugCanvas
Parameters:
x - the x-coordinate
y - the y-coordinate
d - the diameter
color - the color

drawCircle

public void drawCircle(float x,
                       float y,
                       float d,
                       IDebugCanvas.Color color)
Draws a non-filled circle on the canvas.

Specified by:
drawCircle in interface IDebugCanvas
Parameters:
x - the x-coordinate
y - the y-coordinate
d - the diameter
color - the color

drawLine

public void drawLine(float x1,
                     float y1,
                     float x2,
                     float y2,
                     IDebugCanvas.Color color)
Draws a line on the canvas.

Specified by:
drawLine in interface IDebugCanvas
Parameters:
x1 - the x-coordinate of the start point
y1 - the y-coordinate of the start point
x2 - the x-coordinate of the end point
y2 - the y-coordinate of the end point
color - the color

drawString

public void drawString(String string,
                       float x,
                       float y,
                       IDebugCanvas.Color color)
Draws a string on the canvas.

Specified by:
drawString in interface IDebugCanvas
Parameters:
string - the string
x - the x-coordinate
y - the y-coordinate
color - the color

clear

public void clear()
Clears the canvas and the figure buffer.

Specified by:
clear in interface IDebugCanvas

drawBuffer

public void drawBuffer()
Draws the buffered figures and clears the buffer. This has only an effect if the canvas is set to buffered.

Specified by:
drawBuffer in interface IDebugCanvas

setBuffered

public void setBuffered(boolean buffered)
Sets the canvas to buffered mode or non-buffered mode.

Specified by:
setBuffered in interface IDebugCanvas
Parameters:
buffered - whether buffered mode shall be active