javax.media.j3d
Class Text3D

java.lang.Object
  extended by javax.media.j3d.SceneGraphObject
      extended by javax.media.j3d.NodeComponent
          extended by javax.media.j3d.Geometry
              extended by javax.media.j3d.Text3D

public class Text3D
extends Geometry

A Text3D object is a text string that has been converted to 3D geometry. The Font3D object determines the appearance of the Text3D NodeComponent object. Each Text3D object has the following parameters:

See Also:
Font3D

Field Summary
static int ALIGN_CENTER
          alignment: the center of the string is placed on the position point.
static int ALIGN_FIRST
          alignment: the first character of the string is placed on the position point.
static int ALIGN_LAST
          alignment: the last character of the string is placed on the position point.
static int ALLOW_ALIGNMENT_READ
          Specifies that this Text3D object allows reading the text alignment value.
static int ALLOW_ALIGNMENT_WRITE
          Specifies that this Text3D object allows writing the text alignment value.
static int ALLOW_BOUNDING_BOX_READ
          Specifies that this Text3D object allows reading the text string bounding box value
static int ALLOW_CHARACTER_SPACING_READ
          Specifies that this Text3D object allows reading the text character spacing value.
static int ALLOW_CHARACTER_SPACING_WRITE
          Specifies that this Text3D object allows writing the text character spacing value.
static int ALLOW_FONT3D_READ
          Specifies that this Text3D object allows reading the Font3D component information.
static int ALLOW_FONT3D_WRITE
          Specifies that this Text3D object allows writing the Font3D component information.
static int ALLOW_PATH_READ
          Specifies that this Text3D object allows reading the text path value.
static int ALLOW_PATH_WRITE
          Specifies that this Text3D object allows writing the text path value.
static int ALLOW_POSITION_READ
          Specifies that this Text3D object allows reading the text position value.
static int ALLOW_POSITION_WRITE
          Specifies that this Text3D object allows writing the text position value.
static int ALLOW_STRING_READ
          Specifies that this Text3D object allows reading the String object.
static int ALLOW_STRING_WRITE
          Specifies that this Text3D object allows writing the String object.
static int PATH_DOWN
          path: succeeding glyphs are placed below the current glyph.
static int PATH_LEFT
          path: succeeding glyphs are placed to the left of the current glyph.
static int PATH_RIGHT
          path: succeeding glyphs are placed to the left of the current glyph.
static int PATH_UP
          path: succeeding glyphs are placed above the current glyph.
 
Fields inherited from class javax.media.j3d.Geometry
ALLOW_INTERSECT
 
Constructor Summary
Text3D()
          Constructs a Text3D object with default parameters.
Text3D(Font3D font3D)
          Creates a Text3D object with the given Font3D object.
Text3D(Font3D font3D, java.lang.String string)
          Creates a Text3D object given a Font3D object and a string.
Text3D(Font3D font3D, java.lang.String string, Point3f position)
          Creates a Text3D object given a Font3D, a string and position.
Text3D(Font3D font3D, java.lang.String string, Point3f position, int alignment, int path)
          Creates a Text3D object given a Font3D, string, position, alignment and path along which string is to be placed.
 
Method Summary
 NodeComponent cloneNodeComponent()
          Deprecated. replaced with cloneNodeComponent(boolean forceDuplicate)
 int getAlignment()
          Retrieves the text alignment policy for this Text3D NodeComponent object.
 void getBoundingBox(BoundingBox bounds)
          Retrieves the 3D bounding box that encloses this Text3D object.
 float getCharacterSpacing()
          Retrieves the character spacing used to construct the Text3D string.
 Font3D getFont3D()
          Returns the Font3D objects used by this Text3D NodeComponent object.
 int getPath()
          Retrieves the node's path field.
 void getPosition(Point3f position)
          Copies the node's position field into the supplied parameter.
 java.lang.String getString()
          Copies the character string used in the construction of the Text3D node into the supplied parameter.
 void setAlignment(int alignment)
          Sets the text alignment policy for this Text3D NodeComponent object.
 void setCharacterSpacing(float characterSpacing)
          Sets the character spacing used when constructing the Text3D string.
 void setFont3D(Font3D font3d)
          Sets the Font3D object used by this Text3D NodeComponent object.
 void setPath(int path)
          Sets the node's path field.
 void setPosition(Point3f position)
          Sets the node's position field to the supplied parameter.
 void setString(java.lang.String string)
          Copies the character string from the supplied parameter into the Text3D node.
 
Methods inherited from class javax.media.j3d.NodeComponent
cloneNodeComponent, duplicateNodeComponent, duplicateNodeComponent, getDuplicateOnCloneTree, setDuplicateOnCloneTree
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setUserData, updateNodeReferences
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALLOW_FONT3D_READ

public static final int ALLOW_FONT3D_READ
Specifies that this Text3D object allows reading the Font3D component information.

See Also:
Font3D, Constant Field Values

ALLOW_FONT3D_WRITE

public static final int ALLOW_FONT3D_WRITE
Specifies that this Text3D object allows writing the Font3D component information.

See Also:
Font3D, Constant Field Values

ALLOW_STRING_READ

public static final int ALLOW_STRING_READ
Specifies that this Text3D object allows reading the String object.

See Also:
Constant Field Values

ALLOW_STRING_WRITE

public static final int ALLOW_STRING_WRITE
Specifies that this Text3D object allows writing the String object.

See Also:
Constant Field Values

ALLOW_POSITION_READ

public static final int ALLOW_POSITION_READ
Specifies that this Text3D object allows reading the text position value.

See Also:
Constant Field Values

ALLOW_POSITION_WRITE

public static final int ALLOW_POSITION_WRITE
Specifies that this Text3D object allows writing the text position value.

See Also:
Constant Field Values

ALLOW_ALIGNMENT_READ

public static final int ALLOW_ALIGNMENT_READ
Specifies that this Text3D object allows reading the text alignment value.

See Also:
Constant Field Values

ALLOW_ALIGNMENT_WRITE

public static final int ALLOW_ALIGNMENT_WRITE
Specifies that this Text3D object allows writing the text alignment value.

See Also:
Constant Field Values

ALLOW_PATH_READ

public static final int ALLOW_PATH_READ
Specifies that this Text3D object allows reading the text path value.

See Also:
Constant Field Values

ALLOW_PATH_WRITE

public static final int ALLOW_PATH_WRITE
Specifies that this Text3D object allows writing the text path value.

See Also:
Constant Field Values

ALLOW_CHARACTER_SPACING_READ

public static final int ALLOW_CHARACTER_SPACING_READ
Specifies that this Text3D object allows reading the text character spacing value.

See Also:
Constant Field Values

ALLOW_CHARACTER_SPACING_WRITE

public static final int ALLOW_CHARACTER_SPACING_WRITE
Specifies that this Text3D object allows writing the text character spacing value.

See Also:
Constant Field Values

ALLOW_BOUNDING_BOX_READ

public static final int ALLOW_BOUNDING_BOX_READ
Specifies that this Text3D object allows reading the text string bounding box value

See Also:
Constant Field Values

ALIGN_CENTER

public static final int ALIGN_CENTER
alignment: the center of the string is placed on the position point.

See Also:
getAlignment(), Constant Field Values

ALIGN_FIRST

public static final int ALIGN_FIRST
alignment: the first character of the string is placed on the position point.

See Also:
getAlignment(), Constant Field Values

ALIGN_LAST

public static final int ALIGN_LAST
alignment: the last character of the string is placed on the position point.

See Also:
getAlignment(), Constant Field Values

PATH_LEFT

public static final int PATH_LEFT
path: succeeding glyphs are placed to the left of the current glyph.

See Also:
getPath(), Constant Field Values

PATH_RIGHT

public static final int PATH_RIGHT
path: succeeding glyphs are placed to the left of the current glyph.

See Also:
getPath(), Constant Field Values

PATH_UP

public static final int PATH_UP
path: succeeding glyphs are placed above the current glyph.

See Also:
getPath(), Constant Field Values

PATH_DOWN

public static final int PATH_DOWN
path: succeeding glyphs are placed below the current glyph.

See Also:
getPath(), Constant Field Values
Constructor Detail

Text3D

public Text3D()
Constructs a Text3D object with default parameters. The default values are as follows:


Text3D

public Text3D(Font3D font3D)
Creates a Text3D object with the given Font3D object.

See Also:
Font3D

Text3D

public Text3D(Font3D font3D,
              java.lang.String string)
Creates a Text3D object given a Font3D object and a string. The string is converted into 3D glyphs. The first glyph from the string is placed at (0.0, 0.0, 0.0) and succeeding glyphs are placed to the right of the initial glyph.

See Also:
Font3D

Text3D

public Text3D(Font3D font3D,
              java.lang.String string,
              Point3f position)
Creates a Text3D object given a Font3D, a string and position. The string is converted into 3D glyphs. The first glyph from the string is placed at position position and succeeding glyphs are placed to the right of the initial glyph.

See Also:
Font3D

Text3D

public Text3D(Font3D font3D,
              java.lang.String string,
              Point3f position,
              int alignment,
              int path)
Creates a Text3D object given a Font3D, string, position, alignment and path along which string is to be placed. The string is converted into 3D glyphs. The placement of the glyphs with respect to the position position depends on the alignment parameter and the path parameter.

See Also:
Font3D
Method Detail

getFont3D

public Font3D getFont3D()
Returns the Font3D objects used by this Text3D NodeComponent object.

Returns:
the Font3D object of this Text3D node - null if no Font3D has been associated with this node.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setFont3D

public void setFont3D(Font3D font3d)
Sets the Font3D object used by this Text3D NodeComponent object.

Parameters:
font3d - the Font3D object to associate with this Text3D node.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getString

public java.lang.String getString()
Copies the character string used in the construction of the Text3D node into the supplied parameter.

Returns:
a copy of the String object in this Text3D node.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setString

public void setString(java.lang.String string)
Copies the character string from the supplied parameter into the Text3D node.

Parameters:
string - the String object to recieve the Text3D node's string.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getPosition

public void getPosition(Point3f position)
Copies the node's position field into the supplied parameter. The position is used to determine the initial placement of the Text3D string. The position, combined with the path and alignment control how the text is displayed.

Parameters:
position - the point to position the text.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
See Also:
getAlignment(), getPath()

setPosition

public void setPosition(Point3f position)
Sets the node's position field to the supplied parameter. The position is used to determine the initial placement of the Text3D string. The position, combined with the path and alignment control how the text is displayed.

Parameters:
position - the point to position the text.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
See Also:
getAlignment(), getPath()

getAlignment

public int getAlignment()
Retrieves the text alignment policy for this Text3D NodeComponent object. The alignment is used to specify how glyphs in the string are placed in relation to the position field. Valid values for this field are: The default value of this field is ALIGN_FIRST.

Returns:
the current alingment policy for this node.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
See Also:
getPosition(javax.vecmath.Point3f)

setAlignment

public void setAlignment(int alignment)
Sets the text alignment policy for this Text3D NodeComponent object. The alignment is used to specify how glyphs in the string are placed in relation to the position field. Valid values for this field are: The default value of this field is ALIGN_FIRST.

Parameters:
alignment - specifies how glyphs in the string are placed in relation to the position field
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
See Also:
getPosition(javax.vecmath.Point3f)

getPath

public int getPath()
Retrieves the node's path field. This field is used to specify how succeeding glyphs in the string are placed in relation to the previous glyph. Valid values for this field are: The default value of this field is PATH_RIGHT.

Returns:
the current alingment policy for this node.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setPath

public void setPath(int path)
Sets the node's path field. This field is used to specify how succeeding glyphs in the string are placed in relation to the previous glyph. Valid values for this field are: The default value of this field is PATH_RIGHT.

Parameters:
path - the value to set the path to
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getBoundingBox

public void getBoundingBox(BoundingBox bounds)
Retrieves the 3D bounding box that encloses this Text3D object.

Parameters:
bounds - the object to copy the bounding information to.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
See Also:
BoundingBox

getCharacterSpacing

public float getCharacterSpacing()
Retrieves the character spacing used to construct the Text3D string. This spacing is in addition to the regular spacing between glyphs as defined in the Font object. 1.0 in this space is measured as the width of the largest glyph in the 2D Font. The default value is 0.0.

Returns:
the current character spacing value
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setCharacterSpacing

public void setCharacterSpacing(float characterSpacing)
Sets the character spacing used when constructing the Text3D string. This spacing is in addition to the regular spacing between glyphs as defined in the Font object. 1.0 in this space is measured as the width of the largest glyph in the 2D Font. The default value is 0.0.

Parameters:
characterSpacing - the new character spacing value
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

cloneNodeComponent

public NodeComponent cloneNodeComponent()
Deprecated. replaced with cloneNodeComponent(boolean forceDuplicate)

Overrides:
cloneNodeComponent in class NodeComponent