gov.noaa.pmel.sgt
Interface LabelDrawer

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
LabelDrawer1, LabelDrawer2

public interface LabelDrawer
extends java.io.Serializable

Defines the methods that implement label drawing in sgt. This interface is necessary since sgt v2.0 will use Java2D functionality to draw labels if it is available.

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

Method Summary
 void draw(java.awt.Graphics g)
          Used internally by sgt.
 double getAngle()
          Get label drawing angle.
 java.awt.Rectangle getBounds()
          Get the label bounds in device units.
 Rectangle2D.Double getBoundsP()
          Get the label reference location in physcial coordinates.
 java.awt.Color getColor()
          Get the color.
 java.awt.Font getFont()
          Get the font.
 int getHAlign()
          Get the horizontal alignment.
 double getHeightP()
          Get the label height in physical coordinates.
 Layer getLayer()
          Get the layer.
 java.awt.Point getLocation()
          Get the label position in device coordinates.
 Point2D.Double getLocationP()
          Get the label reference location in physcial coordinates.
 int getOrientation()
          Get the origentation.
 float getStringHeight(java.awt.Graphics g)
          Get the string height in device units.
 float getStringWidth(java.awt.Graphics g)
          Get the string width in device units.
 java.lang.String getText()
          Get the label text.
 int getVAlign()
          Get the vertical alignment.
 boolean isVisible()
          Is label visible?
 void setAngle(double angle)
          Draw label at arbitrary rotation.
 void setBounds(int x, int y, int width, int height)
          Set the label bounds in device units.
 void setColor(java.awt.Color clr)
          Set the color.
 void setFont(java.awt.Font font)
          Set the font.
 void setHAlign(int halign)
          Set the horizontal alignment.
 void setHeightP(double hgt)
          Set the height of the label in physical coordinates.
 void setLayer(Layer layer)
          Used internally by sgt.
 void setLocation(java.awt.Point loc)
          Set the label position in device coordinates.
 void setLocationP(Point2D.Double loc)
          Set the label reference location in physcial coordinates.
 void setOrientation(int orient)
          Set the orientation.
 void setText(java.lang.String lbl)
          Set the label text.
 void setVAlign(int valign)
          Set the vertical alignment.
 void setVisible(boolean vis)
          Set visibility of label.
 

Method Detail

draw

void draw(java.awt.Graphics g)
          throws LayerNotFoundException
Used internally by sgt.

Throws:
LayerNotFoundException

setText

void setText(java.lang.String lbl)
Set the label text.

Parameters:
lbl - the label text

getText

java.lang.String getText()
Get the label text.

Returns:
the label text

getColor

java.awt.Color getColor()
Get the color.

Returns:
The current color of the label.

setColor

void setColor(java.awt.Color clr)
Set the color.

Parameters:
color - The color of the label.
See Also:
Color

setFont

void setFont(java.awt.Font font)
Set the font.

Parameters:
fnt - The Font to use to draw the label.
See Also:
Font

getFont

java.awt.Font getFont()
Get the font.

Returns:
The current font for the label.

setLayer

void setLayer(Layer layer)
Used internally by sgt.


getLayer

Layer getLayer()
Get the layer.

Returns:
the layer object.

setOrientation

void setOrientation(int orient)
Set the orientation. The orientation can be HORIZONTAL or VERTICAL.

Parameters:
orient - The orientation.

getOrientation

int getOrientation()
Get the origentation.

Returns:
the orientation

setHAlign

void setHAlign(int halign)
Set the horizontal alignment. The alignment can be LEFT, CENTER, or RIGHT.

Parameters:
horz - The horizontal alignment.

getHAlign

int getHAlign()
Get the horizontal alignment.

Returns:
the horizontal alignment.

setVAlign

void setVAlign(int valign)
Set the vertical alignment. The alignment can be TOP, MIDDLE, or BOTTOM.

Parameters:
vert - The vertical alignment.

getVAlign

int getVAlign()
Get the vertical alignment.

Returns:
the vertical alignment.

setLocation

void setLocation(java.awt.Point loc)
Set the label position in device coordinates.

Parameters:
loc - label position

getLocation

java.awt.Point getLocation()
Get the label position in device coordinates.

Returns:
the label position

setBounds

void setBounds(int x,
               int y,
               int width,
               int height)
Set the label bounds in device units.

Parameters:
x - x location of label
y - y location of label
width - label width
height - label height

getBounds

java.awt.Rectangle getBounds()
Get the label bounds in device units.

Returns:
the label bounds

setLocationP

void setLocationP(Point2D.Double loc)
Set the label reference location in physcial coordinates.

Parameters:
loc - physical location of label

getLocationP

Point2D.Double getLocationP()
Get the label reference location in physcial coordinates.

Returns:
the labels position.

getBoundsP

Rectangle2D.Double getBoundsP()
Get the label reference location in physcial coordinates.

Returns:
the labels position.

setAngle

void setAngle(double angle)
Draw label at arbitrary rotation. Warning: Rotated labels are not drawn very well when using JDK1.1. For best results use JDK1.2 or newer.


getAngle

double getAngle()
Get label drawing angle.


setHeightP

void setHeightP(double hgt)
Set the height of the label in physical coordinates.

Parameters:
hgt - The label height.

getHeightP

double getHeightP()
Get the label height in physical coordinates.

Returns:
The label height.

setVisible

void setVisible(boolean vis)
Set visibility of label.


isVisible

boolean isVisible()
Is label visible?


getStringWidth

float getStringWidth(java.awt.Graphics g)
Get the string width in device units.


getStringHeight

float getStringHeight(java.awt.Graphics g)
Get the string height in device units.