gov.noaa.pmel.sgt
Class Axis

java.lang.Object
  |
  +--gov.noaa.pmel.sgt.Axis
All Implemented Interfaces:
Selectable
Direct Known Subclasses:
SpaceAxis, TimeAxis

public abstract class Axis
extends java.lang.Object
implements Selectable

Abstract base class for Cartesian axes. Cartesian axes are designed to be used with the CartesianGraph class. Axes and AxisTransforms can be registed with an Axis. This allows changes in both the physical range and user range to be immediatedly updated for the registered AxisTransforms and axes.

Cartesian axes can have their user coordinates be double values or time (as GeoDate objects). These have been separated into two child objects.

Since:
1.0
Version:
$Revision: 1.18 $, $Date: 2001/04/03 18:41:03 $
Author:
Donald Denbo
See Also:
SpaceAxis, TimeAxis

Field Summary
static int BOTH_SIDES
          Draw the tics on both sides of the axes.
static int HORIZONTAL
          Draw a horizontal axis.
static int NEGATIVE_SIDE
          Place the label and/or tic on the negative side of the axis.
static int NO_LABEL
          Do not draw a label and/or tic.
static int POSITIVE_SIDE
          Place the label and/or tic on the positive side of the axis.
static int VERTICAL
          Draw a vertical axis.
 
Constructor Summary
Axis()
          Default constructor for Axis.
Axis(java.lang.String id)
          Constructor for Axis.
 
Method Summary
 void clear(Axis axis)
          Unregister an axis.
 void clear(AxisTransform trns)
          Unregister an AxisTransform.
 void clearAllRegisteredAxes()
          Unregister all axes.
 void clearAllRegisteredTransforms()
          Unregister all AxisTransforms.
abstract  Axis copy()
          Create a copy of the axis.
abstract  java.awt.Rectangle getBounds()
          Get the bounding box for the axis in device units.
 CartesianGraph getGraph()
          Get the Graph associated with the axis.
 java.lang.String getId()
          Get the axis identifier.
 java.awt.Color getLabelColor()
          Get the label color.
 java.awt.Font getLabelFont()
          Get the label font.
 double getLabelHeightP()
          Get the label height.
 int getLabelPosition()
          Get the label position.
 double getLargeTicHeightP()
          Get the large tic height.
 int getNumberRegisteredAxes()
          Get the number of currently registered axes.
 int getNumberRegisteredTransforms()
          Get the number of currently registered transforms.
 int getNumberSmallTics()
          Get the number of small tics between large tics.
 int getOrientation()
          Get axis orientation
 AbstractPane getPane()
          Get the parent pane.
 Range2D getRangeP()
          Get the physical range.
 double getSmallTicHeightP()
          Get the small tic height.
abstract  SoTPoint getSoTLocationU()
          Get current axis location.
abstract  SoTRange getSoTRangeU()
          Get user range.
 double getThickTicWidthP()
          Get the thick tic width.
 int getTicPosition()
          Get the tic position.
 SGLabel getTitle()
          Get the axis title.
 boolean isSelectable()
          Determines if the axis is selectable.
 boolean isSelected()
          Determines if the axis has been selected.
 boolean isSpace()
          Tests if axis is space.
 boolean isTime()
          Tests if axis is time.
 boolean isVisible()
          Determines if the axis is visible.
 void modified(java.lang.String mess)
          Used internally by sgt.
 void register(Axis axis)
          Register an axis.
 void register(AxisTransform trns)
          Register an AxisTransform.
 void setId(java.lang.String id)
          Set the axis identifier.
 void setLabelColor(java.awt.Color color)
          Set the label color.
 void setLabelFont(java.awt.Font fnt)
          Set the label font.
 void setLabelHeightP(double lhgt)
          Set the label height in physical units.
 void setLabelPosition(int labp)
          Set the label position.
 void setLargeTicHeightP(double lthgt)
          Set the large tic height in physical units.
abstract  void setLocationU(SoTPoint pt)
          Set the axis location.
 void setNumberSmallTics(int nstic)
          Set the number of small tics between large tics.
 void setRangeP(Range2D pr)
          Set the physical range.
abstract  void setRangeU(SoTRange range)
          Set user range.
 void setSelectable(boolean select)
          Set the selectable state.
 void setSelected(boolean sel)
          Sets the selected property.
 void setSmallTicHeightP(double sthgt)
          Set the small tic height in physical units.
 void setThickTicWidthP(double wid)
          Set the thick tic width in physical units.
 void setTicPosition(int tpos)
          Set the tic position.
 void setTitle(SGLabel title)
          Set the axis title.
 void setVisible(boolean visible)
          Set the visibility state.
 java.lang.String toString()
          Get a String representation of the Axis.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

POSITIVE_SIDE

public static final int POSITIVE_SIDE
Place the label and/or tic on the positive side of the axis. The right side of VERTICAL axes and the top of HORIZONTAL axes.

NEGATIVE_SIDE

public static final int NEGATIVE_SIDE
Place the label and/or tic on the negative side of the axis. The left side of VERTICAL axes and the bottom of HORIZONTAL axes.

NO_LABEL

public static final int NO_LABEL
Do not draw a label and/or tic.

BOTH_SIDES

public static final int BOTH_SIDES
Draw the tics on both sides of the axes.

HORIZONTAL

public static final int HORIZONTAL
Draw a horizontal axis.

VERTICAL

public static final int VERTICAL
Draw a vertical axis.
Constructor Detail

Axis

public Axis()
Default constructor for Axis.

Axis

public Axis(java.lang.String id)
Constructor for Axis. Sets the axis identifier and initializes the defaults. Default values are:
    numberSmallTics = 0
    largeTicHeightP = 0.1
    smallTicHeightP = 0.05
     thickTicWidth_ = 0.025
        ticPosition = NEGATIVE_SIDE
      labelPosition = NEGATIVE_SIDE
      labelInterval = 2
          labelFont = Font("Helvetica", Font.ITALIC, 10);
         labelColor = Color.black;
       labelHeightP = 0.15
  significantDigits = 2;
        labelFormat = ""
              title = null
        orientation = HORIZONTAL
         selectable = true
            visible = true
  
Parameters:
id - axis identifier
Method Detail

copy

public abstract Axis copy()
Create a copy of the axis.
Returns:
the copy

getGraph

public CartesianGraph getGraph()
Get the Graph associated with the axis.
Returns:
Graph object.

getPane

public AbstractPane getPane()
Get the parent pane.
Since:
2.0

modified

public void modified(java.lang.String mess)
Used internally by sgt.
Since:
2.0

register

public void register(Axis axis)
Register an axis. Registered axes will be notified of changes to the user coordinate range.
Parameters:
axis - An Axis object.

register

public void register(AxisTransform trns)
Register an AxisTransform. Registered AxisTransforms will be notified of changes to the user coordinate range and physical coordinate range.
Parameters:
trns - A AxisTransform object.

clear

public void clear(Axis axis)
Unregister an axis. Axis will no longer be notified of changes in the user range.
Parameters:
axis - An Axis object.

clear

public void clear(AxisTransform trns)
Unregister an AxisTransform. The AxisTransform will no longer be notified of changes to the user or physical coordinate range.
Parameters:
trns - A AxisTransform ojbect.

clearAllRegisteredAxes

public void clearAllRegisteredAxes()
Unregister all axes. No axes will be notified of changes in the user range.

clearAllRegisteredTransforms

public void clearAllRegisteredTransforms()
Unregister all AxisTransforms. No AxisTransforms will be notified of changes in the user of physical range.

getNumberRegisteredTransforms

public int getNumberRegisteredTransforms()
Get the number of currently registered transforms.
Returns:
number of registered transforms

getNumberRegisteredAxes

public int getNumberRegisteredAxes()
Get the number of currently registered axes.
Returns:
number of registered axes

setLargeTicHeightP

public void setLargeTicHeightP(double lthgt)
Set the large tic height in physical units.
Parameters:
lthgt - large tic height.

getLargeTicHeightP

public double getLargeTicHeightP()
Get the large tic height.
Returns:
large tic height in physcial units.

setNumberSmallTics

public void setNumberSmallTics(int nstic)
Set the number of small tics between large tics.
Parameters:
nstic - number of small tics.

getNumberSmallTics

public int getNumberSmallTics()
Get the number of small tics between large tics.
Returns:
number of small tics.

setSmallTicHeightP

public void setSmallTicHeightP(double sthgt)
Set the small tic height in physical units.
Parameters:
sthgt - small tic height.

getSmallTicHeightP

public double getSmallTicHeightP()
Get the small tic height.
Returns:
small tic height in physical units.

setThickTicWidthP

public void setThickTicWidthP(double wid)
Set the thick tic width in physical units. Minimum thickness is 3 pixels.
Parameters:
wid - thick tic width.

getThickTicWidthP

public double getThickTicWidthP()
Get the thick tic width.
Returns:
thick tic width in physical units.

setTicPosition

public void setTicPosition(int tpos)
Set the tic position. Tic position can be POSITIVE_SIDE, NEGATIVE_SIDE, or BOTH_SIDES.
Parameters:
tpos - tic position

getTicPosition

public int getTicPosition()
Get the tic position.
Returns:
tic position

setLabelPosition

public void setLabelPosition(int labp)
Set the label position. Label position can be POSITIVE_SIDE, NEGATIVE_SIDE, and NO_LABEL.
Parameters:
lapb - label position.

getLabelPosition

public int getLabelPosition()
Get the label position.
Returns:
label position

setLabelFont

public void setLabelFont(java.awt.Font fnt)
Set the label font.
Parameters:
fnt - label font

getLabelFont

public java.awt.Font getLabelFont()
Get the label font.
Returns:
label font

setLabelColor

public void setLabelColor(java.awt.Color color)
Set the label color.
Since:
2.0

getLabelColor

public java.awt.Color getLabelColor()
Get the label color.
Returns:
color
Since:
2.0

setLabelHeightP

public void setLabelHeightP(double lhgt)
Set the label height in physical units.
Parameters:
lhgt - label height.

getLabelHeightP

public double getLabelHeightP()
Get the label height.
Returns:
label height

setTitle

public void setTitle(SGLabel title)
Set the axis title.
Parameters:
title - axis title

getTitle

public SGLabel getTitle()
Get the axis title.
Returns:
axis title

setRangeP

public void setRangeP(Range2D pr)
Set the physical range. This method updates any registered Transforms. If no Transforms are registered, the setRangeP method has no effect.
Parameters:
pr - physcial range

getRangeP

public Range2D getRangeP()
Get the physical range. Obtains the physical range from the associated CartesianGraph object and attached Transform.
Returns:
physical range

setId

public void setId(java.lang.String id)
Set the axis identifier.
Parameters:
id - identifier

getId

public java.lang.String getId()
Get the axis identifier.
Returns:
identifier

getOrientation

public int getOrientation()
Get axis orientation
Returns:
axis orientation

isSpace

public boolean isSpace()
Tests if axis is space.
Returns:
true if space

isTime

public boolean isTime()
Tests if axis is time.
Returns:
true if time

getBounds

public abstract java.awt.Rectangle getBounds()
Get the bounding box for the axis in device units.
Specified by:
getBounds in interface Selectable
Returns:
bounding box

toString

public java.lang.String toString()
Get a String representation of the Axis.
Overrides:
toString in class java.lang.Object
Returns:
String representation

setSelected

public void setSelected(boolean sel)
Description copied from interface: Selectable
Sets the selected property.
Specified by:
setSelected in interface Selectable
Following copied from interface: gov.noaa.pmel.sgt.Selectable
Parameters:
sel - true if selected, false if not.

isSelected

public boolean isSelected()
Determines if the axis has been selected.
Specified by:
isSelected in interface Selectable
Since:
2.0

setSelectable

public void setSelectable(boolean select)
Set the selectable state.
Specified by:
setSelectable in interface Selectable
Since:
2.0

isSelectable

public boolean isSelectable()
Determines if the axis is selectable.
Specified by:
isSelectable in interface Selectable
Since:
2.0

isVisible

public boolean isVisible()
Determines if the axis is visible.
Since:
2.0

setVisible

public void setVisible(boolean visible)
Set the visibility state.
Since:
2.0

setLocationU

public abstract void setLocationU(SoTPoint pt)
Set the axis location.
Since:
2.0

getSoTLocationU

public abstract SoTPoint getSoTLocationU()
Get current axis location.
Since:
2.0

setRangeU

public abstract void setRangeU(SoTRange range)
Set user range.
Since:
2.0

getSoTRangeU

public abstract SoTRange getSoTRangeU()
Get user range.
Since:
2.0


Send comments about the Scientific Graphics toolkit to dwd@pmel.noaa.gov. For more information about Java Development in the EPIC Group see the EPIC Software Page
Generated on December 13 2001