gov.noaa.pmel.sgt
Class Ruler

java.lang.Object
  |
  +--gov.noaa.pmel.sgt.Ruler
All Implemented Interfaces:
java.lang.Cloneable, LayerChild, Selectable

public class Ruler
extends java.lang.Object
implements java.lang.Cloneable, LayerChild

Description of Class Ruler

Since:
1.0
Version:
$Revision: 1.13 $, $Date: 2001/02/09 01:13:51 $
Author:
Donald Denbo

Field Summary
static int BOTH_SIDES
          Draw the tics on both sides of the axes.
static int HORIZONTAL
          Orient Key horizontally.
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
          Orient Key vertically.
 
Constructor Summary
Ruler()
          Default constructor for Ruler.
Ruler(java.lang.String ident)
          Constructor for Ruler.
 
Method Summary
 LayerChild copy()
          Create a copy of the LayerChild.
 void draw(java.awt.Graphics g)
          Draw the LayerChild.
 java.awt.Rectangle getBounds()
          Get the bounding box for the axis in device units.
 Rectangle2D.Double getBoundsP()
          Get the bounding box for the axis in physical units.
 java.lang.String getId()
          Set the axis identifier.
 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.
 Layer getLayer()
          Get the associated Layer.
 int getNumberSmallTics()
          Get the number of small tics between large tics.
 int getOrientation()
          Get axis orientation
 AbstractPane getPane()
          Get AbstractPane of the LayerChild.
 Range2D getRangeU()
           
 double getSmallTicHeightP()
          Get the small tic height.
 int getTicPosition()
          Get the tic position.
 SGLabel getTitle()
          Get the axis title.
 boolean isSelectable()
          Returns true if the current state is selectable.
 boolean isSelected()
          Returns true if the object's selected property is set.
 boolean isVisible()
          Check if LayerChild is visible.
 void modified(java.lang.String mess)
          Used by sgt internally.
 void setBounds(int x, int y, int width, int height)
           
 void setBounds(java.awt.Rectangle r)
           
 void setBoundsP(Rectangle2D.Double bounds)
          Set the bounding box for the axis in physical units.
 void setId(java.lang.String id)
          Set the axis identifier.
 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.
 void setLayer(Layer l)
          Associate a Layer with the LayerChild.
 void setNumberSmallTics(int nstic)
          Set the number of small tics between large tics.
 void setOrientation(int orient)
          Set ruler orientation.
 void setRangeU(Range2D range)
          Change the user unit range of Ruler
 void setSelectable(boolean select)
          Set the Selectable property.
 void setSelected(boolean sel)
          Sets the selected property.
 void setSmallTicHeightP(double sthgt)
          Set the small tic height in physical units.
 void setTicPosition(int tpos)
          Set the tic position.
 void setTitle(SGLabel title)
          Set the axis title.
 void setVisible(boolean visible)
          Set visibility for a LayerChild.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.noaa.pmel.sgt.LayerChild
toString
 

Field Detail

HORIZONTAL

public static final int HORIZONTAL
Orient Key horizontally.

VERTICAL

public static final int VERTICAL
Orient Key vertically.

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.
Constructor Detail

Ruler

public Ruler()
Default constructor for Ruler.

Ruler

public Ruler(java.lang.String ident)
Constructor for Ruler. Sets the ruler identifier and initializes the defaults. Default values are:
   numberSmallTics = 0
   largeTicHeightP = 0.1
   smallTicHeightP = 0.05
       ticPosition = NEGATIVE_SIDE
     labelPosition = NEGATIVE_SIDE
     labelInterval = 2
         labelFont = Font("Helvetica", Font.ITALIC, 10);
      labelHeightP = 0.15
 significantDigits = 2;
       labelFormat = ""
             title = null
       orientation = HORIZONTAL
                Id = ""
 
Parameters:
id - axis identification
Method Detail

copy

public LayerChild copy()
Description copied from interface: LayerChild
Create a copy of the LayerChild.
Specified by:
copy in interface LayerChild
Following copied from interface: gov.noaa.pmel.sgt.LayerChild
Returns:
A copy of the LayerChild.

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()
Description copied from interface: Selectable
Returns true if the object's selected property is set.
Specified by:
isSelected in interface Selectable
Following copied from interface: gov.noaa.pmel.sgt.Selectable
Returns:
true if selected, false if not.

setSelectable

public void setSelectable(boolean select)
Description copied from interface: Selectable
Set the Selectable property.
Specified by:
setSelectable in interface Selectable
Following copied from interface: gov.noaa.pmel.sgt.Selectable
Parameters:
select - if true object is selectable

isSelectable

public boolean isSelectable()
Description copied from interface: Selectable
Returns true if the current state is selectable.
Specified by:
isSelectable in interface Selectable
Following copied from interface: gov.noaa.pmel.sgt.Selectable
Returns:
true if selectable

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.

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

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

setId

public void setId(java.lang.String id)
Set the axis identifier.
Specified by:
setId in interface LayerChild
Parameters:
id - identifier

getId

public java.lang.String getId()
Set the axis identifier.
Specified by:
getId in interface LayerChild
Parameters:
id - identifier

setLayer

public void setLayer(Layer l)
Description copied from interface: LayerChild
Associate a Layer with the LayerChild.
Specified by:
setLayer in interface LayerChild
Following copied from interface: gov.noaa.pmel.sgt.LayerChild
Parameters:
l - Parent layer.

getLayer

public Layer getLayer()
Description copied from interface: LayerChild
Get the associated Layer.
Specified by:
getLayer in interface LayerChild
Following copied from interface: gov.noaa.pmel.sgt.LayerChild
Returns:
Associated layer

getPane

public AbstractPane getPane()
Description copied from interface: LayerChild
Get AbstractPane of the LayerChild.
Specified by:
getPane in interface LayerChild

modified

public void modified(java.lang.String mess)
Description copied from interface: LayerChild
Used by sgt internally.
Specified by:
modified in interface LayerChild

setRangeU

public void setRangeU(Range2D range)
Change the user unit range of Ruler

getRangeU

public Range2D getRangeU()

setBoundsP

public void setBoundsP(Rectangle2D.Double bounds)
Set the bounding box for the axis in physical units.
Returns:
bounding box

getBoundsP

public Rectangle2D.Double getBoundsP()
Get the bounding box for the axis in physical units.
Returns:
bounding box

setOrientation

public void setOrientation(int orient)
Set ruler orientation. Allowed orientations are HORIZONATAL and VERTICAL.
Parameters:
or - orientation

getOrientation

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

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

getBounds

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

setBounds

public void setBounds(java.awt.Rectangle r)

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)

draw

public void draw(java.awt.Graphics g)
Description copied from interface: LayerChild
Draw the LayerChild.
Specified by:
draw in interface LayerChild
Following copied from interface: gov.noaa.pmel.sgt.LayerChild
Parameters:
g - Graphics context
Throws:
LayerNotFoundException - No layer is associated with the LayerChild.

isVisible

public boolean isVisible()
Description copied from interface: LayerChild
Check if LayerChild is visible.
Specified by:
isVisible in interface LayerChild
Following copied from interface: gov.noaa.pmel.sgt.LayerChild
Returns:
true if visible

setVisible

public void setVisible(boolean visible)
Description copied from interface: LayerChild
Set visibility for a LayerChild.
Specified by:
setVisible in interface LayerChild
Following copied from interface: gov.noaa.pmel.sgt.LayerChild
Parameters:
visible - visible if true


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