visad.bom.annotations
Class LabelJ3D
- java.lang.Object
-
- visad.bom.annotations.LabelJ3D
-
- All Implemented Interfaces:
- ScreenAnnotation
public class LabelJ3D extends java.lang.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
Constructors Constructor and Description LabelJ3D(java.lang.String text)It constructs a LabelJ3D with the given text at the origin, coloured white, left justified, horizontally aligned with no character rotation.LabelJ3D(java.lang.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(java.lang.String text, int xLocation, int yLocation, float[] colour, java.awt.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(java.lang.String text, int xLocation, int yLocation, float[] colour, java.awt.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(java.lang.String text, int xLocation, int yLocation, float[] colour, java.awt.Font font, HersheyFont hfont, double zValue, double fontSizeInPixels, TextControl.Justification horizontalJustification, TextControl.Justification verticalJustification)Constructor for a filled font.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidsetCharRotation(double charRotation)Set the amount each character is rotated.voidsetColour(float[] colour)Set the colour used for the text.voidsetFilled(boolean filled)Set the flag to control whether the text is filled or not.voidsetFont(java.awt.Font font)Set the font to use for the text.voidsetFontSize(double fontSizeInPixels)Set the font size in pixels.voidsetHersheyFont(HersheyFont hfont)Set the Hershey font to use for the text.voidsetHorizontalJustification(TextControl.Justification justification)Set the horizontal justification of the text.voidsetLocation(int xLocation, int yLocation)Set the position on the screen at which the text is rendered.voidsetOrientation(double orientation)Set the orientation of the text (in degrees).voidsetText(java.lang.String text)Set the text to render.voidsetThickness(double thickness)Set the line thickness for rendering the font.voidsetVerticalJustification(TextControl.Justification justification)Set the vertical justification of the text.voidsetZValue(double zValue)Set the virtual world z value.java.lang.ObjecttoDrawable(DisplayImpl display)Make the LabelJ3D into aShape3D.
-
-
-
Constructor Detail
-
LabelJ3D
public LabelJ3D(java.lang.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(java.lang.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(java.lang.String text, int xLocation, int yLocation, float[] colour, java.awt.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-Fontto 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(java.lang.String text, int xLocation, int yLocation, float[] colour, java.awt.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- iftruethe font is rendered as filled, iffalsejust 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(java.lang.String text, int xLocation, int yLocation, float[] colour, java.awt.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 theFontif 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-Fontto 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- iftruethe font is rendered as filled, iffalsejust 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 charactercharRotationdegrees clockwise from base line.
-
-
Method Detail
-
setText
public void setText(java.lang.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(java.awt.Font font)
Set the font to use for the text.- Parameters:
font-Fontto 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- iftruethe font is rendered as filled, iffalsejust 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 charactercharRotationdegrees clockwise from base line.
-
toDrawable
public java.lang.Object toDrawable(DisplayImpl display) throws VisADException
Make the LabelJ3D into aShape3D.- Specified by:
toDrawablein interfaceScreenAnnotation- Parameters:
display- the VisAD display for this Label.- Returns:
- the LabelJ3D description as a Shape3D.
- Throws:
VisADException- - VisAD couldn't make the geometry array.
-
-
DMelt 3.0 © DataMelt by jWork.ORG