at.tuwien.ifs.somtoolbox.util
Class VisualisationUtils

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.util.VisualisationUtils

public class VisualisationUtils
extends Object

This class gathers utility methods for SOM visualisations, such as drawing a unit grid or borders around already created visualisations.

Version:
$Id: VisualisationUtils.java 3696 2010-07-16 13:51:26Z mayer $
Author:
Rudolf Mayer

Constructor Summary
VisualisationUtils()
           
 
Method Summary
static void drawBorder(BufferedImage buffImage)
          draws a black border around the image
static void drawMarker(Graphics2D g, int markerWidth, int markerHeight, Point location)
          Draws a circle-marker on the given position
static void drawThickLine(Graphics2D g, int x1, int y1, int x2, int y2, int lineWidth, int lineHeight)
          Draws a thick line of the given width and height, between the given coordinates
static void drawThickLine(Graphics2D g, Point p1, Point p2, int unitWidth, int unitHeight)
          Draws a think line between the two given points.
static void drawThickLine(Graphics2D g, Unit u1, Unit u2, int unitWidth, int unitHeight)
          Draws a thick line from the centre of u1 to u2, using drawThickLine(Graphics2D, Point, Point, int, int)
static void drawUnitCentreMarker(Graphics2D g, Unit unit, int unitWidth, int unitHeight, int markerWidth, int markerHeight)
          Draws a marker in the centre of the given unit.
static void drawUnitGrid(BufferedImage bufferedImage, GrowingSOM gsom, int width, int height)
          Draws a black grid of units on the BufferedImage
static void drawUnitGrid(Graphics2D g, GrowingSOM gsom, int width, int height)
          Draws a black grid of units on the Graphics2D object
static void drawUnitGrid(Graphics2D g, GrowingSOM gsom, int width, int height, Color colour)
          Draws a grid of units on the Graphics2D object in the given colour.
static Point getUnitCentreLocation(int xPos, int yPos, double unitWidth, double unitHeight)
           
static Point getUnitCentreLocation(Unit unit, double unitWidth, double unitHeight)
           
static Point getUnitCentreLocation(Unit unit, double unitWidth, double unitHeight, int offsetX, int offsetY)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VisualisationUtils

public VisualisationUtils()
Method Detail

drawBorder

public static void drawBorder(BufferedImage buffImage)
draws a black border around the image


drawThickLine

public static void drawThickLine(Graphics2D g,
                                 int x1,
                                 int y1,
                                 int x2,
                                 int y2,
                                 int lineWidth,
                                 int lineHeight)
Draws a thick line of the given width and height, between the given coordinates


drawThickLine

public static void drawThickLine(Graphics2D g,
                                 Point p1,
                                 Point p2,
                                 int unitWidth,
                                 int unitHeight)
Draws a think line between the two given points. The line width and height are computed as 1/10 of the given unitWidth/Height values


drawThickLine

public static void drawThickLine(Graphics2D g,
                                 Unit u1,
                                 Unit u2,
                                 int unitWidth,
                                 int unitHeight)
Draws a thick line from the centre of u1 to u2, using drawThickLine(Graphics2D, Point, Point, int, int)


drawUnitCentreMarker

public static void drawUnitCentreMarker(Graphics2D g,
                                        Unit unit,
                                        int unitWidth,
                                        int unitHeight,
                                        int markerWidth,
                                        int markerHeight)
Draws a marker in the centre of the given unit. The unitWidth & unitHeight are needed to compute the pixel location, markerWidth and markerHeight indicate the size of the circle/oval to draw.


drawMarker

public static void drawMarker(Graphics2D g,
                              int markerWidth,
                              int markerHeight,
                              Point location)
Draws a circle-marker on the given position


drawUnitGrid

public static void drawUnitGrid(BufferedImage bufferedImage,
                                GrowingSOM gsom,
                                int width,
                                int height)
Draws a black grid of units on the BufferedImage


drawUnitGrid

public static void drawUnitGrid(Graphics2D g,
                                GrowingSOM gsom,
                                int width,
                                int height)
Draws a black grid of units on the Graphics2D object


drawUnitGrid

public static void drawUnitGrid(Graphics2D g,
                                GrowingSOM gsom,
                                int width,
                                int height,
                                Color colour)
Draws a grid of units on the Graphics2D object in the given colour. The width of the grid lines depends on the image resolution, and is 1/20 of the unit width.


getUnitCentreLocation

public static Point getUnitCentreLocation(int xPos,
                                          int yPos,
                                          double unitWidth,
                                          double unitHeight)

getUnitCentreLocation

public static Point getUnitCentreLocation(Unit unit,
                                          double unitWidth,
                                          double unitHeight)

getUnitCentreLocation

public static Point getUnitCentreLocation(Unit unit,
                                          double unitWidth,
                                          double unitHeight,
                                          int offsetX,
                                          int offsetY)