|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.tuwien.ifs.somtoolbox.visualization.AbstractBackgroundImageVisualizer
at.tuwien.ifs.somtoolbox.visualization.MetroMapVisualizer
public class MetroMapVisualizer
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 |
Fields inherited from class at.tuwien.ifs.somtoolbox.visualization.AbstractBackgroundImageVisualizer |
---|
cache, CACHE_KEY_SECTION_SEPARATOR, CACHE_KEY_SEPARATOR, contourInterpolationMode, contourMode, controlPanel, currentZDimSlice, inputObjects, interpolate, 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 |
---|
DEFAULT_BACKGROUND_VISUALIZATION_SCALE |
Constructor Summary | |
---|---|
MetroMapVisualizer()
|
Method Summary | |
---|---|
private void |
colourUnits(Graphics2D g,
int[][] binAssignment,
Color[] binPalette)
Colours SOM units according to the given bin assignment. |
private Point2D[][] |
computeFinalComponentLines(GrowingLayer layer)
Performs the computation of the new bin centres, therefore component aggregation, selection as well as snapping are handled |
private Hashtable<Point2D,int[]> |
countOutgoingLines(Point2D[] line,
Hashtable<Point2D,int[]> outgoingLineTable)
|
private void |
createLayout(Graphics2D g,
GrowingLayer layer,
boolean drawLine)
Create the layout for the metro lines (not snapped). |
protected BufferedImage |
createMetromapImage(int index,
GrowingSOM gsom,
int width,
int height)
Will create the metro map image for the given params. |
BufferedImage |
createMetromapImage(int index,
GrowingSOM gsom,
int width,
int height,
int component)
|
private BufferedImage |
createOverlayVisualisation(int width,
int height)
Creates the selected overlay visualisation. |
private void |
createSnappedMetroLayout(Graphics2D g,
GrowingLayer layer)
Organises all metro drawing for snapped lines, i.e. |
private void |
createStations(Graphics2D g)
Draw metro stations on top of existing maps. |
BufferedImage |
createVisualization(int index,
GrowingSOM gsom,
int width,
int height)
Creates a visualisation image. |
private Point2D[][] |
doAggregation(ArrayList<ComponentLine2D> binCentresAsList,
GrowingLayer layer)
Clustering of metro lines is done in here (i.e. |
private Point2D[][] |
doSelection(Point2D[][] binCentres,
GrowingLayer layer)
Computes the line selection, returns the selected lines |
private Point2D[][] |
doSnapping(Point2D[][] binCentres,
GrowingLayer layer)
Performs the snapping step, returns snapped lines |
private void |
drawComponentLineSegment(Point2D begin,
Point2D end,
Graphics2D g,
int component,
boolean keepCurrentStroke)
Draws a line segment for the given component. |
private void |
drawLine(Graphics2D g,
int lineIndex,
Point2D[][] binCentres)
|
private void |
drawLineAndStation(Graphics2D g,
int lineIndex)
Draw the line for the current line or component index. |
private Hashtable<Point2D,int[]>[] |
getAllDirections()
Get a Hastable[] containing the per-dimension directions to draw on each unit of the som. |
protected String |
getCacheKey(GrowingSOM gsom,
int index,
int width,
int height)
The key of a cache is created as follows: VisualisationShortName + Hashcode of the SOM + Width + Height + Opacity. Sub-classes might add more information to the cache, if needed. |
Color |
getColour(int component)
|
Color[] |
getColours(int components)
|
private String |
getComponentName(int i)
VISUALISATION IMPROVEMENTS *********************** |
private String[] |
getComponentNames()
|
private int[] |
getComponentsInDirection(Point2D currentSOMUnit,
int i_direction)
Gets components which have links in the given direction. |
private int |
getDirection(Point2D current,
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(Point2D current,
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(Point2D current,
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 |
Point2D[] |
getNeighbouringUnits(Point2D p)
Finds the four units around the given point. |
private Point2D |
getNextCoords(Point2D currentPoint,
int[] directions)
return the coordinates on the som grid for the next unit in the given direction |
private Hashtable<Point2D,Integer> |
getUnitsWithStopsOnThemAndHowMany()
Get a Hashtable of unit coordinates and the number of centres which lie on it. |
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. |
HashMap<String,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. |
HashMap<String,BufferedImage> |
getVisualizationFlavours(int index,
GrowingSOM gsom,
int width,
int height,
int maxFlavours)
Default implementation equal to AbstractBackgroundImageVisualizer.getVisualizationFlavours(int, GrowingSOM, int, int) . |
HashMap<String,BufferedImage> |
getVisualizationFlavours(int index,
GrowingSOM gsom,
int width,
int height,
Map<String,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 Point2D[] |
snap(Point2D[] line,
int xSize,
int ySize)
Returns a snapped line of the given line. |
private Point2D[] |
snapPoint(Point2D startPoint,
Point2D[] line,
int currentPosition,
int direction,
int xSize,
int ySize,
int bins)
Snaps the next point on the line. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Color STATION_FILL_COLOUR
private static final int MIN_BINS
private static final int MAX_BINS
private static final int MAX_NUMBER_OF_LEGEND_ENTRIES
private static final String COMP_PREFIX
private int numberOfBins
private int[] selectedComponentIndices
private SOMLibTemplateVector templateVector
private int radius
private int innerRadius
private int lineThickness
private int unitWidth
private int unitHeight
private double lineOffsetIsThisFractionOfRadius
private double lineOffset
double scale
private int dim
private int selectionTargetNumberOfComponents
private double selectionThreshold
private int aggregationTargetNumberOfComponents
private double aggregationSimilarity
private MetroMapVisualizer.Mode aggregationMode
private boolean snapping
private MetroMapVisualizer.Mode selectionMode
protected DistanceFunctionType lineDistanceFunction
private MetroMapVisualizer.MetroMapControlPanel metroMapControlPanel
protected final MetroColorMap colorMap
private static final String[] legendColumnNames
private JComboBox overlayVisualisationComboBox
private LeastRecentlyUsedCache<ClusterElementFunctions<ComponentLine2D>,WardClustering<ComponentLine2D>> clusterCache
private static Color[] COLORS
private static final MetroColorMap metroColorMap
public float[][] dashPatterns
public static float[] lineThicknessFactors
private UMatrix uMatrixVisualizer
private FlowBorderlineVisualizer flowBorderlineVisualizer
private ThematicClassMapVisualizer thematicClassMapVisualizer
private BufferedImage overlayVisualisation
private JTable colourLegendTable1
private double legendColumns
private int endIndexTable1
protected Point2D[][] binCentres
private Hashtable<Point2D,Integer> unitsWithStopsOnThemAndHowMany
private Hashtable<Point2D,int[]>[] allDirections
private GrowingSOM gsom
private AffineTransformOp op
private Point2D[] allSOMCoordinates
private double[] allSOMCoordinatesSumValues
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
private double[] allSOMCoordinatesDiffValues
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
private List<? extends Cluster<ComponentLine2D>> clusters
private List<ComponentRegionCount> selectedComponents
private Palette binPalette
Constructor Detail |
---|
public MetroMapVisualizer()
Method Detail |
---|
public BufferedImage getVisualization(int index, GrowingSOM gsom, int width, int height) throws SOMToolboxException
AbstractBackgroundImageVisualizer
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.
getVisualization
in interface BackgroundImageVisualizer
getVisualization
in class AbstractBackgroundImageVisualizer
index
- the index of the variant to usegsom
- the GrowingSOM to take build the visualisation forwidth
- the desired width of the image, in pixelsheight
- the desired height of the image, in pixels
SOMToolboxException
- If there was an error creating the visualisationBackgroundImageVisualizer.getVisualization(int,
at.tuwien.ifs.somtoolbox.models.GrowingSOM, int, int)
protected String getCacheKey(GrowingSOM gsom, int index, int width, int height)
AbstractBackgroundImageVisualizer
getCacheKey
in class AbstractBackgroundImageVisualizer
public BufferedImage createVisualization(int index, GrowingSOM gsom, int width, int height) throws SOMToolboxException
AbstractBackgroundImageVisualizer
createVisualization
in class AbstractBackgroundImageVisualizer
index
- the index of the variant to usegsom
- the GrowingSOM to take build the visualisation forwidth
- the desired width of the image, in pixelsheight
- the desired height of the image, in pixels.
SOMToolboxException
public void initNeighbourhoodLookup(GrowingSOM gsom)
protected BufferedImage createMetromapImage(int index, GrowingSOM gsom, int width, int height) throws SOMToolboxException
SOMToolboxException
public BufferedImage createMetromapImage(int index, GrowingSOM gsom, int width, int height, int component)
private BufferedImage createOverlayVisualisation(int width, int height) throws SOMToolboxException
width
- width of the overlayheight
- of the overlay
SOMToolboxException
private void colourUnits(Graphics2D g, int[][] binAssignment, Color[] binPalette)
g
- thingy to draw onbinAssignment
- assignment of single binsbinPalette
- the palette to draw the bins withprivate void drawLineAndStation(Graphics2D g, int lineIndex)
g
- thingy to draw onlineIndex
- the line to drawprivate void drawLine(Graphics2D g, int lineIndex, Point2D[][] binCentres)
private void createLayout(Graphics2D g, GrowingLayer layer, boolean drawLine)
g
- piece of paperlayer
- layer of the SOMdrawLine
- colouring only or drawing the actual lines too (you always have a choice after all)private Hashtable<Point2D,int[]>[] getAllDirections()
private Hashtable<Point2D,Integer> getUnitsWithStopsOnThemAndHowMany()
private int[] getComponentsInDirection(Point2D currentSOMUnit, int i_direction)
private void createSnappedMetroLayout(Graphics2D g, GrowingLayer layer)
g
- thingy to draw onprivate void createStations(Graphics2D g)
g
- thingy to draw onprivate Point2D[][] doSelection(Point2D[][] binCentres, GrowingLayer layer) throws SOMToolboxException
SOMToolboxException
private Point2D[][] doAggregation(ArrayList<ComponentLine2D> binCentresAsList, GrowingLayer layer) throws SOMToolboxException
SOMToolboxException
private Point2D[][] doSnapping(Point2D[][] binCentres, GrowingLayer layer) throws SOMToolboxException
SOMToolboxException
private Point2D[][] computeFinalComponentLines(GrowingLayer layer) throws SOMToolboxException
SOMToolboxException
private void drawComponentLineSegment(Point2D begin, Point2D end, Graphics2D g, int component, boolean keepCurrentStroke)
begin
- begin coordinatesend
- end coordinatescomponent
- does it for a given componentkeepCurrentStroke
- whether or not to keep the current line stroke (and not modify it to use e.g. dashes,
...; used when for exporting small images)private Point2D getNextCoords(Point2D currentPoint, int[] directions)
currentPoint
- start pointdirections
- directions to next point
private int getDirection(Point2D current, Point2D next)
current
- current nodenext
- next node to go to
private int[] getDirectionArray(Point2D current, Point2D next)
current
- current nodenext
- next node
getDirection(Point2D, Point2D)
private int[] getDirectionArray(Point2D current, Point2D next, int[] directions)
current
- current nodenext
- next nodedirections
- -
getDirection(Point2D, Point2D)
private Hashtable<Point2D,int[]> countOutgoingLines(Point2D[] line, Hashtable<Point2D,int[]> outgoingLineTable)
private Point2D[] snap(Point2D[] line, int xSize, int ySize)
private Point2D[] snapPoint(Point2D startPoint, Point2D[] line, int currentPosition, int direction, int xSize, int ySize, int bins)
startPoint
- the point to start fromline
- the line to snapcurrentPosition
- the current position on the linedirection
- forward (1) or backwards (-1)xSize
- x-size of the mapySize
- y-size of the mapbins
- number of bins
private String getComponentName(int i)
private String[] getComponentNames()
private void reInitVis()
private float[][] initDashPatterns()
public Color[] getColours(int components)
public Color getColour(int component)
public Point2D[] getNeighbouringUnits(Point2D p)
public void setInputObjects(SharedSOMVisualisationData inputObjects)
AbstractBackgroundImageVisualizer
setInputObjects
in interface BackgroundImageVisualizer
setInputObjects
in class AbstractBackgroundImageVisualizer
inputObjects
- the new input objectsSOMVisualisationData
public void setSOMData(SOMInputReader reader)
AbstractBackgroundImageVisualizer
setSOMData
in interface BackgroundImageVisualizer
setSOMData
in class AbstractBackgroundImageVisualizer
reader
- the som input readerpublic HashMap<String,BufferedImage> getVisualizationFlavours(int index, GrowingSOM gsom, int width, int height) throws SOMToolboxException
AbstractBackgroundImageVisualizer
getVisualizationFlavours
in interface BackgroundImageVisualizer
getVisualizationFlavours
in class AbstractBackgroundImageVisualizer
SOMToolboxException
public HashMap<String,BufferedImage> getVisualizationFlavours(int index, GrowingSOM gsom, int width, int height, int maxFlavours) throws SOMToolboxException
AbstractBackgroundImageVisualizer
AbstractBackgroundImageVisualizer.getVisualizationFlavours(int, GrowingSOM, int, int)
.
getVisualizationFlavours
in interface BackgroundImageVisualizer
getVisualizationFlavours
in class AbstractBackgroundImageVisualizer
SOMToolboxException
public HashMap<String,BufferedImage> getVisualizationFlavours(int index, GrowingSOM gsom, int width, int height, Map<String,String> flavourParameters) throws SOMToolboxException
AbstractBackgroundImageVisualizer
AbstractBackgroundImageVisualizer.getVisualizationFlavours(int, GrowingSOM, int, int)
.
getVisualizationFlavours
in interface BackgroundImageVisualizer
getVisualizationFlavours
in class AbstractBackgroundImageVisualizer
SOMToolboxException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |