gov.noaa.pmel.sgt
Class SpaceAxis

java.lang.Object
  extended by gov.noaa.pmel.sgt.Axis
      extended by gov.noaa.pmel.sgt.SpaceAxis
All Implemented Interfaces:
Selectable
Direct Known Subclasses:
LogAxis, PlainAxis

public abstract class SpaceAxis
extends Axis

Abstract base class for axes whose user coordinates are double values. The following is an example of using a PlainAxis.

 import gov.noaa.pmel.sgt.PlainAxis;
 import gov.noaa.pmel.sgt.LinearTransform;
 import gov.noaa.pmel.sgt.Graph;
 ...
 Graph graph;
 PlainAxis xbot, xtop;
 LinearTransform xt;
 Point2D.Double lowerleft = new Point2D.Double(10.0, 100.0);
 ...
 //
 // Instatiate xt and set it as the x transform.
 //
 xt = new LinearTransform(0.75, 3.5, 10.0, 100.0);
 graph.setXTransform(xt);
 ...
 //
 // Instatiate xbot and set its range, delta, and
 // location.  Set xbot the numberSmallTics property
 // for xbot.
 //
 xbot = new PlainAxis("Bottom Axis");
 xbot.setRangeU(new Range2D(10.0, 100.0));
 xbot.setDeltaU(20.0);
 xbot.setNumberSmallTics(4);
 xbot.setLocationU(lowerleft);
 //
 // Create title for xbot.
 //
 Font xbfont = new Font("Helvetica", Font.ITALIC, 14);
 xbot.setLabelFont(xbfont);
 SGLabel xtitle = new SGLabel("xaxis title",
                              "Test X-Axis Title",
                              new Point2D.Double(0.0, 0.0));
 Font xtfont = new Font("Helvetica", Font.PLAIN, 14);
 xtitle.setFont(xtfont);
 xtitle.setHeightP(0.2);
 xbot.setTitle(xtitle);
 graph.setXAxis(xbot);
 ...
 //
 // Instatiate xtop and set its range, delta, and
 // location.  Set xtop properties on ticPosition and
 // labelPosition.
 //
 xtop = new PlainAxis("Top Axis");
 xtop.setRangeU(new Range2D(10.0, 100.0));
 xtop.setDeltaU(20.0);
 xtop.setNumberSmallTics(0);
 xtop.setLocationU(new Point2D.Double(10.0, 300.0));
 xtop.setLabelFont(xbfont);
 xtop.setTicPosition(Axis.POSITIVE_SIDE);
 xtop.setLabelPosition(Axis.NO_LABEL);
 graph.setXAxis(xtop);
 ...
 //
 // Register the x transform and the top x axis with the bottom x axis.
 // By registering xt and xtop, any updates to the user or physical range
 // of xbot will be automatically performed on xt and xtop.
 //
 xbot.register(xt);
 xbot.register(xtop);
 

Since:
1.0
Version:
$Revision$, $Date$
Author:
Donald Denbo
See Also:
Axis, PlainAxis, TimeAxis

Field Summary
protected  TimePoint tLocation_
           
protected  Point2D.Double uLocation_
           
protected  Range2D uRange_
           
 
Fields inherited from class gov.noaa.pmel.sgt.Axis
AUTO, BOTH_SIDES, graph_, HORIZONTAL, labelColor_, labelFont_, labelFormat_, labelHeight_, labelInterval_, labelPosition_, largeTicHeight_, lineColor_, NEGATIVE_SIDE, NO_LABEL, numSmallTics_, orientation_, POSITIVE_SIDE, pRange_, registeredAxes_, registeredTransforms_, selectable_, selected_, sigDigits_, smallTicHeight_, space_, thickTicWidth_, ticPosition_, title_, VERTICAL, visible_
 
Constructor Summary
SpaceAxis()
          Default constructor for SpaceAxis.
SpaceAxis(java.lang.String id)
          Constructor for Axis.
 
Method Summary
protected  void drawSmallXTics(java.awt.Graphics g, double xu, double xtest, double del, double yp)
           
protected  void drawSmallYTics(java.awt.Graphics g, double xp, double yu, double ytest, double del)
           
abstract  java.awt.Rectangle getBounds()
          Get the bounding box for the axis in device units.
 double getDeltaU()
          Get the increment between large tics.
 java.lang.String getLabelFormat()
          Get the label format.
 int getLabelInterval()
          Get the label interval.
 Point2D.Double getLocationU()
          Get the origin in user units of the axis
 Range2D getRangeU()
          Get the user range.
 int getSignificantDigits()
          Get the number of significant digits in the label.
 SoTPoint getSoTLocationU()
          Get current axis location.
 SoTRange getSoTRangeU()
          Get user range.
 TimePoint getTimeLocationU()
          Get the origin in user units of the axis
 void modified(java.lang.String mess)
          Used internally by sgt.
 void setDeltaU(double delta)
          Set the increment between large tics.
 void setLabelFormat(java.lang.String frmt)
          Set the label format.
 void setLabelInterval(int lint)
          Set the label interval.
 void setLocationU(Point2D.Double upt)
          Set the origin in user units of the axis.
 void setLocationU(SoTPoint upt)
          Set the axis location.
 void setLocationU(TimePoint uptt)
          Set the origin in user units of the axis.
 void setRangeU(Range2D ur)
          Set the user range to draw the axis.
 void setRangeU(SoTRange ur)
          Set user range.
 void setSignificantDigits(int nsig)
          Set the number of significant digits in the label.
protected  void updateRegisteredAxes()
           
protected  void updateRegisteredTransforms()
           
 
Methods inherited from class gov.noaa.pmel.sgt.Axis
clear, clear, clearAllRegisteredAxes, clearAllRegisteredTransforms, copy, drawThickXTic, drawThickYTic, drawXTic, drawYTic, getGraph, getId, getLabelColor, getLabelFont, getLabelHeightP, getLabelPosition, getLargeTicHeightP, getLineColor, getNumberRegisteredAxes, getNumberRegisteredTransforms, getNumberSmallTics, getOrientation, getPane, getRangeP, getSmallTicHeightP, getThickTicWidthP, getTicPosition, getTitle, isSelectable, isSelected, isSpace, isTime, isVisible, register, register, setId, setLabelColor, setLabelFont, setLabelHeightP, setLabelPosition, setLargeTicHeightP, setLineColor, setNumberSmallTics, setOrientation, setRangeP, setSelectable, setSelected, setSmallTicHeightP, setThickTicWidthP, setTicPosition, setTitle, setVisible, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

uRange_

protected Range2D uRange_

uLocation_

protected Point2D.Double uLocation_

tLocation_

protected TimePoint tLocation_
Constructor Detail

SpaceAxis

public SpaceAxis()
Default constructor for SpaceAxis.


SpaceAxis

public SpaceAxis(java.lang.String id)
Constructor for Axis. Sets the axis identifier and initializes the defaults.

Parameters:
id - axis identification
Method Detail

updateRegisteredTransforms

protected void updateRegisteredTransforms()
Specified by:
updateRegisteredTransforms in class Axis

updateRegisteredAxes

protected void updateRegisteredAxes()
Specified by:
updateRegisteredAxes in class Axis

drawSmallXTics

protected void drawSmallXTics(java.awt.Graphics g,
                              double xu,
                              double xtest,
                              double del,
                              double yp)

drawSmallYTics

protected void drawSmallYTics(java.awt.Graphics g,
                              double xp,
                              double yu,
                              double ytest,
                              double del)

setSignificantDigits

public void setSignificantDigits(int nsig)
Set the number of significant digits in the label. This is used if a format is not specified.

Parameters:
nsig - number of significant digits

getSignificantDigits

public int getSignificantDigits()
Get the number of significant digits in the label.

Returns:
number of significant digits.

setLabelInterval

public void setLabelInterval(int lint)
Set the label interval.

Parameters:
lint - label interval.

getLabelInterval

public int getLabelInterval()
Get the label interval.

Returns:
label interval

setLabelFormat

public void setLabelFormat(java.lang.String frmt)
Set the label format. Format should be in the sprintf style. The formating uses the Format class in the Core Java book. A null or empty string will cause formating to use the significant digits.
 Gary Cornell and Cay S. Horstmann, Core Java (Book/CD-ROM)
 Published By SunSoft Press/Prentice-Hall
 Copyright (C) 1996 Sun Microsystems Inc.
 All Rights Reserved. ISBN 0-13-596891-7
 

Parameters:
frmt - label format.

getLabelFormat

public java.lang.String getLabelFormat()
Get the label format.

Returns:
label format

setRangeU

public void setRangeU(Range2D ur)
Set the user range to draw the axis. Registered Axes and AxisTransforms will be updated.

Parameters:
ur - range in user coordinates

setRangeU

public void setRangeU(SoTRange ur)
Description copied from class: Axis
Set user range.

Specified by:
setRangeU in class Axis

getRangeU

public Range2D getRangeU()
Get the user range.

Returns:
range in user coordinates

getSoTRangeU

public SoTRange getSoTRangeU()
Description copied from class: Axis
Get user range.

Specified by:
getSoTRangeU in class Axis

setDeltaU

public void setDeltaU(double delta)
Set the increment between large tics.

Parameters:
delta - increment in user coordinates

getDeltaU

public double getDeltaU()
Get the increment between large tics.

Returns:
user coordinate increment

setLocationU

public void setLocationU(TimePoint uptt)
Set the origin in user units of the axis.

Parameters:
upt - origin in user units

setLocationU

public void setLocationU(Point2D.Double upt)
Set the origin in user units of the axis.

Parameters:
upt - origin in user units

setLocationU

public void setLocationU(SoTPoint upt)
Description copied from class: Axis
Set the axis location.

Specified by:
setLocationU in class Axis

getLocationU

public Point2D.Double getLocationU()
Get the origin in user units of the axis

Returns:
origin

getTimeLocationU

public TimePoint getTimeLocationU()
Get the origin in user units of the axis

Returns:
origin

getSoTLocationU

public SoTPoint getSoTLocationU()
Description copied from class: Axis
Get current axis location.

Specified by:
getSoTLocationU in class Axis

getBounds

public abstract java.awt.Rectangle getBounds()
Get the bounding box for the axis in device units.

Specified by:
getBounds in interface Selectable
Specified by:
getBounds in class Axis
Returns:
bounding box
See Also:
Rectangle

modified

public void modified(java.lang.String mess)
Description copied from class: Axis
Used internally by sgt.

Overrides:
modified in class Axis