org.xith3d.scenegraph.primitives
Class TextRectangle

java.lang.Object
  extended by org.xith3d.scenegraph.SceneGraphObject
      extended by org.xith3d.scenegraph.Node
          extended by org.xith3d.scenegraph.Leaf
              extended by org.xith3d.scenegraph.Shape3D
                  extended by org.xith3d.scenegraph.primitives.Quad
                      extended by org.xith3d.scenegraph.primitives.Rectangle
                          extended by org.xith3d.scenegraph.primitives.TextRectangle
All Implemented Interfaces:
org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.spatial.SpatialNode
Direct Known Subclasses:
TextBillboard

public class TextRectangle
extends Rectangle

The TextRectangle is a Rectangle with a text-Texture on it.
The Texture is created by TextureCreator.createTexture(String, Colorf, java.awt.Font, int).

See Also:
TextureCreator.createTexture(String, Colorf, java.awt.Font, int)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.xith3d.scenegraph.primitives.Rectangle
Rectangle.ZeroPointLocation
 
Field Summary
static int TEXT_ALIGNMENT_HORIZONTAL_CENTER
           
static int TEXT_ALIGNMENT_HORIZONTAL_LEFT
           
static int TEXT_ALIGNMENT_HORIZONTAL_RIGHT
           
 
Fields inherited from class org.xith3d.scenegraph.Node
bounds, boundsAutoCompute, boundsDirty, globalIgnoreBounds, instanceBoundsTypeHint, transformGroup, untransformedBounds
 
Fields inherited from class org.xith3d.scenegraph.SceneGraphObject
XITH3D_USERDATAKEY_OLDUSERDATA
 
Constructor Summary
protected TextRectangle(float width, float height, Rectangle.ZeroPointLocation zpl, float zOffset, Texture texture)
          Creates a TextRectangle.
protected TextRectangle(float width, float height, org.openmali.vecmath2.Tuple3f offset, Texture texture)
          Creates a TextRectangle.
 
Method Summary
static TextRectangle createFixedHeight(float height, float zOffset, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font)
          Creates a TextRectangle.
static TextRectangle createFixedHeight(float height, float zOffset, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Creates a TextRectangle.
static TextRectangle createFixedHeight(float height, Rectangle.ZeroPointLocation zpl, float zOffset, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font)
          Creates a TextRectangle.
static TextRectangle createFixedHeight(float height, Rectangle.ZeroPointLocation zpl, float zOffset, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Creates a TextRectangle.
static TextRectangle createFixedHeight(float height, Rectangle.ZeroPointLocation zpl, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Creates a TextRectangle.
static TextRectangle createFixedHeight(float height, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font)
          Creates a TextRectangle.
static TextRectangle createFixedHeight(float height, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Creates a TextRectangle.
static TextRectangle createFixedHeight(float height, org.openmali.vecmath2.Tuple3f offset, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font)
          Creates a TextRectangle.
static TextRectangle createFixedHeight(float height, org.openmali.vecmath2.Tuple3f offset, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Creates a TextRectangle.
static TextRectangle createFixedHeight(java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, float height, Rectangle.ZeroPointLocation zpl)
          Creates a TextRectangle.
static TextRectangle createFixedWidth(float width, float zOffset, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font)
          Creates a TextRectangle.
static TextRectangle createFixedWidth(float width, float zOffset, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Creates a TextRectangle.
static TextRectangle createFixedWidth(float width, Rectangle.ZeroPointLocation zpl, float zOffset, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font)
          Creates a TextRectangle.
static TextRectangle createFixedWidth(float width, Rectangle.ZeroPointLocation zpl, float zOffset, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Creates a TextRectangle.
static TextRectangle createFixedWidth(float width, Rectangle.ZeroPointLocation zpl, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font)
          Creates a TextRectangle.
static TextRectangle createFixedWidth(float width, Rectangle.ZeroPointLocation zpl, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Creates a TextRectangle.
static TextRectangle createFixedWidth(float width, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font)
          Creates a TextRectangle.
static TextRectangle createFixedWidth(float width, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Creates a TextRectangle.
static TextRectangle createFixedWidth(float width, org.openmali.vecmath2.Tuple3f offset, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font)
          Creates a TextRectangle.
static TextRectangle createFixedWidth(float width, org.openmali.vecmath2.Tuple3f offset, java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Creates a TextRectangle.
protected static float getHeightFromFixedWidth(float width, Texture texture)
           
 java.lang.String getText()
           
 int getTextAlignment()
           
 org.openmali.vecmath2.Colorf getTextColor()
           
 java.awt.Font getTextFont()
           
protected static float getWidthFromFixedHeight(float height, Texture texture)
           
 void setText(java.lang.String text)
          Sets the new text for this TextRectangle.
 void setText(java.lang.String text, org.openmali.vecmath2.Colorf color, java.awt.Font font, int alignment)
          Sets the new text for this TextRectangle.
 
Methods inherited from class org.xith3d.scenegraph.primitives.Rectangle
createPosition, createPosition, createTextureCoordinates, createVertexCoords, createVertexCoords, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, createWithoutNormals, getHeight, getSize, getTexture, getWidth, resize, resize, resize, resize, resize, resize, setTexture, setTexture, setTexture, setTexturePosition, setTexturePosition
 
Methods inherited from class org.xith3d.scenegraph.primitives.Quad
createGeometry, generateNormals, getAlpha, getColor, getGeometry, setAlpha, setColor, setTexture, setTexture, setTexture, setTextureCoordinates, setTexturePosition, setVertexCoords, setVertexCoords, setVertexCoords, update, update
 
Methods inherited from class org.xith3d.scenegraph.Shape3D
absorbDetails, copy, freeOpenGLResources, getAppearance, getAppearance, getCustomComparable, isBumpMappingEnabled, isShadowReceiver, isVisible, newAppearance, newInstance, setAppearance, setBounds, setBumpMappingEnabled, setBumpMappingEnabled, setCustomComparable, setGeometry, setIsShadowReceiver, setModListener, setVisible, sharedCopy, sharedCopy, traverse, updateBounds, updateBoundsCheap, updateWorldTransform, verifyAppChange
 
Methods inherited from class org.xith3d.scenegraph.Leaf
dump, getPickHost, setPickHost
 
Methods inherited from class org.xith3d.scenegraph.Node
cloneNode, detach, duplicateNode, freeOpenGLResources, getBounds, getBoundsAutoCompute, getBoundsType, getBoundsTypeHint, getDefaultPickable, getIndentString, getInheritedNodeAttributes, getModListener, getOrderedChild, getOrderedState, getParent, getRoot, getShadowAttachment, getShowBounds, getTransformGroup, getTreeCell, getWorldBounds, getWorldTransform, getWorldTransform, isBillboard, isIgnoreBounds, isOccluder, isPickable, isRenderable, isUpdatableNode, mergeInheritedClipper, mergeInheritedNodes, mergeInheritedScissorRect, popGlobalIgnoreBounds, printBounds, pushGlobalIgnoreBounds, setBoundsAutoCompute, setBoundsDirty, setBoundsDirtyUpward, setBoundsTypeHint, setDefaultPickable, setGlobalIgnoreBounds, setIgnoreBounds, setIsOccluder, setOrderedChild, setParent, setPickable, setPickableRecursive, setPickableRecursive, setRenderable, setShadowAttachment, setShowBounds, setTransformGroup, setTreeCell, traverse, unmergeInheritedFog, unmergeInheritedLight, unmergeInheritedNodes, updateOrderedChild, updateTransformGroup
 
Methods inherited from class org.xith3d.scenegraph.SceneGraphObject
getName, getUserData, getUserData, getUserDataMap, isLive, setLive, setName, setUserData, setUserData, setUserDataRecursive, setUserDataRecursive, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TEXT_ALIGNMENT_HORIZONTAL_LEFT

public static final int TEXT_ALIGNMENT_HORIZONTAL_LEFT
See Also:
Constant Field Values

TEXT_ALIGNMENT_HORIZONTAL_CENTER

public static final int TEXT_ALIGNMENT_HORIZONTAL_CENTER
See Also:
Constant Field Values

TEXT_ALIGNMENT_HORIZONTAL_RIGHT

public static final int TEXT_ALIGNMENT_HORIZONTAL_RIGHT
See Also:
Constant Field Values
Constructor Detail

TextRectangle

protected TextRectangle(float width,
                        float height,
                        org.openmali.vecmath2.Tuple3f offset,
                        Texture texture)
Creates a TextRectangle.

Parameters:
texture - the text-texture to apply
width - width of the Rectangle
height - height of the Rectangle
offset - relative Location of the Rectangle

TextRectangle

protected TextRectangle(float width,
                        float height,
                        Rectangle.ZeroPointLocation zpl,
                        float zOffset,
                        Texture texture)
Creates a TextRectangle.

Parameters:
width - width of the Rectangle
height - height of the Rectangle
zpl - the location of the point (0, 0, 0)
zOffset - relative z-Location of the Rectangle
texture - the text-texture to apply
Method Detail

setText

public void setText(java.lang.String text,
                    org.openmali.vecmath2.Colorf color,
                    java.awt.Font font,
                    int alignment)
Sets the new text for this TextRectangle.

Parameters:
text - new new text
color - the new text-color
font - the new font to use for the text
alignment - the text horizontal alignment

setText

public void setText(java.lang.String text)
Sets the new text for this TextRectangle.

Parameters:
text - new new text

getText

public java.lang.String getText()
Returns:
this TextRectangle's text

getTextColor

public org.openmali.vecmath2.Colorf getTextColor()
Returns:
this text's color

getTextFont

public java.awt.Font getTextFont()
Returns:
this text's Font

getTextAlignment

public int getTextAlignment()
Returns:
this text's horizontal alignment

getHeightFromFixedWidth

protected static float getHeightFromFixedWidth(float width,
                                               Texture texture)

getWidthFromFixedHeight

protected static float getWidthFromFixedHeight(float height,
                                               Texture texture)

createFixedWidth

public static TextRectangle createFixedWidth(float width,
                                             org.openmali.vecmath2.Tuple3f offset,
                                             java.lang.String text,
                                             org.openmali.vecmath2.Colorf color,
                                             java.awt.Font font,
                                             int alignment)
Creates a TextRectangle.

Parameters:
width - (fixed) width of the Rectangle
offset - relative Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text
alignment - the text horizontal alignment

createFixedWidth

public static TextRectangle createFixedWidth(float width,
                                             float zOffset,
                                             java.lang.String text,
                                             org.openmali.vecmath2.Colorf color,
                                             java.awt.Font font,
                                             int alignment)
Creates a TextRectangle.

Parameters:
width - (fixed) width of the Rectangle
zOffset - relative z-Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text
alignment - the text horizontal alignment

createFixedWidth

public static TextRectangle createFixedWidth(float width,
                                             java.lang.String text,
                                             org.openmali.vecmath2.Colorf color,
                                             java.awt.Font font,
                                             int alignment)
Creates a TextRectangle.

Parameters:
width - (fixed) width of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text
alignment - the text horizontal alignment

createFixedWidth

public static TextRectangle createFixedWidth(float width,
                                             Rectangle.ZeroPointLocation zpl,
                                             float zOffset,
                                             java.lang.String text,
                                             org.openmali.vecmath2.Colorf color,
                                             java.awt.Font font,
                                             int alignment)
Creates a TextRectangle.

Parameters:
width - (fixed) width of the Rectangle
zpl - the location of the point (0, 0, 0)
zOffset - relative z-Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text
alignment - the text horizontal alignment

createFixedWidth

public static TextRectangle createFixedWidth(float width,
                                             Rectangle.ZeroPointLocation zpl,
                                             java.lang.String text,
                                             org.openmali.vecmath2.Colorf color,
                                             java.awt.Font font,
                                             int alignment)
Creates a TextRectangle.

Parameters:
width - (fixed) width of the Rectangle
zpl - the location of the point (0, 0, 0)
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text
alignment - the text horizontal alignment

createFixedWidth

public static TextRectangle createFixedWidth(float width,
                                             org.openmali.vecmath2.Tuple3f offset,
                                             java.lang.String text,
                                             org.openmali.vecmath2.Colorf color,
                                             java.awt.Font font)
Creates a TextRectangle.

Parameters:
width - (fixed) width of the Rectangle
offset - relative Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text

createFixedWidth

public static TextRectangle createFixedWidth(float width,
                                             float zOffset,
                                             java.lang.String text,
                                             org.openmali.vecmath2.Colorf color,
                                             java.awt.Font font)
Creates a TextRectangle.

Parameters:
width - (fixed) width of the Rectangle
zOffset - relative z-Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text

createFixedWidth

public static TextRectangle createFixedWidth(float width,
                                             java.lang.String text,
                                             org.openmali.vecmath2.Colorf color,
                                             java.awt.Font font)
Creates a TextRectangle.

Parameters:
width - (fixed) width of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text

createFixedWidth

public static TextRectangle createFixedWidth(float width,
                                             Rectangle.ZeroPointLocation zpl,
                                             float zOffset,
                                             java.lang.String text,
                                             org.openmali.vecmath2.Colorf color,
                                             java.awt.Font font)
Creates a TextRectangle.

Parameters:
width - (fixed) width of the Rectangle
zpl - the location of the point (0, 0, 0)
zOffset - relative z-Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text

createFixedWidth

public static TextRectangle createFixedWidth(float width,
                                             Rectangle.ZeroPointLocation zpl,
                                             java.lang.String text,
                                             org.openmali.vecmath2.Colorf color,
                                             java.awt.Font font)
Creates a TextRectangle.

Parameters:
width - (fixed) width of the Rectangle
zpl - the location of the point (0, 0, 0)
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text

createFixedHeight

public static TextRectangle createFixedHeight(float height,
                                              org.openmali.vecmath2.Tuple3f offset,
                                              java.lang.String text,
                                              org.openmali.vecmath2.Colorf color,
                                              java.awt.Font font,
                                              int alignment)
Creates a TextRectangle.

Parameters:
height - (fixed) height of the Rectangle
offset - relative Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text
alignment - the text horizontal alignment

createFixedHeight

public static TextRectangle createFixedHeight(float height,
                                              float zOffset,
                                              java.lang.String text,
                                              org.openmali.vecmath2.Colorf color,
                                              java.awt.Font font,
                                              int alignment)
Creates a TextRectangle.

Parameters:
height - (fixed) height of the Rectangle
zOffset - relative z-Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text
alignment - the text horizontal alignment

createFixedHeight

public static TextRectangle createFixedHeight(float height,
                                              java.lang.String text,
                                              org.openmali.vecmath2.Colorf color,
                                              java.awt.Font font,
                                              int alignment)
Creates a TextRectangle.

Parameters:
height - (fixed) height of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text
alignment - the text horizontal alignment

createFixedHeight

public static TextRectangle createFixedHeight(float height,
                                              Rectangle.ZeroPointLocation zpl,
                                              float zOffset,
                                              java.lang.String text,
                                              org.openmali.vecmath2.Colorf color,
                                              java.awt.Font font,
                                              int alignment)
Creates a TextRectangle.

Parameters:
height - (fixed) height of the Rectangle
zpl - the location of the point (0, 0, 0)
zOffset - relative z-Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text
alignment - the text horizontal alignment

createFixedHeight

public static TextRectangle createFixedHeight(float height,
                                              Rectangle.ZeroPointLocation zpl,
                                              java.lang.String text,
                                              org.openmali.vecmath2.Colorf color,
                                              java.awt.Font font,
                                              int alignment)
Creates a TextRectangle.

Parameters:
height - (fixed) height of the Rectangle
zpl - the location of the point (0, 0, 0)
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text
alignment - the text horizontal alignment

createFixedHeight

public static TextRectangle createFixedHeight(float height,
                                              org.openmali.vecmath2.Tuple3f offset,
                                              java.lang.String text,
                                              org.openmali.vecmath2.Colorf color,
                                              java.awt.Font font)
Creates a TextRectangle.

Parameters:
height - (fixed) height of the Rectangle
offset - relative Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text

createFixedHeight

public static TextRectangle createFixedHeight(float height,
                                              float zOffset,
                                              java.lang.String text,
                                              org.openmali.vecmath2.Colorf color,
                                              java.awt.Font font)
Creates a TextRectangle.

Parameters:
height - (fixed) height of the Rectangle
zOffset - relative z-Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text

createFixedHeight

public static TextRectangle createFixedHeight(float height,
                                              java.lang.String text,
                                              org.openmali.vecmath2.Colorf color,
                                              java.awt.Font font)
Creates a TextRectangle.

Parameters:
height - (fixed) height of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text

createFixedHeight

public static TextRectangle createFixedHeight(float height,
                                              Rectangle.ZeroPointLocation zpl,
                                              float zOffset,
                                              java.lang.String text,
                                              org.openmali.vecmath2.Colorf color,
                                              java.awt.Font font)
Creates a TextRectangle.

Parameters:
height - (fixed) height of the Rectangle
zpl - the location of the point (0, 0, 0)
zOffset - relative z-Location of the Rectangle
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text

createFixedHeight

public static TextRectangle createFixedHeight(java.lang.String text,
                                              org.openmali.vecmath2.Colorf color,
                                              java.awt.Font font,
                                              float height,
                                              Rectangle.ZeroPointLocation zpl)
Creates a TextRectangle.

Parameters:
height - (fixed) height of the Rectangle
zpl - the location of the point (0, 0, 0)
text - the text to render on the Rectangle
color - the color to use for the text
font - the Font to use for the text