visad.bom.annotations
Class LabelJ3D

java.lang.Object
  extended by visad.bom.annotations.LabelJ3D
All Implemented Interfaces:
ScreenAnnotation

public class LabelJ3D
extends Object
implements ScreenAnnotation

Meant to encapsulate information representing a label which is going to be rendered on a VisAD display without being subject to the usual VisAD transformations. Thus the label should stick in Screen Coordinates. Uses VisAD fonts. Java3D dependent only in needing Shape3D.


Constructor Summary
LabelJ3D(String text)
          It constructs a LabelJ3D with the given text at the origin, coloured white, left justified, horizontally aligned with no character rotation.
LabelJ3D(String text, int xLocation, int yLocation)
          It constructs a LabelJ3D with the given text at the specified location, coloured white, left justified, horizontally aligned with no character rotation.
LabelJ3D(String text, int xLocation, int yLocation, float[] colour, Font font, HersheyFont hfont, double zValue, double fontSizeInPixels, boolean filled, double thickness, double orientation, TextControl.Justification horizontalJustification, TextControl.Justification verticalJustification, double charRotation)
          Constructor for LabelJ3D.
LabelJ3D(String text, int xLocation, int yLocation, float[] colour, Font font, HersheyFont hfont, double zValue, double fontSizeInPixels, boolean filled, double thickness, TextControl.Justification horizontalJustification, TextControl.Justification verticalJustification)
          Constructor for a filled or unfilled font.
LabelJ3D(String text, int xLocation, int yLocation, float[] colour, Font font, HersheyFont hfont, double zValue, double fontSizeInPixels, TextControl.Justification horizontalJustification, TextControl.Justification verticalJustification)
          Constructor for a filled font.
 
Method Summary
 void setCharRotation(double charRotation)
          Set the amount each character is rotated.
 void setColour(float[] colour)
          Set the colour used for the text.
 void setFilled(boolean filled)
          Set the flag to control whether the text is filled or not.
 void setFont(Font font)
          Set the font to use for the text.
 void setFontSize(double fontSizeInPixels)
          Set the font size in pixels.
 void setHersheyFont(HersheyFont hfont)
          Set the Hershey font to use for the text.
 void setHorizontalJustification(TextControl.Justification justification)
          Set the horizontal justification of the text.
 void setLocation(int xLocation, int yLocation)
          Set the position on the screen at which the text is rendered.
 void setOrientation(double orientation)
          Set the orientation of the text (in degrees).
 void setText(String text)
          Set the text to render.
 void setThickness(double thickness)
          Set the line thickness for rendering the font.
 void setVerticalJustification(TextControl.Justification justification)
          Set the vertical justification of the text.
 void setZValue(double zValue)
          Set the virtual world z value.
 Object toDrawable(DisplayImpl display)
          Make the LabelJ3D into a Shape3D.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LabelJ3D

public LabelJ3D(String text)
It constructs a LabelJ3D with the given text at the origin, coloured white, left justified, horizontally aligned with no character rotation.

Parameters:
text - text of the LabelJ3D.

LabelJ3D

public LabelJ3D(String text,
                int xLocation,
                int yLocation)
It constructs a LabelJ3D with the given text at the specified location, coloured white, left justified, horizontally aligned with no character rotation.

Parameters:
text - text of the LabelJ3D.
xLocation - x position in screen coordinates.
yLocation - y position in screen coordinates.

LabelJ3D

public LabelJ3D(String text,
                int xLocation,
                int yLocation,
                float[] colour,
                Font font,
                HersheyFont hfont,
                double zValue,
                double fontSizeInPixels,
                TextControl.Justification horizontalJustification,
                TextControl.Justification verticalJustification)
Constructor for a filled font. It uses the java.awt.Font if it is not null, otherwise it will use the Hershey font. If both are null it will use the VisAD line font.

Parameters:
text - text of the LabelJ3D.
xLocation - x position in screen coordinates.
yLocation - y position in screen coordinates.
colour - red green blue triple; each value in [0.0, 1.0].
font - Font to use.
hfont - Hershey font to use; if both fonts are null then use the default VisAD line font.
zValue - Virtual world value; larger z is in front.
fontSizeInPixels - font size; by default characters are 12 pixels in size.
horizontalJustification - one of
  • TextControl.Justification.LEFT
  • TextControl.Justification.CENTER
  • TextControl.Justification.RIGHT
verticalJustification - one of
  • TextControl.Justification.BOTTOM
  • TextControl.Justification.CENTER
  • TextControl.Justification.TOP

LabelJ3D

public LabelJ3D(String text,
                int xLocation,
                int yLocation,
                float[] colour,
                Font font,
                HersheyFont hfont,
                double zValue,
                double fontSizeInPixels,
                boolean filled,
                double thickness,
                TextControl.Justification horizontalJustification,
                TextControl.Justification verticalJustification)
Constructor for a filled or unfilled font. It uses the java.awt.Font if it is not null otherwise it will use the Hershey font. If both are null it will use the VisAD line font.

Parameters:
text - text of the LabelJ3D.
xLocation - x position in screen coordinates.
yLocation - y position in screen coordinates.
colour - red green blue triple; each value in [0.0, 1.0].
font - java.awt.Font to use.
hfont - Hershey font to use; if both fonts are null then use the default VisAD line font.
zValue - Virtual world value; larger z is in front.
fontSizeInPixels - font size; by default characters are 12 pixels in size.
filled - if true the font is rendered as filled, if false just the triangles are drawn.
thickness - line width to use if just drawing triangles; usually 1.0 is the most useful.
horizontalJustification - one of
  • TextControl.Justification.LEFT
  • TextControl.Justification.CENTER
  • TextControl.Justification.RIGHT
verticalJustification - one of
  • TextControl.Justification.BOTTOM
  • TextControl.Justification.CENTER
  • TextControl.Justification.TOP

LabelJ3D

public LabelJ3D(String text,
                int xLocation,
                int yLocation,
                float[] colour,
                Font font,
                HersheyFont hfont,
                double zValue,
                double fontSizeInPixels,
                boolean filled,
                double thickness,
                double orientation,
                TextControl.Justification horizontalJustification,
                TextControl.Justification verticalJustification,
                double charRotation)
Constructor for LabelJ3D. It uses the Font if it is not null, otherwise it will use the Hershey font. If both are null it will use the VisAD line font.

Parameters:
text - text of the LabelJ3D.
xLocation - x position in screen coordinates.
yLocation - y position in screen coordinates.
colour - red green blue triple; each value in [0.0, 1.0].
font - Font to use.
hfont - Hershey font to use; if both fonts are null then use the default VisAD line font.
zValue - Virtual world value; larger z is in front.
fontSizeInPixels - font size; by default characters are 12 pixels in size.
filled - if true the font is rendered as filled, if false just the triangles are drawn.
thickness - line width to use if just drawing triangles; usually 1.0 is the most useful.
orientation - anticlockwise from x-axis in degrees.
horizontalJustification - one of
  • TextControl.Justification.LEFT
  • TextControl.Justification.CENTER
  • TextControl.Justification.RIGHT
    verticalJustification - one of
    • TextControl.Justification.BOTTOM
    • TextControl.Justification.CENTER
    • TextControl.Justification.TOP
    charRotation - rotate each character charRotation degrees clockwise from base line.
Method Detail

setText

public void setText(String text)
Set the text to render.

Parameters:
text - text of the LabelJ3D.

setLocation

public void setLocation(int xLocation,
                        int yLocation)
Set the position on the screen at which the text is rendered.

Parameters:
xLocation - x position in screen coordinates.
yLocation - y position in screen coordinates.

setColour

public void setColour(float[] colour)
Set the colour used for the text.

Parameters:
colour - red green blue triple; each value in [0.0, 1.0].

setFont

public void setFont(Font font)
Set the font to use for the text.

Parameters:
font - Font to use.

setHersheyFont

public void setHersheyFont(HersheyFont hfont)
Set the Hershey font to use for the text.

Parameters:
hfont - Hershey font to use; any java.awt.Font is ignored.

setZValue

public void setZValue(double zValue)
Set the virtual world z value.

Parameters:
zValue - Virtual world value; larger z is in front.

setFontSize

public void setFontSize(double fontSizeInPixels)
Set the font size in pixels.

Parameters:
fontSizeInPixels - font size; by default characters are 12 pixels in size.

setThickness

public void setThickness(double thickness)
Set the line thickness for rendering the font. Useful in unfilled text.

Parameters:
thickness - line width to use if just drawing triangles; usually 1.0 is the most useful.

setFilled

public void setFilled(boolean filled)
Set the flag to control whether the text is filled or not.

Parameters:
filled - if true the font is rendered as filled, if false just the triangles are drawn.

setOrientation

public void setOrientation(double orientation)
Set the orientation of the text (in degrees).

Parameters:
orientation - anticlockwise from x-axis in degrees.

setHorizontalJustification

public void setHorizontalJustification(TextControl.Justification justification)
Set the horizontal justification of the text.

Parameters:
justification - one of TextControl.Justification.LEFT TextControl.Justification.CENTER TextControl.Justification.RIGHT

setVerticalJustification

public void setVerticalJustification(TextControl.Justification justification)
Set the vertical justification of the text.

Parameters:
justification - one of TextControl.Justification.BOTTOM TextControl.Justification.CENTER TextControl.Justification.TOP

setCharRotation

public void setCharRotation(double charRotation)
Set the amount each character is rotated.

Parameters:
charRotation - rotate each character charRotation degrees clockwise from base line.

toDrawable

public Object toDrawable(DisplayImpl display)
                  throws VisADException
Make the LabelJ3D into a Shape3D.

Specified by:
toDrawable in interface ScreenAnnotation
Parameters:
display - the VisAD display for this Label.
Returns:
the LabelJ3D description as a Shape3D.
Throws:
VisADException - - VisAD couldn't make the geometry array.