zugvis
Class BarChartRenderer

java.lang.Object
  extended by prefuse.render.AbstractShapeRenderer
      extended by zugvis.BarChartRenderer
All Implemented Interfaces:
prefuse.render.Renderer

public class BarChartRenderer
extends prefuse.render.AbstractShapeRenderer

This is the renderer for both bar chart visualizations.


Field Summary
protected  boolean drawStations
          Flag if draw stations
protected  int m_barHeight
          Barheight
protected  java.awt.geom.RectangularShape m_bbox
          The holder for the currently computed bounding box
protected  java.lang.String m_delim
          Newline delimiter of text
protected  java.awt.Font m_font
          Font of labels
protected  int m_horizBorder
          Horizontal border of barchart
protected  java.lang.String m_stationFrom
          Stationname of fromstation fo label
protected  java.awt.Dimension m_stationFromDim
          Dimension of stationfromlabel
protected  java.lang.String m_stationFromField
          Fieldname of fromstation
protected  java.lang.String m_stationTo
          Stationname of tostation for label
protected  java.awt.Dimension m_stationToDim
          Dimension of stationtolabel
protected  java.lang.String m_stationToField
          Fieldname of tostation
protected  java.lang.String m_trainInfo
          Text of traininfo for label
protected  java.awt.Dimension m_trainInfoDim
          Dimension of traininfolabel
protected  java.lang.String m_trainInfoField
          Fieldname of the traininfo
protected  java.lang.String m_trainName
          Name of the train for label
protected  java.awt.Dimension m_trainNameDim
          Dimension of the trainnamelabel
protected  java.lang.String m_trainNameField
          Fieldname of trainnames
protected  int m_vertBorder
          Vertical border of barchart
protected  at.ac.tuwien.cs.timevis.FisheyeTimeScale timeScale
          Timescale of visualisation for calculating pixelposition for a dimension
 
Fields inherited from class prefuse.render.AbstractShapeRenderer
m_manageBounds, m_transform, RENDER_TYPE_DRAW, RENDER_TYPE_DRAW_AND_FILL, RENDER_TYPE_FILL, RENDER_TYPE_NONE
 
Fields inherited from interface prefuse.render.Renderer
DEFAULT_GRAPHICS
 
Constructor Summary
BarChartRenderer()
          Create a new LabelRenderer.
BarChartRenderer(java.lang.String trainNameField, java.lang.String trainInfoField, java.lang.String stationFromField, java.lang.String stationToField)
          Create a new BarChartRenderer.
 
Method Summary
 void DrawStations(boolean draw)
          This sets the drawstations flag.
 java.lang.String getDataField(java.lang.String fieldName)
          Get the text of a field
 int getHorizontalPadding()
          Returns the amount of padding in pixels between the content and the border of this item along the horizontal dimension.
protected  java.awt.Shape getRawShape(prefuse.visual.VisualItem item)
          Compute the boundingbos of the bar including textlabels
protected  java.lang.String getText(prefuse.visual.VisualItem item, java.lang.String dataField)
          Returns the text to draw.
 int getVerticalPadding()
          Returns the amount of padding in pixels between the content and the border of this item along the vertical dimension.
 void render(java.awt.Graphics2D g, prefuse.visual.VisualItem item)
          Renders the barchart (including labels if enough place)
 void setHorizontalPadding(int xpad)
          Sets the amount of padding in pixels between the content and the border of this item along the horizontal dimension.
 void setTimeScale(at.ac.tuwien.cs.timevis.FisheyeTimeScale _timeScale)
          Sets the timeScale
 void setVerticalPadding(int ypad)
          Sets the amount of padding in pixels between the content and the border of this item along the vertical dimension.
 
Methods inherited from class prefuse.render.AbstractShapeRenderer
drawShape, getRenderType, getShape, getStroke, getTransform, locatePoint, setBounds, setManageBounds, setRenderType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_delim

protected java.lang.String m_delim
Newline delimiter of text


m_horizBorder

protected int m_horizBorder
Horizontal border of barchart


m_vertBorder

protected int m_vertBorder
Vertical border of barchart


m_barHeight

protected int m_barHeight
Barheight


drawStations

protected boolean drawStations
Flag if draw stations


m_bbox

protected java.awt.geom.RectangularShape m_bbox
The holder for the currently computed bounding box


m_font

protected java.awt.Font m_font
Font of labels


m_trainNameField

protected java.lang.String m_trainNameField
Fieldname of trainnames


m_trainName

protected java.lang.String m_trainName
Name of the train for label


m_trainNameDim

protected java.awt.Dimension m_trainNameDim
Dimension of the trainnamelabel


m_trainInfoField

protected java.lang.String m_trainInfoField
Fieldname of the traininfo


m_trainInfo

protected java.lang.String m_trainInfo
Text of traininfo for label


m_trainInfoDim

protected java.awt.Dimension m_trainInfoDim
Dimension of traininfolabel


m_stationFromField

protected java.lang.String m_stationFromField
Fieldname of fromstation


m_stationFrom

protected java.lang.String m_stationFrom
Stationname of fromstation fo label


m_stationFromDim

protected java.awt.Dimension m_stationFromDim
Dimension of stationfromlabel


m_stationToField

protected java.lang.String m_stationToField
Fieldname of tostation


m_stationTo

protected java.lang.String m_stationTo
Stationname of tostation for label


m_stationToDim

protected java.awt.Dimension m_stationToDim
Dimension of stationtolabel


timeScale

protected at.ac.tuwien.cs.timevis.FisheyeTimeScale timeScale
Timescale of visualisation for calculating pixelposition for a dimension

Constructor Detail

BarChartRenderer

public BarChartRenderer()
Create a new LabelRenderer. By default the field "label" is used as the field name for looking up text, and no image is used.


BarChartRenderer

public BarChartRenderer(java.lang.String trainNameField,
                        java.lang.String trainInfoField,
                        java.lang.String stationFromField,
                        java.lang.String stationToField)
Create a new BarChartRenderer. Draws bars of connections and labels of the start- and endstation.

Parameters:
trainNameField - Fieldname of trainnames
trainInfoField - Fieldname of traininfos
stationFromField - Fieldname of startstationname
stationToField - Fieldname of endstationname
Method Detail

getDataField

public java.lang.String getDataField(java.lang.String fieldName)
Get the text of a field

Parameters:
fieldName - Name of the field
Returns:
The text of the field, or null if empty

DrawStations

public void DrawStations(boolean draw)
This sets the drawstations flag.

Parameters:
draw - If true stations of a connection will be drawn as small white lines.

getText

protected java.lang.String getText(prefuse.visual.VisualItem item,
                                   java.lang.String dataField)
Returns the text to draw. Subclasses can override this class to perform custom text selection.

Parameters:
dataField - Text of a specific datafield
item - the item to represent as a String
Returns:
a String to draw

getRawShape

protected java.awt.Shape getRawShape(prefuse.visual.VisualItem item)
Compute the boundingbos of the bar including textlabels

Specified by:
getRawShape in class prefuse.render.AbstractShapeRenderer
Parameters:
item - Visualitem to compute
Returns:
the shape with setted dimensions

render

public void render(java.awt.Graphics2D g,
                   prefuse.visual.VisualItem item)
Renders the barchart (including labels if enough place)

Specified by:
render in interface prefuse.render.Renderer
Overrides:
render in class prefuse.render.AbstractShapeRenderer
Parameters:
g - Graphics2D
item - Visualitem to draw

getHorizontalPadding

public int getHorizontalPadding()
Returns the amount of padding in pixels between the content and the border of this item along the horizontal dimension.

Returns:
the horizontal padding

setHorizontalPadding

public void setHorizontalPadding(int xpad)
Sets the amount of padding in pixels between the content and the border of this item along the horizontal dimension.

Parameters:
xpad - the horizontal padding to set

getVerticalPadding

public int getVerticalPadding()
Returns the amount of padding in pixels between the content and the border of this item along the vertical dimension.

Returns:
the vertical padding

setVerticalPadding

public void setVerticalPadding(int ypad)
Sets the amount of padding in pixels between the content and the border of this item along the vertical dimension.

Parameters:
ypad - the vertical padding

setTimeScale

public void setTimeScale(at.ac.tuwien.cs.timevis.FisheyeTimeScale _timeScale)
Sets the timeScale

Parameters:
_timeScale - the timeScale