org.simBio.sim.analyzer.graph
Class Axis

java.lang.Object
  extended by org.simBio.core.Component
      extended by org.simBio.core.Parameter
          extended by org.simBio.core.Composite
              extended by org.simBio.core.Analyzer
                  extended by org.simBio.sim.analyzer.VisualizeAnalyzer
                      extended by org.simBio.sim.analyzer.graph.Axis
All Implemented Interfaces:
Node
Direct Known Subclasses:
AxisX, AxisY

public abstract class Axis
extends VisualizeAnalyzer

Coordinate axis base class

Version:
$Id: Axis.java,v 1.4 2007/04/07 08:44:07 nsarai Exp $
Author:
Misaki, C. Oka, N. Sarai

Field Summary
protected  int extendMode
          Action mode
protected  int extendModeDefault
          Default action mode
protected  double extendRateDefault
          When the calculation exceeds the range of the display, scroll or expand the range (standard value)
 double gridStep
           
protected  boolean isPlotLabel
          whether to display the label or not
protected  java.awt.Color labelColor
          axis label colour
protected  java.awt.Font labelFont
          axis label font
protected  boolean labelInitialized
          for label display
protected  double labelLength
          maximum length of the label string
 double labelStep
          label display interval
 double length
          origin location & Length (0.01mm)
protected static Log log
           
 double max
           
 double min
           
protected  int MODE_AUTOSCALE
          Action mode: autoscale mode
protected  int MODE_AUTOSCROLL
          Action mode: autoscroll mode
protected  int MODE_FIXED
          Action mode: fixed mode
protected  double nextLabelPos
          next display position of the label string
 double origin
          origin location & Length (0.01mm)
protected  java.lang.String patternString
          Label format string
protected  java.awt.Color titleColor
          title colour
protected  java.awt.Font titleFont
          title font
 
Fields inherited from class org.simBio.core.Parameter
value
 
Constructor Summary
Axis()
           
 
Method Summary
protected  void analyze(double t)
          Do nothing
 void doRepaint()
          Performs a repaint.
protected abstract  void drowDesc(java.awt.Graphics graphics, IPlot plot, java.lang.String str)
          Draws the axis label in graphics.
protected abstract  void drowGrid(java.awt.Graphics graphics, IPlot plot, double value)
          Draws a grid in graphics with a value at the specified position.
protected abstract  void drowLabel(java.awt.Graphics graphics, IPlot plot, double value, java.lang.String str)
          Draws the numerical value of the value parameter in graphics at the specified position.
 java.lang.String format(double val)
          Format numeric value, and return String. Please refer to prepare() for more information about the format.
abstract  java.lang.String getFormatString(double min, double max)
          Get default format string.
 int getFreeSpaceBottom(java.awt.Graphics graphics)
          Gets the space at the bottom of the screen for displaying the scale. Please override as necessary with a subclass.
 int getFreeSpaceLeft(java.awt.Graphics graphics)
          Gets the space on the left of the screen for displaying the scale. Please override as necessary with a concrete class.
 int getFreeSpaceRight(java.awt.Graphics graphics)
          Gets the space on the right of the screen for displaying the scale. Please override as necessary with a concrete class.
 int getFreeSpaceTop(java.awt.Graphics graphics)
          Gets the space at the top of the screen for displaying the scale. Please override as necessary with a subclass.
protected abstract  double getLabelLength(java.awt.Graphics graphics, java.lang.String str)
          Gets the length of the axis direction, when the numerical value is displayed. This result is used to control the display space of the label.
protected abstract  double getPos(double data, IPlot plot)
          Gets the coordinate axis from Plot.
protected static double Log10(double x)
          Calculates a base 10 logarithm
 void plotAxis(java.awt.Graphics2D graphics2d, IPlot plot)
          Draw the axis grid/label. Sets the interval appropriately, if gridStep is not yet set or below 0.
protected  void prepare()
          Set whether to display the plot label or not and set the pattern of the label number format. The display range formats up to single figures if it's below 0.1-10 decimal places ,if it's 10-1000,the integer region,apart from that,every 3 decimal places. To set a specific number value format, please define the pattern in xml, in the axis, with <component name="pattern" initial_value="#.#"/> etc. Please refer to DecimalFormat in the Javadoc for more information about the format.
 void prepareRepaint()
          When a region of a graph changes, this method is called before doRepaint().
protected  void setLinks()
          Set link to the Viewer to get scale factor later.
 
Methods inherited from class org.simBio.sim.analyzer.VisualizeAnalyzer
getColorParameter, getDouble, getFontParameter, getNodeHierarchically, getNodeRecursive, repaint, resetBuffer
 
Methods inherited from class org.simBio.core.Composite
accept, getLink, getNode, getNodesIterator, getNodesSize
 
Methods inherited from class org.simBio.core.Parameter
addValue, getValue, getValueString, setInitializer, setValue, setValueString, setValueToField
 
Methods inherited from class org.simBio.core.Component
addDydt, end, getIndent, getIndentedShortName, getName, getName, getParent, getRoot, getShortName, getUnits, isNamed, isPrefixed, logIndented, quit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.simBio.core.Node
addDydt, addValue, getValue, setValue
 

Field Detail

log

protected static Log log

MODE_FIXED

protected final int MODE_FIXED
Action mode: fixed mode

See Also:
Constant Field Values

MODE_AUTOSCROLL

protected final int MODE_AUTOSCROLL
Action mode: autoscroll mode

See Also:
Constant Field Values

MODE_AUTOSCALE

protected final int MODE_AUTOSCALE
Action mode: autoscale mode

See Also:
Constant Field Values

extendModeDefault

protected int extendModeDefault
Default action mode


extendMode

protected int extendMode
Action mode


extendRateDefault

protected double extendRateDefault
When the calculation exceeds the range of the display, scroll or expand the range (standard value)


origin

public double origin
origin location & Length (0.01mm)


length

public double length
origin location & Length (0.01mm)


gridStep

public double gridStep

min

public double min

max

public double max

labelFont

protected java.awt.Font labelFont
axis label font


labelColor

protected java.awt.Color labelColor
axis label colour


titleFont

protected java.awt.Font titleFont
title font


titleColor

protected java.awt.Color titleColor
title colour


labelStep

public double labelStep
label display interval


isPlotLabel

protected boolean isPlotLabel
whether to display the label or not


patternString

protected java.lang.String patternString
Label format string


labelLength

protected double labelLength
maximum length of the label string


nextLabelPos

protected double nextLabelPos
next display position of the label string


labelInitialized

protected boolean labelInitialized
for label display

Constructor Detail

Axis

public Axis()
Method Detail

setLinks

protected void setLinks()
Set link to the Viewer to get scale factor later.

Overrides:
setLinks in class Component
See Also:
Component.setLinks()

prepare

protected void prepare()
Set whether to display the plot label or not and set the pattern of the label number format. The display range formats up to single figures if it's below 0.1-10 decimal places ,if it's 10-1000,the integer region,apart from that,every 3 decimal places. To set a specific number value format, please define the pattern in xml, in the axis, with <component name="pattern" initial_value="#.#"/> etc. Please refer to DecimalFormat in the Javadoc for more information about the format.

Overrides:
prepare in class Parameter
See Also:
Component.prepare(), DecimalFormat

analyze

protected void analyze(double t)
Do nothing

Specified by:
analyze in class VisualizeAnalyzer
Parameters:
t - time
See Also:
Analyzer.analyze(double)

prepareRepaint

public void prepareRepaint()
When a region of a graph changes, this method is called before doRepaint(). It sets the decimal format, label and title colours, and the scalefactor for the graph.

Overrides:
prepareRepaint in class VisualizeAnalyzer
See Also:
VisualizeAnalyzer.prepareRepaint()

doRepaint

public void doRepaint()
Performs a repaint. It is called after prepareRepaint().

Overrides:
doRepaint in class VisualizeAnalyzer
See Also:
VisualizeAnalyzer.doRepaint()

getPos

protected abstract double getPos(double data,
                                 IPlot plot)
Gets the coordinate axis from Plot.

Parameters:
data - calculation value
plot - object that handles drawing
Returns:
screen coordinates

Log10

protected static double Log10(double x)
Calculates a base 10 logarithm

Parameters:
x - original value
Returns:
a base 10 logarithm result

format

public java.lang.String format(double val)
Format numeric value, and return String. Please refer to prepare() for more information about the format.

Parameters:
val - displayed value
Returns:
formatted value

getFormatString

public abstract java.lang.String getFormatString(double min,
                                                 double max)
Get default format string.

Parameters:
min - minimum scale value
max - maximum scale value
Returns:
format string

getFreeSpaceTop

public int getFreeSpaceTop(java.awt.Graphics graphics)
Gets the space at the top of the screen for displaying the scale. Please override as necessary with a subclass.

Parameters:
graphics - Graphics of the drawing target
Returns:
size

getFreeSpaceBottom

public int getFreeSpaceBottom(java.awt.Graphics graphics)
Gets the space at the bottom of the screen for displaying the scale. Please override as necessary with a subclass.

Parameters:
graphics - Graphics of the drawing target
Returns:
size

getFreeSpaceLeft

public int getFreeSpaceLeft(java.awt.Graphics graphics)
Gets the space on the left of the screen for displaying the scale. Please override as necessary with a concrete class.

Parameters:
graphics - Graphics of the drawing target
Returns:
size

getFreeSpaceRight

public int getFreeSpaceRight(java.awt.Graphics graphics)
Gets the space on the right of the screen for displaying the scale. Please override as necessary with a concrete class.

Parameters:
graphics - Graphics of the drawing object
Returns:
size

plotAxis

public void plotAxis(java.awt.Graphics2D graphics2d,
                     IPlot plot)
Draw the axis grid/label. Sets the interval appropriately, if gridStep is not yet set or below 0.

Parameters:
graphics2d - Graphics drawing object
plot - drawing handling object

getLabelLength

protected abstract double getLabelLength(java.awt.Graphics graphics,
                                         java.lang.String str)
Gets the length of the axis direction, when the numerical value is displayed. This result is used to control the display space of the label.

Parameters:
graphics - Graphics drawing object
str - display value

drowGrid

protected abstract void drowGrid(java.awt.Graphics graphics,
                                 IPlot plot,
                                 double value)
Draws a grid in graphics with a value at the specified position.

Parameters:
graphics - Graphics drawing object
plot - drawing operation object
value - calculation value

drowLabel

protected abstract void drowLabel(java.awt.Graphics graphics,
                                  IPlot plot,
                                  double value,
                                  java.lang.String str)
Draws the numerical value of the value parameter in graphics at the specified position.

Parameters:
graphics - Graphics drawing object
plot - drawing operation object
value - calculation value
str - display value

drowDesc

protected abstract void drowDesc(java.awt.Graphics graphics,
                                 IPlot plot,
                                 java.lang.String str)
Draws the axis label in graphics.

Parameters:
graphics - Graphics drawing object
plot - drawing operation object
str - display value


Copyright © 2002-2008 Cell/Biodinamics simulation project. All Rights Reserved.