simtools.shapes
Class AxisShape

java.lang.Object
  extended by simtools.shapes.AbstractShape
      extended by simtools.shapes.AxisShape
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable, java.lang.Cloneable, Resizable, NamedProperties

public class AxisShape
extends AbstractShape
implements java.io.Serializable, java.lang.Cloneable, Resizable

See Also:
Serialized Form

Nested Class Summary
static class AxisShape.AxePropertiesNames
           
 
Nested classes/interfaces inherited from class simtools.shapes.AbstractShape
AbstractShape.AbstractShapePropertiesNames
 
Field Summary
protected  java.awt.Color _color
           
protected static int _defaultTickLength
           
protected static int _defaultTickSpace
           
protected  java.awt.Font _font
           
protected  java.text.Format _format
           
protected  double[] _gridDoubleValues
          The double values, that contains the value of the ticks.
protected  double _gridOffset
           
protected  int[] _gridPos
           
protected  java.awt.Stroke _gridStroke
           
protected  LabelShape[] _gridValues
          The labelShape Array, that contains the tick.
protected  int _gridZeroIndex
           
protected  boolean _isVertical
           
protected  LabelShape _label
           
protected  int _labelLineHeight
           
protected  int _lineHeight
           
protected  int _lineWidth
           
protected  double _max
          axis maximum value
protected  double _min
          axis minimum value
protected  int _nbrLabelLines
           
protected  double _step
          axis grid step value
protected  boolean _valuesFirst
           
protected  boolean _withDashedGrid
           
protected  boolean _withGridlines
           
protected  boolean _withValues
           
protected static java.awt.Color gridColor
           
static boolean preferredDashedGrid
          the type of the line in the grid false : simple lines for the grid true : dashed lines for the grid
static boolean preferredShowGrid
          Indicate the presence of grids for the initialization
 
Fields inherited from class simtools.shapes.AbstractShape
_h, _ox, _oy, _propertyNames, _w, _x, _y, ANTI_ALIASING, currentDialogBox, FONT_NAMES, listeners, REFRESH_PERIOD
 
Constructor Summary
AxisShape(boolean isVertical, boolean valuesFirst, int ox, int oy, int width, int height)
           
 
Method Summary
protected  AbstractShape cloneShape()
          Performs a copy of the shape This method has to be overriden to deal with concrete shapes
protected  void computeBounds()
           
protected  double computeLogCeil(double upper)
          Returns the smallest (closest to negative infinity) double value that is not less than the argument, is equal to a mathematical integer and satisfying the condition that log base 10 of the value is an integer (i.e., the value returned will be a power of 10: 1, 10, 100, 1000, etc.).
protected  double computeLogFloor(double lower)
          Returns the largest (closest to positive infinity) double value that is not greater than the argument, is equal to a mathematical integer and satisfying the condition that log base 10 of the value is an integer (i.e., the value returned will be a power of 10: 1, 10, 100, 1000, etc.).
protected  double computeStep(double min, double max)
          Computes the "best" step to go from min to max Average number of graduations is set to 10 Algo from simgo/util/geom/WaveAxis.java
 void draw(java.awt.Graphics2D g2)
          Draws it
 int getLineHeight()
           
 int getLineWidth()
           
 double getMax()
          Gets the axis parameters
 double getMin()
          Gets the axis parameters
static java.lang.String getPrefix(java.lang.String id)
          Properties managment
 double getScale()
          Gets the axis scale factor
 double getStep()
          Gets the axis parameters
 boolean isLog()
           
 boolean isVertical()
           
 boolean isWithDashedGrid()
           
 boolean isWithGridlines()
           
 boolean isWithValues()
           
 void resize(int dx, int dy)
          Resizes the shape
 void set(double min, double max)
          Sets axis values.
 void set(double min, double max, double step)
          Sets axis values
 void setAnchor(int ox, int oy)
          Sets shape anchor
 void setColor(java.awt.Color c)
           
 void setFont(java.awt.Font f)
           
 void setFormat(java.text.Format f)
           
 void setLabel(java.lang.String s)
           
 void setLog(boolean _log)
          Method setLog
Summary:
This method set the axis logarithmic mode indicator.
 void setWithDashedGrid(boolean t)
           
 void setWithGridlines(boolean t)
           
 void setWithValues(boolean t)
           
 void translate(int dx, int dy)
          Translates the shape
 
Methods inherited from class simtools.shapes.AbstractShape
addListener, contains, contains, contains, contains, getAnchor, getBounds, getBounds2D, getInnerProperties, getMax, getMaxTranslated, getMin, getPathIterator, getPathIterator, getPropertyNames, getPropertyValue, intersects, intersects, notifyChange, notifyChange, refresh, removeListener, setAnchor, setProperties, setPropertyValue, wipeOff
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

preferredDashedGrid

public static boolean preferredDashedGrid
the type of the line in the grid false : simple lines for the grid true : dashed lines for the grid


preferredShowGrid

public static boolean preferredShowGrid
Indicate the presence of grids for the initialization


gridColor

protected static java.awt.Color gridColor

_defaultTickLength

protected static int _defaultTickLength

_defaultTickSpace

protected static int _defaultTickSpace

_isVertical

protected boolean _isVertical

_valuesFirst

protected boolean _valuesFirst

_withGridlines

protected boolean _withGridlines

_withValues

protected boolean _withValues

_font

protected java.awt.Font _font

_format

protected java.text.Format _format

_color

protected java.awt.Color _color

_label

protected LabelShape _label

_withDashedGrid

protected boolean _withDashedGrid

_gridStroke

protected transient java.awt.Stroke _gridStroke

_min

protected double _min
axis minimum value


_max

protected double _max
axis maximum value


_step

protected double _step
axis grid step value


_gridValues

protected LabelShape[] _gridValues
The labelShape Array, that contains the tick.


_gridDoubleValues

protected double[] _gridDoubleValues
The double values, that contains the value of the ticks.


_gridPos

protected int[] _gridPos

_gridZeroIndex

protected int _gridZeroIndex

_gridOffset

protected double _gridOffset

_lineWidth

protected int _lineWidth

_lineHeight

protected int _lineHeight

_nbrLabelLines

protected int _nbrLabelLines

_labelLineHeight

protected int _labelLineHeight
Constructor Detail

AxisShape

public AxisShape(boolean isVertical,
                 boolean valuesFirst,
                 int ox,
                 int oy,
                 int width,
                 int height)
Parameters:
ox - the anchor x position
oy - the anchor y position
length - the axis length excluding the space to display label and gridlines values
Method Detail

cloneShape

protected AbstractShape cloneShape()
Description copied from class: AbstractShape
Performs a copy of the shape This method has to be overriden to deal with concrete shapes

Overrides:
cloneShape in class AbstractShape
Returns:
a copy of the shape

setWithGridlines

public void setWithGridlines(boolean t)

isWithGridlines

public boolean isWithGridlines()

setWithDashedGrid

public void setWithDashedGrid(boolean t)

isWithDashedGrid

public boolean isWithDashedGrid()

setWithValues

public void setWithValues(boolean t)

isWithValues

public boolean isWithValues()

setLabel

public void setLabel(java.lang.String s)

setFont

public void setFont(java.awt.Font f)

setFormat

public void setFormat(java.text.Format f)

setColor

public void setColor(java.awt.Color c)

resize

public void resize(int dx,
                   int dy)
Resizes the shape

Specified by:
resize in interface Resizable
Parameters:
dx - value on x axis
dy - value on y axis

setAnchor

public void setAnchor(int ox,
                      int oy)
Sets shape anchor

Overrides:
setAnchor in class AbstractShape
Parameters:
p - the origin

translate

public void translate(int dx,
                      int dy)
Translates the shape

Overrides:
translate in class AbstractShape

set

public void set(double min,
                double max)
Sets axis values. Default step is computed automatically

Parameters:
min - the axis minimum value
max - the axis maximum value

set

public void set(double min,
                double max,
                double step)
Sets axis values

Parameters:
min - the axis minimum value
max - the axis maximum value
step - the step for gridlines
stepOffset - the offset between min value and fisrt step

getMin

public double getMin()
Gets the axis parameters

Returns:
minimum value

getMax

public double getMax()
Gets the axis parameters

Returns:
maximum value

getStep

public double getStep()
Gets the axis parameters

Returns:
step value

getScale

public double getScale()
Gets the axis scale factor

Returns:
scale value

draw

public void draw(java.awt.Graphics2D g2)
Draws it

Specified by:
draw in class AbstractShape
Parameters:
g2 - the current graphics

computeBounds

protected void computeBounds()

computeStep

protected double computeStep(double min,
                             double max)
Computes the "best" step to go from min to max Average number of graduations is set to 10 Algo from simgo/util/geom/WaveAxis.java


getLineHeight

public int getLineHeight()

getLineWidth

public int getLineWidth()

setLog

public void setLog(boolean _log)
Method setLog
Summary:
This method set the axis logarithmic mode indicator. Parameters:

Parameters:
logpx - True to put axis in logarithmic mode, or false otherwise.

isLog

public boolean isLog()
Returns:
true is axis logarithmic mode indicator is logarithmic mode

computeLogFloor

protected double computeLogFloor(double lower)
Returns the largest (closest to positive infinity) double value that is not greater than the argument, is equal to a mathematical integer and satisfying the condition that log base 10 of the value is an integer (i.e., the value returned will be a power of 10: 1, 10, 100, 1000, etc.).

Parameters:
lower - a double value below which a floor will be calcualted.
Returns:
10N with N .. { 1 ... }

computeLogCeil

protected double computeLogCeil(double upper)
Returns the smallest (closest to negative infinity) double value that is not less than the argument, is equal to a mathematical integer and satisfying the condition that log base 10 of the value is an integer (i.e., the value returned will be a power of 10: 1, 10, 100, 1000, etc.).

Parameters:
upper - a double value above which a ceiling will be calcualted.
Returns:
10N with N .. { 1 ... }

getPrefix

public static java.lang.String getPrefix(java.lang.String id)
Properties managment


isVertical

public boolean isVertical()