at.tuwien.ifs.somtoolbox.visualization
Class MetroMapVisualizer

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.visualization.AbstractBackgroundImageVisualizer
      extended by at.tuwien.ifs.somtoolbox.visualization.MetroMapVisualizer
All Implemented Interfaces:
BackgroundImageVisualizer, java.lang.Comparable<BackgroundImageVisualizer>

public class MetroMapVisualizer
extends AbstractBackgroundImageVisualizer

Version:
$Id: MetroMapVisualizer.java 4161 2011-02-11 16:23:39Z mayer $
Author:
Rudolf Mayer

Nested Class Summary
private  class MetroMapVisualizer.MetroMapControlPanel
          A control panel extending the generic AbstractBackgroundImageVisualizer.VisualizationControlPanel, adding additionally a JList and a JTextField for selecting a component from the TemplateVector.
(package private) static class MetroMapVisualizer.Mode
           
 
Nested classes/interfaces inherited from class at.tuwien.ifs.somtoolbox.visualization.AbstractBackgroundImageVisualizer
AbstractBackgroundImageVisualizer.ContourInterpolationMode, AbstractBackgroundImageVisualizer.ContourMode, AbstractBackgroundImageVisualizer.VisualizationControlPanel
 
Field Summary
private  MetroMapVisualizer.Mode aggregationMode
           
private  double aggregationSimilarity
           
private  int aggregationTargetNumberOfComponents
           
private  java.util.Hashtable<java.awt.geom.Point2D,int[]>[] allDirections
           
private  java.awt.geom.Point2D[] allSOMCoordinates
          Array of all points on the SOM .
private  double[] allSOMCoordinatesDiffValues
          Similar matrix as allSOMCoordinatesSumValues, but containing the difference of the X&Y coordinates, for upper-left and lower-right diagonal units.
private  double[] allSOMCoordinatesSumValues
          Lookup-up matrix to check fast if two points are on a diagonal to each other.
protected  java.awt.geom.Point2D[][] binCentres
           
private  Palette binPalette
           
private  LeastRecentlyUsedCache<ClusterElementFunctions<ComponentLine2D>,WardClustering<ComponentLine2D>> clusterCache
           
private  java.util.List<? extends Cluster<ComponentLine2D>> clusters
           
protected  MetroColorMap colorMap
           
private static java.awt.Color[] COLORS
           
private  javax.swing.JTable colourLegendTable1
           
private static java.lang.String COMP_PREFIX
           
 float[][] dashPatterns
           
private  int dim
           
private  int endIndexTable1
           
private  FlowBorderlineVisualizer flowBorderlineVisualizer
           
private  GrowingSOM gsom
           
private  int innerRadius
           
private static java.lang.String[] legendColumnNames
           
private  double legendColumns
           
protected  DistanceFunctionType lineDistanceFunction
           
private  double lineOffset
           
private  double lineOffsetIsThisFractionOfRadius
           
private  int lineThickness
           
static float[] lineThicknessFactors
           
private static int MAX_BINS
           
private static int MAX_NUMBER_OF_LEGEND_ENTRIES
          the attribute legend will have at most this many entries
private static MetroColorMap metroColorMap
           
private  MetroMapVisualizer.MetroMapControlPanel metroMapControlPanel
           
private static int MIN_BINS
           
private  int numberOfBins
           
private  java.awt.image.AffineTransformOp op
           
private  java.awt.image.BufferedImage overlayVisualisation
           
private  javax.swing.JComboBox overlayVisualisationComboBox
           
private  int radius
           
(package private)  double scale
           
private  int[] selectedComponentIndices
           
private  java.util.List<ComponentRegionCount> selectedComponents
           
private  MetroMapVisualizer.Mode selectionMode
           
private  int selectionTargetNumberOfComponents
           
private  double selectionThreshold
           
private  boolean snapping
           
private static java.awt.Color STATION_FILL_COLOUR
           
private  SOMLibTemplateVector templateVector
           
private  ThematicClassMapVisualizer thematicClassMapVisualizer
           
private  UMatrix uMatrixVisualizer
           
private  int unitHeight
           
private  java.util.Hashtable<java.awt.geom.Point2D,java.lang.Integer> unitsWithStopsOnThemAndHowMany
           
private  int unitWidth
           
 
Fields inherited from class at.tuwien.ifs.somtoolbox.visualization.AbstractBackgroundImageVisualizer
cache, CACHE_KEY_SEPARATOR, contourInterpolationMode, contourMode, controlPanel, currentZDimSlice, inputObjects, log, map, MAX_CACHE_SIZE_MB, neededInputObjects, NUM_VISUALIZATIONS, numberOfContours, opacity, preferredScaleFactor, VISUALIZATION_DESCRIPTIONS, VISUALIZATION_NAMES, VISUALIZATION_SHORT_NAMES, visualizationUpdateListener, zSize
 
Fields inherited from interface at.tuwien.ifs.somtoolbox.visualization.BackgroundImageVisualizer
CACHE_KEY_SECTION_SEPARATOR, DEFAULT_BACKGROUND_VISUALIZATION_SCALE
 
Constructor Summary
MetroMapVisualizer()
           
 
Method Summary
private  void colourUnits(java.awt.Graphics2D g, int[][] binAssignment, java.awt.Color[] binPalette)
          Colours SOM units according to the given bin assignment.
private  java.awt.geom.Point2D[][] computeFinalComponentLines(GrowingLayer layer)
          Performs the computation of the new bin centres, therefore component aggregation, selection as well as snapping are handled
private  java.util.Hashtable<java.awt.geom.Point2D,int[]> countOutgoingLines(java.awt.geom.Point2D[] line, java.util.Hashtable<java.awt.geom.Point2D,int[]> outgoingLineTable)
           
private  void createLayout(java.awt.Graphics2D g, GrowingLayer layer, boolean drawLine)
          Create the layout for the metro lines (not snapped).
protected  java.awt.image.BufferedImage createMetromapImage(int index, GrowingSOM gsom, int width, int height)
          Will create the metro map image for the given params.
 java.awt.image.BufferedImage createMetromapImage(int index, GrowingSOM gsom, int width, int height, int component)
           
private  java.awt.image.BufferedImage createOverlayVisualisation(int width, int height)
          Creates the selected overlay visualisation.
private  void createSnappedMetroLayout(java.awt.Graphics2D g, GrowingLayer layer)
          Organises all metro drawing for snapped lines, i.e.
private  void createStations(java.awt.Graphics2D g)
          Draw metro stations on top of existing maps.
 java.awt.image.BufferedImage createVisualization(int index, GrowingSOM gsom, int width, int height)
          Creates a visualisation image.
private  java.awt.geom.Point2D[][] doAggregation(java.util.ArrayList<ComponentLine2D> binCentresAsList, GrowingLayer layer)
          Clustering of metro lines is done in here (i.e.
private  java.awt.geom.Point2D[][] doSelection(java.awt.geom.Point2D[][] binCentres, GrowingLayer layer)
          Computes the line selection, returns the selected lines
private  java.awt.geom.Point2D[][] doSnapping(java.awt.geom.Point2D[][] binCentres, GrowingLayer layer)
          Performs the snapping step, returns snapped lines
private  void drawComponentLineSegment(java.awt.geom.Point2D begin, java.awt.geom.Point2D end, java.awt.Graphics2D g, int component, boolean keepCurrentStroke)
          Draws a line segment for the given component.
private  void drawLine(java.awt.Graphics2D g, int lineIndex, java.awt.geom.Point2D[][] binCentres)
           
private  void drawLineAndStation(java.awt.Graphics2D g, int lineIndex)
          Draw the line for the current line or component index.
private  java.util.Hashtable<java.awt.geom.Point2D,int[]>[] getAllDirections()
          Get a Hastable[] containing the per-dimension directions to draw on each unit of the som.
 java.awt.Color getColour(int component)
           
 java.awt.Color[] getColours(int components)
           
private  java.lang.String getComponentName(int i)
          VISUALISATION IMPROVEMENTS ***********************
private  java.lang.String[] getComponentNames()
           
private  int[] getComponentsInDirection(java.awt.geom.Point2D currentSOMUnit, int i_direction)
          Gets components which have links in the given direction.
private  int getDirection(java.awt.geom.Point2D current, java.awt.geom.Point2D next)
          returns the direction between two nodes based on the following scheme: 0 7 left up up right up 1 \ | / 6 left - * - right 6 / | \ 5 left down down right down 3 4
private  int[] getDirectionArray(java.awt.geom.Point2D current, java.awt.geom.Point2D next)
          get a direction array for the given points its indices are set to on for outgoing directions and it takes the form given in
private  int[] getDirectionArray(java.awt.geom.Point2D current, java.awt.geom.Point2D next, int[] directions)
          update a given direction array for the given points its indices are set to on for outgoing directions and it takes the form given in
 java.awt.geom.Point2D[] getNeighbouringUnits(java.awt.geom.Point2D p)
          Finds the four units around the given point.
private  java.awt.geom.Point2D getNextCoords(java.awt.geom.Point2D currentPoint, int[] directions)
          return the coordinates on the som grid for the next unit in the given direction
private  java.util.Hashtable<java.awt.geom.Point2D,java.lang.Integer> getUnitsWithStopsOnThemAndHowMany()
          Get a Hashtable of unit coordinates and the number of centres which lie on it.
protected  java.lang.String getVisualisationSpecificCacheKey(int currentVariant)
           
 java.awt.image.BufferedImage getVisualization(int index, GrowingSOM gsom, int width, int height)
          Returns the requested visualization image, either by retrieving it from the image cache, or by invoking AbstractBackgroundImageVisualizer.createVisualization(int, GrowingSOM, int, int) to create the image new.
 java.util.HashMap<java.lang.String,java.awt.image.BufferedImage> getVisualizationFlavours(int index, GrowingSOM gsom, int width, int height)
          Default implementation which returns a map of size 1 with the standard, unparameterised visualisation of the given variant.
 java.util.HashMap<java.lang.String,java.awt.image.BufferedImage> getVisualizationFlavours(int index, GrowingSOM gsom, int width, int height, int maxFlavours)
          Default implementation equal to AbstractBackgroundImageVisualizer.getVisualizationFlavours(int, GrowingSOM, int, int).
 java.util.HashMap<java.lang.String,java.awt.image.BufferedImage> getVisualizationFlavours(int index, GrowingSOM gsom, int width, int height, java.util.Map<java.lang.String,java.lang.String> flavourParameters)
          Default implementation equal to AbstractBackgroundImageVisualizer.getVisualizationFlavours(int, GrowingSOM, int, int).
private  float[][] initDashPatterns()
           
 void initNeighbourhoodLookup(GrowingSOM gsom)
           
private  void reInitVis()
           
 void setInputObjects(SharedSOMVisualisationData inputObjects)
          Implementing sub-classes shall override this method if they need to set some specific input object related information.
 void setSOMData(SOMInputReader reader)
          Implementing sub-classes shall override this method if they need to set some specific input-data related information.
private  java.awt.geom.Point2D[] snap(java.awt.geom.Point2D[] line, int xSize, int ySize)
          Returns a snapped line of the given line.
private  java.awt.geom.Point2D[] snapPoint(java.awt.geom.Point2D startPoint, java.awt.geom.Point2D[] line, int currentPosition, int direction, int xSize, int ySize, int bins)
          Snaps the next point on the line.
 
Methods inherited from class at.tuwien.ifs.somtoolbox.visualization.AbstractBackgroundImageVisualizer
buildCacheKey, checkNeededObjectsAvailable, checkVariantIndex, clearVisualisationCache, compareTo, createVisualization, drawBackground, escapeFileName, getCache, getCacheKey, getControlPanel, getDefaultVisualisationFileName, getDefaultVisualisationFileName, getHTMLVisualisationControl, getNumberOfVisualizations, getPreferredScaleFactor, getVariantException, getVisualizationDescription, getVisualizationDescriptions, getVisualizationName, getVisualizationNames, getVisualizationShortName, getVisualizationShortNames, invalidateCache, logImageCache, needsAdditionalFiles, setMap, setVisualizationUpdateListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATION_FILL_COLOUR

private static final java.awt.Color STATION_FILL_COLOUR

MIN_BINS

private static final int MIN_BINS
See Also:
Constant Field Values

MAX_BINS

private static final int MAX_BINS
See Also:
Constant Field Values

MAX_NUMBER_OF_LEGEND_ENTRIES

private static final int MAX_NUMBER_OF_LEGEND_ENTRIES
the attribute legend will have at most this many entries

See Also:
Constant Field Values

COMP_PREFIX

private static final java.lang.String COMP_PREFIX
See Also:
Constant Field Values

numberOfBins

private int numberOfBins

selectedComponentIndices

private int[] selectedComponentIndices

templateVector

private SOMLibTemplateVector templateVector

radius

private int radius

innerRadius

private int innerRadius

lineThickness

private int lineThickness

unitWidth

private int unitWidth

unitHeight

private int unitHeight

lineOffsetIsThisFractionOfRadius

private double lineOffsetIsThisFractionOfRadius

lineOffset

private double lineOffset

scale

double scale

dim

private int dim

selectionTargetNumberOfComponents

private int selectionTargetNumberOfComponents

selectionThreshold

private double selectionThreshold

aggregationTargetNumberOfComponents

private int aggregationTargetNumberOfComponents

aggregationSimilarity

private double aggregationSimilarity

aggregationMode

private MetroMapVisualizer.Mode aggregationMode

snapping

private boolean snapping

selectionMode

private MetroMapVisualizer.Mode selectionMode

lineDistanceFunction

protected DistanceFunctionType lineDistanceFunction

metroMapControlPanel

private MetroMapVisualizer.MetroMapControlPanel metroMapControlPanel

colorMap

protected final MetroColorMap colorMap

legendColumnNames

private static final java.lang.String[] legendColumnNames

overlayVisualisationComboBox

private javax.swing.JComboBox overlayVisualisationComboBox

clusterCache

private LeastRecentlyUsedCache<ClusterElementFunctions<ComponentLine2D>,WardClustering<ComponentLine2D>> clusterCache

COLORS

private static java.awt.Color[] COLORS

metroColorMap

private static final MetroColorMap metroColorMap

dashPatterns

public float[][] dashPatterns

lineThicknessFactors

public static float[] lineThicknessFactors

uMatrixVisualizer

private UMatrix uMatrixVisualizer

flowBorderlineVisualizer

private FlowBorderlineVisualizer flowBorderlineVisualizer

thematicClassMapVisualizer

private ThematicClassMapVisualizer thematicClassMapVisualizer

overlayVisualisation

private java.awt.image.BufferedImage overlayVisualisation

colourLegendTable1

private javax.swing.JTable colourLegendTable1

legendColumns

private double legendColumns

endIndexTable1

private int endIndexTable1

binCentres

protected java.awt.geom.Point2D[][] binCentres

unitsWithStopsOnThemAndHowMany

private java.util.Hashtable<java.awt.geom.Point2D,java.lang.Integer> unitsWithStopsOnThemAndHowMany

allDirections

private java.util.Hashtable<java.awt.geom.Point2D,int[]>[] allDirections

gsom

private GrowingSOM gsom

op

private java.awt.image.AffineTransformOp op

allSOMCoordinates

private java.awt.geom.Point2D[] allSOMCoordinates
Array of all points on the SOM .


allSOMCoordinatesSumValues

private double[] allSOMCoordinatesSumValues
Lookup-up matrix to check fast if two points are on a diagonal to each other. The table has the sum of the X & Y coordinates of each point. For a given unit, all units that are in the lower-left or upper-right diagonal will have the same value. As an example, for a 6x6 SOM, it would thus have values as follows:
               0  1  2  3  4  5  6
               1  2  3  4  5  6  7
               2  3  4  5  6  7  8
               3  4  5  6  7  8  9
               4  5  6  7  8  9 10
               5  6  7  8  9 10 11
               6  7  8  9 10 11 12
 


allSOMCoordinatesDiffValues

private double[] allSOMCoordinatesDiffValues
Similar matrix as allSOMCoordinatesSumValues, but containing the difference of the X&Y coordinates, for upper-left and lower-right diagonal units. As an example, for a 6x6 SOM, it would thus have values as follows:
                0   1   2   3   4   5   6
               -1   0   1   2   3   4   5
               -2  -1   0   1   2   3   4
               -3  -2  -1   0   1   2   3
               -4  -3  -2  -1   0   1   2
               -5  -4  -3  -2  -1   0   1
               -6  -5  -4  -3  -2  -1   0
 


clusters

private java.util.List<? extends Cluster<ComponentLine2D>> clusters

selectedComponents

private java.util.List<ComponentRegionCount> selectedComponents

binPalette

private Palette binPalette
Constructor Detail

MetroMapVisualizer

public MetroMapVisualizer()
Method Detail

getVisualization

public java.awt.image.BufferedImage getVisualization(int index,
                                                     GrowingSOM gsom,
                                                     int width,
                                                     int height)
                                              throws SOMToolboxException
Description copied from class: AbstractBackgroundImageVisualizer
Returns the requested visualization image, either by retrieving it from the image cache, or by invoking AbstractBackgroundImageVisualizer.createVisualization(int, GrowingSOM, int, int) to create the image new. Subclasses should not overwrite this method, unless they implement their own caching mechanism, or do not want any caching.

Specified by:
getVisualization in interface BackgroundImageVisualizer
Overrides:
getVisualization in class AbstractBackgroundImageVisualizer
Parameters:
index - the index of the variant to use
gsom - the GrowingSOM to take build the visualisation for
width - the desired width of the image, in pixels
height - the desired height of the image, in pixels
Returns:
an image for this visualisation
Throws:
SOMToolboxException - If there was an error creating the visualisation
See Also:
BackgroundImageVisualizer.getVisualization(int, at.tuwien.ifs.somtoolbox.models.GrowingSOM, int, int)

getVisualisationSpecificCacheKey

protected java.lang.String getVisualisationSpecificCacheKey(int currentVariant)
Overrides:
getVisualisationSpecificCacheKey in class AbstractBackgroundImageVisualizer

createVisualization

public java.awt.image.BufferedImage createVisualization(int index,
                                                        GrowingSOM gsom,
                                                        int width,
                                                        int height)
                                                 throws SOMToolboxException
Description copied from class: AbstractBackgroundImageVisualizer
Creates a visualisation image. Subclasses must implement this method.

Specified by:
createVisualization in class AbstractBackgroundImageVisualizer
Parameters:
index - the index of the variant to use
gsom - the GrowingSOM to take build the visualisation for
width - the desired width of the image, in pixels
height - the desired height of the image, in pixels.
Returns:
an image for this visualisation.
Throws:
SOMToolboxException

initNeighbourhoodLookup

public void initNeighbourhoodLookup(GrowingSOM gsom)

createMetromapImage

protected java.awt.image.BufferedImage createMetromapImage(int index,
                                                           GrowingSOM gsom,
                                                           int width,
                                                           int height)
                                                    throws SOMToolboxException
Will create the metro map image for the given params.

Throws:
SOMToolboxException

createMetromapImage

public java.awt.image.BufferedImage createMetromapImage(int index,
                                                        GrowingSOM gsom,
                                                        int width,
                                                        int height,
                                                        int component)

createOverlayVisualisation

private java.awt.image.BufferedImage createOverlayVisualisation(int width,
                                                                int height)
                                                         throws SOMToolboxException
Creates the selected overlay visualisation.

Parameters:
width - width of the overlay
height - of the overlay
Returns:
overlay image
Throws:
SOMToolboxException

colourUnits

private void colourUnits(java.awt.Graphics2D g,
                         int[][] binAssignment,
                         java.awt.Color[] binPalette)
Colours SOM units according to the given bin assignment.

Parameters:
g - thingy to draw on
binAssignment - assignment of single bins
binPalette - the palette to draw the bins with

drawLineAndStation

private void drawLineAndStation(java.awt.Graphics2D g,
                                int lineIndex)
Draw the line for the current line or component index. Note that this one's not snapped.

Parameters:
g - thingy to draw on
lineIndex - the line to draw

drawLine

private void drawLine(java.awt.Graphics2D g,
                      int lineIndex,
                      java.awt.geom.Point2D[][] binCentres)

createLayout

private void createLayout(java.awt.Graphics2D g,
                          GrowingLayer layer,
                          boolean drawLine)
Create the layout for the metro lines (not snapped). This method possibly colours the units of the SOM according to their bin assignments, that is if only one component or component group is selected.

Parameters:
g - piece of paper
layer - layer of the SOM
drawLine - colouring only or drawing the actual lines too (you always have a choice after all)

getAllDirections

private java.util.Hashtable<java.awt.geom.Point2D,int[]>[] getAllDirections()
Get a Hastable[] containing the per-dimension directions to draw on each unit of the som. This includes units not having a stop, i.e. this also handles long links across empty units (and if you think it's a mess now, you should've seen it earlier on).

Returns:
Hashtable[] containing the outgoing lines in each unit for all dimensions

getUnitsWithStopsOnThemAndHowMany

private java.util.Hashtable<java.awt.geom.Point2D,java.lang.Integer> getUnitsWithStopsOnThemAndHowMany()
Get a Hashtable of unit coordinates and the number of centres which lie on it.


getComponentsInDirection

private int[] getComponentsInDirection(java.awt.geom.Point2D currentSOMUnit,
                                       int i_direction)
Gets components which have links in the given direction.


createSnappedMetroLayout

private void createSnappedMetroLayout(java.awt.Graphics2D g,
                                      GrowingLayer layer)
Organises all metro drawing for snapped lines, i.e. the layouting for parallel lines.

Parameters:
g - thingy to draw on

createStations

private void createStations(java.awt.Graphics2D g)
Draw metro stations on top of existing maps. A metro station is drawn as a large ellipse with dark border. In contrast to normal stops which are drawn on the bin centres, stations are drawn whenever: 1) several bin centres are located on the same unit 2) lines that were parallel are not so anymore (merging of lines) 3) several lines have stops on the same unit

Parameters:
g - thingy to draw on

doSelection

private java.awt.geom.Point2D[][] doSelection(java.awt.geom.Point2D[][] binCentres,
                                              GrowingLayer layer)
                                       throws SOMToolboxException
Computes the line selection, returns the selected lines

Throws:
SOMToolboxException

doAggregation

private java.awt.geom.Point2D[][] doAggregation(java.util.ArrayList<ComponentLine2D> binCentresAsList,
                                                GrowingLayer layer)
                                         throws SOMToolboxException
Clustering of metro lines is done in here (i.e. aggregation step).

Returns:
new, aggregated bin centres
Throws:
SOMToolboxException

doSnapping

private java.awt.geom.Point2D[][] doSnapping(java.awt.geom.Point2D[][] binCentres,
                                             GrowingLayer layer)
                                      throws SOMToolboxException
Performs the snapping step, returns snapped lines

Throws:
SOMToolboxException

computeFinalComponentLines

private java.awt.geom.Point2D[][] computeFinalComponentLines(GrowingLayer layer)
                                                      throws SOMToolboxException
Performs the computation of the new bin centres, therefore component aggregation, selection as well as snapping are handled

Returns:
new Point[][] of bin centres
Throws:
SOMToolboxException

drawComponentLineSegment

private void drawComponentLineSegment(java.awt.geom.Point2D begin,
                                      java.awt.geom.Point2D end,
                                      java.awt.Graphics2D g,
                                      int component,
                                      boolean keepCurrentStroke)
Draws a line segment for the given component.

Parameters:
begin - begin coordinates
end - end coordinates
component - does it for a given component
keepCurrentStroke - whether or not to keep the current line stroke (and not modify it to use e.g. dashes, ...; used when for exporting small images)

getNextCoords

private java.awt.geom.Point2D getNextCoords(java.awt.geom.Point2D currentPoint,
                                            int[] directions)
return the coordinates on the som grid for the next unit in the given direction

Parameters:
currentPoint - start point
directions - directions to next point
Returns:
next point as directed to in directions

getDirection

private int getDirection(java.awt.geom.Point2D current,
                         java.awt.geom.Point2D next)
returns the direction between two nodes based on the following scheme: 0 7 left up up right up 1 \ | / 6 left - * - right 6 / | \ 5 left down down right down 3 4

Parameters:
current - current node
next - next node to go to
Returns:
dir from current to next

getDirectionArray

private int[] getDirectionArray(java.awt.geom.Point2D current,
                                java.awt.geom.Point2D next)
get a direction array for the given points its indices are set to on for outgoing directions and it takes the form given in

Parameters:
current - current node
next - next node
Returns:
array for outgoing lines (boolean in this case)
See Also:
getDirection(Point2D, Point2D)

getDirectionArray

private int[] getDirectionArray(java.awt.geom.Point2D current,
                                java.awt.geom.Point2D next,
                                int[] directions)
update a given direction array for the given points its indices are set to on for outgoing directions and it takes the form given in

Parameters:
current - current node
next - next node
directions - -
Returns:
array for outgoing lines (counts for outgoing directions this time)
See Also:
getDirection(Point2D, Point2D)

countOutgoingLines

private java.util.Hashtable<java.awt.geom.Point2D,int[]> countOutgoingLines(java.awt.geom.Point2D[] line,
                                                                            java.util.Hashtable<java.awt.geom.Point2D,int[]> outgoingLineTable)

snap

private java.awt.geom.Point2D[] snap(java.awt.geom.Point2D[] line,
                                     int xSize,
                                     int ySize)
Returns a snapped line of the given line. Snapping the metro lines means to find a line as similar as possible to the given line, which has all bin centres in the unit centres, and line segments are connected in multiples of 45° degree angles to each other.
TODO: Consider disallowing 135° / 315° as too sharp turns.


snapPoint

private java.awt.geom.Point2D[] snapPoint(java.awt.geom.Point2D startPoint,
                                          java.awt.geom.Point2D[] line,
                                          int currentPosition,
                                          int direction,
                                          int xSize,
                                          int ySize,
                                          int bins)
Snaps the next point on the line.

Parameters:
startPoint - the point to start from
line - the line to snap
currentPosition - the current position on the line
direction - forward (1) or backwards (-1)
xSize - x-size of the map
ySize - y-size of the map
bins - number of bins
Returns:
a snapped line

getComponentName

private java.lang.String getComponentName(int i)
VISUALISATION IMPROVEMENTS ***********************


getComponentNames

private java.lang.String[] getComponentNames()

reInitVis

private void reInitVis()

initDashPatterns

private float[][] initDashPatterns()

getColours

public java.awt.Color[] getColours(int components)

getColour

public java.awt.Color getColour(int component)

getNeighbouringUnits

public java.awt.geom.Point2D[] getNeighbouringUnits(java.awt.geom.Point2D p)
Finds the four units around the given point.


setInputObjects

public void setInputObjects(SharedSOMVisualisationData inputObjects)
Description copied from class: AbstractBackgroundImageVisualizer
Implementing sub-classes shall override this method if they need to set some specific input object related information.

Specified by:
setInputObjects in interface BackgroundImageVisualizer
Overrides:
setInputObjects in class AbstractBackgroundImageVisualizer
Parameters:
inputObjects - the new input objects
See Also:
SOMVisualisationData

setSOMData

public void setSOMData(SOMInputReader reader)
Description copied from class: AbstractBackgroundImageVisualizer
Implementing sub-classes shall override this method if they need to set some specific input-data related information.

Specified by:
setSOMData in interface BackgroundImageVisualizer
Overrides:
setSOMData in class AbstractBackgroundImageVisualizer
Parameters:
reader - the som input reader

getVisualizationFlavours

public java.util.HashMap<java.lang.String,java.awt.image.BufferedImage> getVisualizationFlavours(int index,
                                                                                                 GrowingSOM gsom,
                                                                                                 int width,
                                                                                                 int height)
                                                                                          throws SOMToolboxException
Description copied from class: AbstractBackgroundImageVisualizer
Default implementation which returns a map of size 1 with the standard, unparameterised visualisation of the given variant. Subclasses that want to return more flavours should override this method.

Specified by:
getVisualizationFlavours in interface BackgroundImageVisualizer
Overrides:
getVisualizationFlavours in class AbstractBackgroundImageVisualizer
Throws:
SOMToolboxException

getVisualizationFlavours

public java.util.HashMap<java.lang.String,java.awt.image.BufferedImage> getVisualizationFlavours(int index,
                                                                                                 GrowingSOM gsom,
                                                                                                 int width,
                                                                                                 int height,
                                                                                                 int maxFlavours)
                                                                                          throws SOMToolboxException
Description copied from class: AbstractBackgroundImageVisualizer
Default implementation equal to AbstractBackgroundImageVisualizer.getVisualizationFlavours(int, GrowingSOM, int, int).

Specified by:
getVisualizationFlavours in interface BackgroundImageVisualizer
Overrides:
getVisualizationFlavours in class AbstractBackgroundImageVisualizer
Throws:
SOMToolboxException

getVisualizationFlavours

public java.util.HashMap<java.lang.String,java.awt.image.BufferedImage> getVisualizationFlavours(int index,
                                                                                                 GrowingSOM gsom,
                                                                                                 int width,
                                                                                                 int height,
                                                                                                 java.util.Map<java.lang.String,java.lang.String> flavourParameters)
                                                                                          throws SOMToolboxException
Description copied from class: AbstractBackgroundImageVisualizer
Default implementation equal to AbstractBackgroundImageVisualizer.getVisualizationFlavours(int, GrowingSOM, int, int).

Specified by:
getVisualizationFlavours in interface BackgroundImageVisualizer
Overrides:
getVisualizationFlavours in class AbstractBackgroundImageVisualizer
Throws:
SOMToolboxException