gov.noaa.pmel.sgt
Class Ruler

java.lang.Object
  extended by gov.noaa.pmel.sgt.Ruler
All Implemented Interfaces:
LayerChild, Selectable, java.lang.Cloneable

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

Description of Class Ruler

Since:
1.0
Version:
$Revision$, $Date$
Author:
Donald Denbo

Field Summary
static int BOTH_SIDES
          Draw the tics on both sides of the axes.
static int HORIZONTAL
          Orient Key horizontally.
protected  java.awt.Color labelColor_
           
protected  java.awt.Font labelFont_
           
protected  double labelHeight_
           
protected  int labelInterval_
           
protected  int labelPosition_
           
protected  double largeTicHeight_
           
protected  java.awt.Color lineColor_
           
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.
protected  int numSmallTics_
           
protected  Rectangle2D.Double pBounds_
           
static int POSITIVE_SIDE
          Place the label and/or tic on the positive side of the axis.
protected  int sigDigits_
           
protected  double smallTicHeight_
           
protected  int ticPosition_
           
protected  Range2D uRange_
           
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.
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)
           
protected  void drawXTic(java.awt.Graphics g, double xp, double yp, double ticHeight)
           
protected  void drawYTic(java.awt.Graphics g, double xp, double yp, double ticHeight)
           
 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.Color getLabelColor()
           
 java.awt.Font getLabelFont()
          Get the label font.
 java.lang.String getLabelFormat()
           
 double getLabelHeightP()
          Get the label height.
 int getLabelInterval()
           
 int getLabelPosition()
          Get the label position.
 double getLargeTicHeightP()
          Get the large tic height.
 Layer getLayer()
          Get the associated Layer.
 java.awt.Color getLineColor()
           
 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()
           
 int getSignificantDigits()
           
 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 setLabelColor(java.awt.Color labelColor)
           
 void setLabelFont(java.awt.Font fnt)
          Set the label font.
 void setLabelFormat(java.lang.String labelFormat)
           
 void setLabelHeightP(double lhgt)
          Set the label height in physical units.
 void setLabelInterval(int labelInterval)
           
 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 setLineColor(java.awt.Color lineColor)
           
 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 setSignificantDigits(int sigDigits)
           
 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.noaa.pmel.sgt.LayerChild
toString
 

Field Detail

uRange_

protected Range2D uRange_

pBounds_

protected Rectangle2D.Double pBounds_

numSmallTics_

protected int numSmallTics_

largeTicHeight_

protected double largeTicHeight_

smallTicHeight_

protected double smallTicHeight_

ticPosition_

protected int ticPosition_

labelPosition_

protected int labelPosition_

labelInterval_

protected int labelInterval_

labelFont_

protected java.awt.Font labelFont_

labelColor_

protected java.awt.Color labelColor_

lineColor_

protected java.awt.Color lineColor_

labelHeight_

protected double labelHeight_

sigDigits_

protected int sigDigits_

HORIZONTAL

public static final int HORIZONTAL
Orient Key horizontally.

See Also:
Constant Field Values

VERTICAL

public static final int VERTICAL
Orient Key vertically.

See Also:
Constant Field Values

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.

See Also:
Constant Field Values

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.

See Also:
Constant Field Values

NO_LABEL

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

See Also:
Constant Field Values

BOTH_SIDES

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

See Also:
Constant Field Values
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

drawXTic

protected void drawXTic(java.awt.Graphics g,
                        double xp,
                        double yp,
                        double ticHeight)

drawYTic

protected void drawYTic(java.awt.Graphics g,
                        double xp,
                        double yp,
                        double ticHeight)

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)

copy

public LayerChild copy()
Description copied from interface: LayerChild
Create a copy of the LayerChild.

Specified by:
copy in interface 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
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
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
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
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
Returns:
LayerChild identification.

setLayer

public void setLayer(Layer l)
Description copied from interface: LayerChild
Associate a Layer with the LayerChild.

Specified by:
setLayer in interface LayerChild
Parameters:
l - Parent layer.

getLayer

public Layer getLayer()
Description copied from interface: LayerChild
Get the associated Layer.

Specified by:
getLayer in interface 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.


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
Parameters:
g - Graphics context

isVisible

public boolean isVisible()
Description copied from interface: LayerChild
Check if LayerChild is visible.

Specified by:
isVisible in interface 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
Parameters:
visible - visible if true

getLabelInterval

public int getLabelInterval()
Since:
3.0

setLabelInterval

public void setLabelInterval(int labelInterval)
Since:
3.0

getSignificantDigits

public int getSignificantDigits()
Since:
3.0

setSignificantDigits

public void setSignificantDigits(int sigDigits)
Since:
3.0

getLabelFormat

public java.lang.String getLabelFormat()
Since:
3.0

setLabelFormat

public void setLabelFormat(java.lang.String labelFormat)
Since:
3.0

getLabelColor

public java.awt.Color getLabelColor()
Since:
3.0

setLabelColor

public void setLabelColor(java.awt.Color labelColor)
Since:
3.0

getLineColor

public java.awt.Color getLineColor()
Since:
3.0

setLineColor

public void setLineColor(java.awt.Color lineColor)
Since:
3.0