Package javax.media.j3d
Class Text3D
java.lang.Object
javax.media.j3d.SceneGraphObject
javax.media.j3d.NodeComponent
javax.media.j3d.Geometry
javax.media.j3d.Text3D
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:
- Font3D object - describes the font style of the text string, such as the font family (Helvetica, Courier, etc.), style (Italic, bold, etc.), and point size. The size of the resulting characters will be equal to the point size. For example, a 12 point font will result in a Font3D with characters 12 meters tall.
- Text string - the text string to be written.
- Position - determines the initial placement of the Text3D string in three-space.
- Alignment - specifies how glyphs in the string are placed in
relation to the position parameter. Valid values are:
- ALIGN_CENTER - the center of the string is placed on the
position
point. - ALIGN_FIRST - the first character of the string is placed on
the
position
point. - ALIGN_LAST - the last character of the string is placed on the
position
point.
- ALIGN_CENTER - the center of the string is placed on the
- Path - specifies how succeeding glyphs in the string are placed in relation to the previous glyph. Valid values are:
- PATH_LEFT - succeeding glyphs are placed to the left of the current glyph.
- PATH_RIGHT - succeeding glyphs are placed to the right of the current glyph.
- PATH_UP - succeeding glyphs are placed above the current glyph.
- PATH_DOWN - succeeding glyphs are placed below the current glyph.
- Character spacing - the space between characters. This spacing is in addition to the regular spacing between glyphs as defined in the Font object.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
alignment
: the center of the string is placed on theposition
point.static final int
alignment
: the first character of the string is placed on theposition
point.static final int
alignment
: the last character of the string is placed on theposition
point.static final int
Specifies that this Text3D object allows reading the text alignment value.static final int
Specifies that this Text3D object allows writing the text alignment value.static final int
Specifies that this Text3D object allows reading the text string bounding box valuestatic final int
Specifies that this Text3D object allows reading the text character spacing value.static final int
Specifies that this Text3D object allows writing the text character spacing value.static final int
Specifies that this Text3D object allows reading the Font3D component information.static final int
Specifies that this Text3D object allows writing the Font3D component information.static final int
Specifies that this Text3D object allows reading the text path value.static final int
Specifies that this Text3D object allows writing the text path value.static final int
Specifies that this Text3D object allows reading the text position value.static final int
Specifies that this Text3D object allows writing the text position value.static final int
Specifies that this Text3D object allows reading the String object.static final int
Specifies that this Text3D object allows writing the String object.static final int
path
: succeeding glyphs are placed below the current glyph.static final int
path
: succeeding glyphs are placed to the left of the current glyph.static final int
path
: succeeding glyphs are placed to the left of the current glyph.static final int
path
: succeeding glyphs are placed above the current glyph.Fields inherited from class javax.media.j3d.Geometry
ALLOW_INTERSECT
-
Constructor Summary
ConstructorsConstructorDescriptionText3D()
Constructs a Text3D object with default parameters.Creates a Text3D object with the given Font3D object.Creates a Text3D object given a Font3D object and a string.Creates a Text3D object given a Font3D, a string and position.Creates a Text3D object given a Font3D, string, position, alignment and path along which string is to be placed. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.replaced with cloneNodeComponent(boolean forceDuplicate)int
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
Retrieves the character spacing used to construct the Text3D string.Returns the Font3D objects used by this Text3D NodeComponent object.int
getPath()
Retrieves the node'spath
field.void
getPosition
(javax.vecmath.Point3f position) Copies the node'sposition
field into the supplied parameter.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
Sets the Font3D object used by this Text3D NodeComponent object.void
setPath
(int path) Sets the node'spath
field.void
setPosition
(javax.vecmath.Point3f position) Sets the node'sposition
field to the supplied parameter.void
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, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString, updateNodeReferences
-
Field Details
-
ALLOW_FONT3D_READ
public static final int ALLOW_FONT3D_READSpecifies that this Text3D object allows reading the Font3D component information.- See Also:
-
ALLOW_FONT3D_WRITE
public static final int ALLOW_FONT3D_WRITESpecifies that this Text3D object allows writing the Font3D component information.- See Also:
-
ALLOW_STRING_READ
public static final int ALLOW_STRING_READSpecifies that this Text3D object allows reading the String object.- See Also:
-
ALLOW_STRING_WRITE
public static final int ALLOW_STRING_WRITESpecifies that this Text3D object allows writing the String object.- See Also:
-
ALLOW_POSITION_READ
public static final int ALLOW_POSITION_READSpecifies that this Text3D object allows reading the text position value.- See Also:
-
ALLOW_POSITION_WRITE
public static final int ALLOW_POSITION_WRITESpecifies that this Text3D object allows writing the text position value.- See Also:
-
ALLOW_ALIGNMENT_READ
public static final int ALLOW_ALIGNMENT_READSpecifies that this Text3D object allows reading the text alignment value.- See Also:
-
ALLOW_ALIGNMENT_WRITE
public static final int ALLOW_ALIGNMENT_WRITESpecifies that this Text3D object allows writing the text alignment value.- See Also:
-
ALLOW_PATH_READ
public static final int ALLOW_PATH_READSpecifies that this Text3D object allows reading the text path value.- See Also:
-
ALLOW_PATH_WRITE
public static final int ALLOW_PATH_WRITESpecifies that this Text3D object allows writing the text path value.- See Also:
-
ALLOW_CHARACTER_SPACING_READ
public static final int ALLOW_CHARACTER_SPACING_READSpecifies that this Text3D object allows reading the text character spacing value.- See Also:
-
ALLOW_CHARACTER_SPACING_WRITE
public static final int ALLOW_CHARACTER_SPACING_WRITESpecifies that this Text3D object allows writing the text character spacing value.- See Also:
-
ALLOW_BOUNDING_BOX_READ
public static final int ALLOW_BOUNDING_BOX_READSpecifies that this Text3D object allows reading the text string bounding box value- See Also:
-
ALIGN_CENTER
public static final int ALIGN_CENTERalignment
: the center of the string is placed on theposition
point.- See Also:
-
ALIGN_FIRST
public static final int ALIGN_FIRSTalignment
: the first character of the string is placed on theposition
point.- See Also:
-
ALIGN_LAST
public static final int ALIGN_LASTalignment
: the last character of the string is placed on theposition
point.- See Also:
-
PATH_LEFT
public static final int PATH_LEFTpath
: succeeding glyphs are placed to the left of the current glyph.- See Also:
-
PATH_RIGHT
public static final int PATH_RIGHTpath
: succeeding glyphs are placed to the left of the current glyph.- See Also:
-
PATH_UP
public static final int PATH_UPpath
: succeeding glyphs are placed above the current glyph.- See Also:
-
PATH_DOWN
public static final int PATH_DOWNpath
: succeeding glyphs are placed below the current glyph.- See Also:
-
-
Constructor Details
-
Text3D
public Text3D()Constructs a Text3D object with default parameters. The default values are as follows:-
font 3D : null
string : null
position : (0,0,0)
alignment : ALIGN_FIRST
path : PATH_RIGHT
character spacing : 0.0
-
Text3D
Creates a Text3D object with the given Font3D object.- See Also:
-
Text3D
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:
-
Text3D
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 positionposition
and succeeding glyphs are placed to the right of the initial glyph.- See Also:
-
Text3D
public Text3D(Font3D font3D, String string, javax.vecmath.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 theposition
position depends on the alignment parameter and the path parameter.- See Also:
-
-
Method Details
-
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
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
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
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(javax.vecmath.Point3f position) Copies the node'sposition
field into the supplied parameter. Theposition
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:
-
setPosition
public void setPosition(javax.vecmath.Point3f position) Sets the node'sposition
field to the supplied parameter. Theposition
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
public int getAlignment()Retrieves the text alignment policy for this Text3D NodeComponent object. Thealignment
is used to specify how glyphs in the string are placed in relation to theposition
field. Valid values for this field are:- ALIGN_CENTER - the center of the string is placed on the
position
point. - ALIGN_FIRST - the first character of the string is placed on
the
position
point. - ALIGN_LAST - the last character of the string is placed on the
position
point.
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:
- ALIGN_CENTER - the center of the string is placed on the
-
setAlignment
public void setAlignment(int alignment) Sets the text alignment policy for this Text3D NodeComponent object. Thealignment
is used to specify how glyphs in the string are placed in relation to theposition
field. Valid values for this field are:- ALIGN_CENTER - the center of the string is placed on the
position
point. - ALIGN_FIRST - the first character of the string is placed on
the
position
point. - ALIGN_LAST - the last character of the string is placed on the
position
point.
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:
- ALIGN_CENTER - the center of the string is placed on the
-
getPath
public int getPath()Retrieves the node'spath
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:- PATH_LEFT: - succeeding glyphs are placed to the left of the current glyph.
- PATH_RIGHT: - succeeding glyphs are placed to the right of the current glyph.
- PATH_UP: - succeeding glyphs are placed above the current glyph.
- PATH_DOWN: - succeeding glyphs are placed below the current glyph.
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'spath
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:- PATH_LEFT - succeeding glyphs are placed to the left of the current glyph.
- PATH_RIGHT - succeeding glyphs are placed to the right of the current glyph.
- PATH_UP - succeeding glyphs are placed above the current glyph.
- PATH_DOWN - succeeding glyphs are placed below the current glyph.
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
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:
-
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
Deprecated.replaced with cloneNodeComponent(boolean forceDuplicate)- Overrides:
cloneNodeComponent
in classNodeComponent
-