edu.swri.swiftvis.plot
Class AxisOptions

java.lang.Object
  extended by edu.swri.swiftvis.plot.AxisOptions
All Implemented Interfaces:
FillUser, FontUser, java.io.Serializable

public class AxisOptions
extends java.lang.Object
implements java.io.Serializable, FontUser, FillUser

This class puts all the options and drawing abilities for an axis in one place. It is used by both the primary and secondary axis classes.

See Also:
Serialized Form

Nested Class Summary
 class AxisOptions.AxisBounds
           
 
Field Summary
private  EditableBoolean autoMark
           
private  EditableBoolean autoMax
           
private  EditableBoolean autoMin
           
private  int axisLocation
           
private  int axisNum
           
private  java.util.Vector<DataPlotStyle> dataUsed
           
private  FillOptions fillOptions
           
private  FontOptions fontOptions
           
private static java.awt.font.FontRenderContext frc
           
static int HORIZONTAL_AXIS
           
static int INNER_MARK
           
private  EditableString label
           
static int LABEL_MARK
           
private  int labelLocation
           
private  java.awt.geom.Rectangle2D lastDrawBounds
           
private  EditableDouble markLength
           
private  EditableDouble markSpacing
           
private  int markStyle
           
private  EditableDouble max
           
static int MAX_SIDE
           
static int MIDDLE
           
private  EditableDouble min
           
static int MIN_SIDE
           
static int OUTER_MARK
           
private  PlotArea2D plotArea
           
private  javax.swing.JPanel propPanel
           
private static long serialVersionUID
           
private  EditableBoolean showLabel
           
static int VERTICAL_AXIS
           
 
Constructor Summary
AxisOptions(AxisOptions c, PlotArea2D pa)
           
AxisOptions(PlotArea2D pa, int an)
           
 
Method Summary
 void applyFill(FillOptions fo)
           
 void applyFont(FontOptions fo)
           
private  void autoMarkSpacingAction()
           
private  void autoMaxAction()
           
private  void autoMinAction()
           
 void drawAxis(java.awt.Graphics2D g, java.awt.geom.Rectangle2D bounds, AxisOptions.AxisBounds axisBounds, int dir, int current, int total, boolean showMax)
          Draws the axis in the bounds provided.
 void drawAxisLabel(java.awt.Graphics2D g, java.awt.geom.Rectangle2D bounds, AxisOptions.AxisBounds axisBounds, int dir)
          This draws just a label for this axis.
 AxisOptions.AxisBounds getAxisBounds()
          This returns the bounds for the entire area that the axis drawing will cover.
 int getAxisLocation()
           
 java.awt.geom.Rectangle2D getBoundingBox()
           
 double getMax()
           
 double getMin()
           
 javax.swing.JComponent getPropertiesPanel()
           
static void main(java.lang.String[] args)
           
private  void makeHorizontalMarks(java.awt.Graphics2D g, double start, double end, double x1, double x2, boolean writeLabel, boolean showMax)
           
private  void makeVerticalMarks(java.awt.Graphics2D g, double start, double end, double y1, double y2, boolean writeLabel, boolean showMax)
           
private  void markSpacingChanged()
           
private  void maxChanged()
           
private  void minChanged()
           
private  void setBounds()
           
 void setDataPlots(java.util.Vector<DataPlotStyle> data)
          This tells the axis what data will be plotted with it.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INNER_MARK

public static final int INNER_MARK
See Also:
Constant Field Values

OUTER_MARK

public static final int OUTER_MARK
See Also:
Constant Field Values

LABEL_MARK

public static final int LABEL_MARK
See Also:
Constant Field Values

MIDDLE

public static final int MIDDLE
See Also:
Constant Field Values

MIN_SIDE

public static final int MIN_SIDE
See Also:
Constant Field Values

MAX_SIDE

public static final int MAX_SIDE
See Also:
Constant Field Values

VERTICAL_AXIS

public static final int VERTICAL_AXIS
See Also:
Constant Field Values

HORIZONTAL_AXIS

public static final int HORIZONTAL_AXIS
See Also:
Constant Field Values

plotArea

private PlotArea2D plotArea

axisNum

private int axisNum

min

private EditableDouble min

max

private EditableDouble max

autoMin

private EditableBoolean autoMin

autoMax

private EditableBoolean autoMax

markSpacing

private EditableDouble markSpacing

autoMark

private EditableBoolean autoMark

markStyle

private int markStyle

markLength

private EditableDouble markLength

label

private EditableString label

showLabel

private EditableBoolean showLabel

labelLocation

private int labelLocation

axisLocation

private int axisLocation

fillOptions

private FillOptions fillOptions

fontOptions

private FontOptions fontOptions

frc

private static final java.awt.font.FontRenderContext frc

dataUsed

private transient java.util.Vector<DataPlotStyle> dataUsed

lastDrawBounds

private transient java.awt.geom.Rectangle2D lastDrawBounds

propPanel

private transient javax.swing.JPanel propPanel

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

AxisOptions

public AxisOptions(PlotArea2D pa,
                   int an)

AxisOptions

public AxisOptions(AxisOptions c,
                   PlotArea2D pa)
Method Detail

main

public static void main(java.lang.String[] args)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setDataPlots

public void setDataPlots(java.util.Vector<DataPlotStyle> data)
This tells the axis what data will be plotted with it. This is required because the data is no longer stored directly in the axis so that we get more flexibility.


getAxisLocation

public int getAxisLocation()

drawAxis

public void drawAxis(java.awt.Graphics2D g,
                     java.awt.geom.Rectangle2D bounds,
                     AxisOptions.AxisBounds axisBounds,
                     int dir,
                     int current,
                     int total,
                     boolean showMax)
Draws the axis in the bounds provided. The bounds that are provided should be for the plot area only. It should not include the leading or trailing parts, or the outside regions. The current and total variables are used to decide if the labels for this axis should really be drawn.

Parameters:
current - This is the current count row or column for this axis.
total - This is the total row or column count for this axis.
showMax - This tells the routine whether to label the max tick mark. Should be false if it adjoins.

drawAxisLabel

public void drawAxisLabel(java.awt.Graphics2D g,
                          java.awt.geom.Rectangle2D bounds,
                          AxisOptions.AxisBounds axisBounds,
                          int dir)
This draws just a label for this axis. This is done after the axis itself is drawn so that it is possible to implement label sharing. If I have several of the same axis options next to one another they don't need to be labeled differently.


getAxisBounds

public AxisOptions.AxisBounds getAxisBounds()
This returns the bounds for the entire area that the axis drawing will cover.


getMin

public double getMin()

getMax

public double getMax()

getPropertiesPanel

public javax.swing.JComponent getPropertiesPanel()

applyFont

public void applyFont(FontOptions fo)
Specified by:
applyFont in interface FontUser

applyFill

public void applyFill(FillOptions fo)
Specified by:
applyFill in interface FillUser

getBoundingBox

public java.awt.geom.Rectangle2D getBoundingBox()
Specified by:
getBoundingBox in interface FillUser

setBounds

private void setBounds()

makeHorizontalMarks

private void makeHorizontalMarks(java.awt.Graphics2D g,
                                 double start,
                                 double end,
                                 double x1,
                                 double x2,
                                 boolean writeLabel,
                                 boolean showMax)

makeVerticalMarks

private void makeVerticalMarks(java.awt.Graphics2D g,
                               double start,
                               double end,
                               double y1,
                               double y2,
                               boolean writeLabel,
                               boolean showMax)

autoMinAction

private void autoMinAction()

minChanged

private void minChanged()

autoMaxAction

private void autoMaxAction()

maxChanged

private void maxChanged()

autoMarkSpacingAction

private void autoMarkSpacingAction()

markSpacingChanged

private void markSpacingChanged()