org.knime.base.node.viz.aggregation
Class DrawingUtils

java.lang.Object
  extended by org.knime.base.node.viz.aggregation.DrawingUtils

public final class DrawingUtils
extends Object

Utility class that eases the drawing of different shapes.

Author:
Tobias Koetter, University of Konstanz

Method Summary
static Arc2D calculateBorderArc(Arc2D arc, BasicStroke stroke)
          Calculates the size of the arc with the given stroke.
static Rectangle2D calculateBorderRect(Rectangle2D rect, BasicStroke stroke)
          Calculates the size of the rectangle with the given stroke.
static void drawArc(Graphics2D g2, Arc2D arc, Paint paint, BasicStroke stroke)
          Draws the outline of the given arc.
static void drawBlock(Graphics2D g2, Shape shape, Paint paint)
          Draws a filled rectangle without a border and default transparency.
static void drawBlock(Graphics2D g2, Shape shape, Paint paint, float alpha)
          Draws a filled shape without a border.
static void drawMessage(Graphics2D g2, Font font, String msg, Rectangle2D bounds)
          Draws the given message in the center of the given rectangle.
static void drawOutline(Graphics2D g2, Shape shape, Paint paint, Stroke stroke)
          Draws the outline of the shape.
static void drawRectangle(Graphics2D g2, Rectangle2D rect, Color color, BasicStroke stroke)
          Draws an empty rectangle.
static void paintHorizontalLine(Graphics2D g2, int xOffset, int yOffset, int lineWidth, Color color, BasicStroke stroke)
          Draws a horizontal line starting at the given x/y offset with the given length.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

drawMessage

public static void drawMessage(Graphics2D g2,
                               Font font,
                               String msg,
                               Rectangle2D bounds)
Draws the given message in the center of the given rectangle.

Parameters:
g2 - the graphic object to use
font - the font
msg - the message
bounds - the boundary to write in

paintHorizontalLine

public static void paintHorizontalLine(Graphics2D g2,
                                       int xOffset,
                                       int yOffset,
                                       int lineWidth,
                                       Color color,
                                       BasicStroke stroke)
Draws a horizontal line starting at the given x/y offset with the given length.

Parameters:
g2 - the graphics object to use
xOffset - the x offset of the line
yOffset - the y offset of the line
lineWidth - the width of the line
color - the drawing color
stroke - the stroke to use

drawBlock

public static void drawBlock(Graphics2D g2,
                             Shape shape,
                             Paint paint)
Draws a filled rectangle without a border and default transparency.

Parameters:
g2 - the graphic object
shape - the shape to fill
paint - the filling color or TexturePaint

drawBlock

public static void drawBlock(Graphics2D g2,
                             Shape shape,
                             Paint paint,
                             float alpha)
Draws a filled shape without a border.

Parameters:
g2 - the graphic object
shape - the shape to fill
paint - the filling color or TexturePaint
alpha - the transparency

drawOutline

public static void drawOutline(Graphics2D g2,
                               Shape shape,
                               Paint paint,
                               Stroke stroke)
Draws the outline of the shape.

Parameters:
g2 - the graphic object
shape - the shape to draw
paint - the filling color or TexturePaint
stroke - the Stroke to use

drawArc

public static void drawArc(Graphics2D g2,
                           Arc2D arc,
                           Paint paint,
                           BasicStroke stroke)
Draws the outline of the given arc.

Parameters:
g2 - the graphic object
arc - the arc to draw
paint - the filling color or TexturePaint
stroke - the Stroke to use

drawRectangle

public static void drawRectangle(Graphics2D g2,
                                 Rectangle2D rect,
                                 Color color,
                                 BasicStroke stroke)
Draws an empty rectangle.

Parameters:
g2 - the graphics object
rect - the rectangle to draw
color - the Color of the rectangle border
stroke - the BasicStroke to use

calculateBorderRect

public static Rectangle2D calculateBorderRect(Rectangle2D rect,
                                              BasicStroke stroke)
Calculates the size of the rectangle with the given stroke.

Parameters:
rect - the original size of the rectangle
stroke - the stroke which will be used to draw the rectangle
Returns:
the Rectangle2D to draw

calculateBorderArc

public static Arc2D calculateBorderArc(Arc2D arc,
                                       BasicStroke stroke)
Calculates the size of the arc with the given stroke.

Parameters:
arc - the original size of the arc
stroke - the stroke which will be used to draw the arc
Returns:
the Arc2D to draw


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.