|
AWT Shape Extruder | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.interactivemesh.j3d.community.utils.geometry.String3D
public class String3D
String3D converts a text string to a 3D geometry in a factory manner.
Each String3D object has the following parameters:
The size and original position of a text string can be ascertained without generating geometry data by
javax.media.j3d.GeometryArray
for the entire text
getStringGeometry(String)
getStringGeometry(String, BoundingBox)
getStringOutlineGeometry(String)
getStringOutlineGeometry(String, BoundingBox)
javax.media.j3d.GeometryArray
for each character:
getCharacterGeometry(String)
getCharacterGeometry(String, BoundingBox)
getCharacterOutlineGeometry(String)
getCharacterOutlineGeometry(String, BoundingBox)
A returned GeometryArray includes triangle resp. line primitives and normals.
Sample strings:
String string0 = new String("String3D"); String string1 = new String("Two Words !"); String string2 = new String(" 9 8 7 6 5 4 3 2 1 "); int[] codePoints = new int[] {9992, 9786}; // Airplane, Smiley (e.g. Lucida Sans) String string3 = new String(codePoints, 0, 2);String3D is a generalized version of
javax.media.j3d.Text3D
.
Nested Class Summary | |
---|---|
static class |
String3D.Alignment
Specifies how the string is placed in relation to the position parameter. |
static class |
String3D.Path
Specifies how succeeding characters in the string are placed in relation to the previous characters and are aligned in relation to the position parameter. |
Constructor Summary | |
---|---|
String3D()
Constructs a String3D object with default parameters. |
|
String3D(java.awt.Font font,
AWTShapeExtruder extruder)
Constructs a String3D object given a font and an extruder. |
|
String3D(java.awt.Font font,
AWTShapeExtruder extruder,
javax.vecmath.Point3f position)
Constructs a String3D object given a font, an extruder, and a position. |
|
String3D(java.awt.Font font,
AWTShapeExtruder extruder,
javax.vecmath.Point3f position,
String3D.Alignment alignment,
String3D.Path path)
Constructs a String3D object given a font, an extruder, a position, an alignment, and a path. |
Method Summary | |
---|---|
String3D.Alignment |
getAlignment()
Returns the string alignment policy for this String3D object. |
javax.media.j3d.GeometryArray[] |
getCharacterGeometry(java.lang.String string)
Generates GeometryArray objects for the given string's characters according to the specified font, extruder, spacing, position, alignment, and path of this String3D object. |
javax.media.j3d.GeometryArray[] |
getCharacterGeometry(java.lang.String string,
javax.media.j3d.BoundingBox bounds)
Generates GeometryArray objects for the given string's characters according to the specified font, extruder, spacing, position, alignment, and path of this String3D object and returns the geometries' bounding box to the given BoundingBox object. |
javax.media.j3d.GeometryArray[] |
getCharacterOutlineGeometry(java.lang.String string)
Generates GeometryArray objects representing the outline for the given string's characters according to the specified font, spacing, position, alignment, and path of this String3D object. |
javax.media.j3d.GeometryArray[] |
getCharacterOutlineGeometry(java.lang.String string,
javax.media.j3d.BoundingBox bounds)
Generates GeometryArray objects representing the outline for the given string's characters according to the specified font, spacing, position, alignment, and path of this String3D object and returns the geometries' bounding box to the given BoundingBox object. |
float |
getCharacterSpacing()
Returns the character spacing used when creating the string's geometry. |
AWTShapeExtruder |
getExtruder()
Returns the AWTShapeExtruder object used by this String3D object. |
java.awt.Font |
getFont()
Returns the Font object used by this String3D object. |
void |
getGeometryBounds(java.lang.String string,
javax.media.j3d.BoundingBox bounds)
Returns the bounding box for the given string according to the specified font, extrusion depth, spacing, alignment, and path of this String3D object without generating geometry data. |
String3D.Path |
getPath()
Returns the characters path policy. |
void |
getPosition(javax.vecmath.Point3f position)
Copies the position field into the supplied
parameter. |
javax.media.j3d.GeometryArray |
getStringGeometry(java.lang.String string)
Generates a GeometryArray object for the given string according to the specified font, extruder, spacing, position, alignment, and path of this String3D object. |
javax.media.j3d.GeometryArray |
getStringGeometry(java.lang.String string,
javax.media.j3d.BoundingBox bounds)
Generates a GeometryArray object for the given string according to the specified font, extruder, spacing, position, alignment, and path of this String3D object and returns the geometry's bounding box to the given BoundingBox object. |
javax.media.j3d.GeometryArray |
getStringOutlineGeometry(java.lang.String string)
Generates a GeometryArray object representing the outline for the given string according to the specified font, spacing, position, alignment, and path of this String3D object. |
javax.media.j3d.GeometryArray |
getStringOutlineGeometry(java.lang.String string,
javax.media.j3d.BoundingBox bounds)
Generates a GeometryArray object representing the outline for the given string according to the specified font, spacing, position, alignment, and path of this String3D object and returns the geometry's bounding box to the given BoundingBox object. |
void |
setAlignment(String3D.Alignment alignment)
Sets the string alignment policy for this String3D object. |
void |
setCharacterSpacing(float characterSpacing)
Sets the character spacing used when creating the string's geometry. |
void |
setExtruder(AWTShapeExtruder extruder)
Sets the AWTShapeExtruder object used by this String3D object. |
void |
setFont(java.awt.Font font)
Sets the Font object used by this String3D object. |
void |
setPath(String3D.Path path)
Sets the characters path policy. |
void |
setPosition(javax.vecmath.Point3f position)
Sets the position field to the supplied
parameter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public String3D()
public String3D(java.awt.Font font, AWTShapeExtruder extruder)
AWTShapeExtruder
public String3D(java.awt.Font font, AWTShapeExtruder extruder, javax.vecmath.Point3f position)
AWTShapeExtruder
public String3D(java.awt.Font font, AWTShapeExtruder extruder, javax.vecmath.Point3f position, String3D.Alignment alignment, String3D.Path path)
AWTShapeExtruder
Method Detail |
---|
public java.awt.Font getFont()
The default font is null
.
public void setFont(java.awt.Font font)
The default font is null
.
font
- the Font object to associate with this String3D.public AWTShapeExtruder getExtruder()
The default extruder is null
.
public void setExtruder(AWTShapeExtruder extruder)
The default extruder is null
.
extruder
- the AWTShapeExtruder object to associate with this String3D.public void getPosition(javax.vecmath.Point3f position)
position
field into the supplied
parameter. The position
is used to determine the
initial placement of the String3D string. The position, combined with
the path and alignment control how the string is displayed.The default position is (0, 0, 0).
position
- the point to position the string.
java.lang.NullPointerException
- if position is null
.getAlignment()
,
getPath()
public void setPosition(javax.vecmath.Point3f position)
position
field to the supplied
parameter. The position
is used to determine the
initial placement of the String3D string. The position, combined with
the path and alignment control how the string is displayed.The default position is (0, 0, 0).
position
- the point to position the string.
java.lang.NullPointerException
- if position is null
.getAlignment()
,
getPath()
public String3D.Alignment getAlignment()
alignment
is used to specify how
characters in the string are placed in relation to the
position
field.
The default value is String3D.Alignment.FIRST
.
getPosition(javax.vecmath.Point3f)
public void setAlignment(String3D.Alignment alignment)
alignment
is used to specify how
characters in the string are placed in relation to the
position
field.
The default value is String3D.Alignment.FIRST
.
alignment
- the new alignment policy for this objectgetPosition(javax.vecmath.Point3f)
public String3D.Path getPath()
The default value is String3D.Path.RIGHT
.
public void setPath(String3D.Path path)
The default value is String3D.Path.RIGHT
.
path
- the new characters path policy for this object.public float getCharacterSpacing()
The default value is 0.0.
public void setCharacterSpacing(float characterSpacing)
The default value is 0.0.
characterSpacing
- the new character spacing valuepublic void getGeometryBounds(java.lang.String string, javax.media.j3d.BoundingBox bounds)
Neither the position nor the geometry transform attributes are applied. The edge contour of a specified extrusion shape is ignored.
The returned lower and upper corners of the BoundingBox object allow to ascertain the width, height, and depth as well as the center of the tessellated and extruded geometry.
string
- a String from which to generate the geometry's bounding boxbounds
- a BoundingBox to receive the geometry's lower and upper corners
java.lang.NullPointerException
- if string is null
or of length < 1
java.lang.NullPointerException
- if bounds is null
java.lang.IllegalStateException
- if no extruder or font object is set
java.lang.IllegalArgumentException
- if string consists of whitespaces onlypublic javax.media.j3d.GeometryArray getStringGeometry(java.lang.String string)
All whitespaces within the string influence the characters' position, alignment, and path. But a non-straight extrusion shape remains unconsidered.
The returned GeometryArray object comprises the geometry of all non-whitespace characters and includes triangle primitives as well as normals.
string
- a String from which to generate a tessellated extruded geometry
null
if no GeometryArray could be created
java.lang.NullPointerException
- if string is null
or of length < 1
java.lang.IllegalStateException
- if no extruder or font object is set
java.lang.IllegalArgumentException
- if string consists of whitespaces onlypublic javax.media.j3d.GeometryArray getStringGeometry(java.lang.String string, javax.media.j3d.BoundingBox bounds)
All whitespaces within the string influence the characters' position, alignment and path. But a non-straight extrusion shape remains unconsidered.
The returned GeometryArray object comprises the geometry of all non-whitespace characters and includes triangle primitives as well as normals.
The specified BoundingBox object, if not null
, receives
the bounding box of the returned GeometryArray object.
string
- a String from which to generate a tessellated extruded geometrybounds
- a BoundingBox to receive the geometry's bounding box
null
if no GeometryArray could be created
java.lang.NullPointerException
- if string is null
or of length < 1
java.lang.IllegalStateException
- if no extruder or font object is set
java.lang.IllegalArgumentException
- if string consists of whitespaces onlypublic javax.media.j3d.GeometryArray getStringOutlineGeometry(java.lang.String string)
All whitespaces within the string influence the characters' position, alignment, and path.
The returned GeometryArray object comprises the geometry of all non-whitespace characters and includes line primitives as well as normals which are directed along the positive Z axis (0, 0, 1).
string
- a String from which to generate an outline geometry
null
if no GeometryArray could be created
java.lang.NullPointerException
- if string is null
or of length < 1
java.lang.IllegalStateException
- if no extruder or font object is set
java.lang.IllegalArgumentException
- if string consists of whitespaces onlypublic javax.media.j3d.GeometryArray getStringOutlineGeometry(java.lang.String string, javax.media.j3d.BoundingBox bounds)
All whitespaces within the string influence the characters' position, alignment, and path.
The returned GeometryArray object comprises the geometry of all non-whitespace characters and includes line primitives as well as normals which are directed along the positive Z axis (0, 0, 1).
The specified BoundingBox object, if not null
, receives
the bounding box of the returned GeometryArray object.
string
- a String from which to generate an outline geometrybounds
- a BoundingBox to receive the geometry's bounding box
null
if no GeometryArray could be created
java.lang.NullPointerException
- if string is null
or of length < 1
java.lang.IllegalStateException
- if no extruder or font object is set
java.lang.IllegalArgumentException
- if string consists of whitespaces onlypublic javax.media.j3d.GeometryArray[] getCharacterGeometry(java.lang.String string)
All whitespaces within the string influence the characters' position, alignment, and path. But a non-straight extrusion shape remains unconsidered.
The returned GeometryArray objects comprise the geometry of all non-whitespace characters and include triangle primitives as well as normals.
string
- a String from which to generate for each character a tessellated extruded geometry
null
if no GeometryArray could be created
java.lang.NullPointerException
- if string is null
or of length < 1
java.lang.IllegalStateException
- if no extruder or font object is set
java.lang.IllegalArgumentException
- if string consists of whitespaces onlypublic javax.media.j3d.GeometryArray[] getCharacterGeometry(java.lang.String string, javax.media.j3d.BoundingBox bounds)
All whitespaces within the string influence the characters' position, alignment, and path. But a non-straight extrusion shape remains unconsidered.
The returned GeometryArray objects comprise the geometry of all non-whitespace characters and include triangle primitives as well as normals.
The specified BoundingBox object, if not null
, receives
the combined bounding box of all returned GeometryArray objects.
string
- a String from which to generate for each character a tessellated extruded geometrybounds
- a BoundingBox to receive the geometries' bounding box
null
if no GeometryArray could be created
java.lang.NullPointerException
- if string is null
or of length < 1
java.lang.IllegalStateException
- if no extruder or font object is set
java.lang.IllegalArgumentException
- if string consists of whitespaces onlypublic javax.media.j3d.GeometryArray[] getCharacterOutlineGeometry(java.lang.String string)
All whitespaces within the string influence the characters' position, alignment, and path.
The returned GeometryArray objects comprise the geometry of all non-whitespace characters and include line primitives as well as normals which are directed along the positive Z axis (0, 0, 1).
string
- a String from which to generate for each character an outline geometry
null
if no GeometryArray could be created
java.lang.NullPointerException
- if string is null
or of length < 1
java.lang.IllegalStateException
- if no extruder or font object is set
java.lang.IllegalArgumentException
- if string consists of whitespaces onlypublic javax.media.j3d.GeometryArray[] getCharacterOutlineGeometry(java.lang.String string, javax.media.j3d.BoundingBox bounds)
All whitespaces within the string influence the characters' position, alignment, and path.
The returned GeometryArray objects comprise the geometry of all non-whitespace characters and include line primitives as well as normals which are directed along the positive Z axis (0, 0, 1).
The specified BoundingBox object, if not null
, receives
the combined bounding box of all returned GeometryArray objects.
string
- a String from which to generate for each character an outline geometrybounds
- a BoundingBox to receive the geometries' bounding box
null
if no GeometryArray could be created
java.lang.NullPointerException
- if string is null
or of length < 1
java.lang.IllegalStateException
- if no extruder or font object is set
java.lang.IllegalArgumentException
- if string consists of whitespaces only
|
AWT Shape Extruder | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |