|
j3d.org Code | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjavax.media.j3d.SceneGraphObject
javax.media.j3d.Node
javax.media.j3d.Leaf
javax.media.j3d.Shape3D
org.j3d.renderer.java3d.geom.RasterTextLabel
A text label for labelling objects on screen that uses a Java 3D Raster to produce the overlay effect.
If the label text is null, then no label will be displayed. All of the setup will be done, but no raster will be created.
The text label can come in a number of flavours depending on how you configure it through the constructors. You may build a label that is only static, always fixed size regardless of text length, and/or may be hidden from other objects v always on the top. Once configured to one of these versions, it cannot be changed.
If running dynamic text, the internal images will only resize to a larger size. That is, if a new string comes in that is smaller than the original string, the image will stay the larger length than the original. The idea is to reduce the amount of garbage generated. However, in some instances this may not produce acceptable visual behaviour, so the crop() method is introduced that will force the image size to be reduced to the smallest possible size for the next time a string is set. There are also variants on the setText() methods to do this as well with a flag. Cropping is independent of the fixedSize flag but is still subject to the dynamic flag on the constructor.
| Field Summary |
| Fields inherited from class javax.media.j3d.Shape3D |
ALLOW_APPEARANCE_OVERRIDE_READ, ALLOW_APPEARANCE_OVERRIDE_WRITE, ALLOW_APPEARANCE_READ, ALLOW_APPEARANCE_WRITE, ALLOW_COLLISION_BOUNDS_READ, ALLOW_COLLISION_BOUNDS_WRITE, ALLOW_GEOMETRY_READ, ALLOW_GEOMETRY_WRITE |
| Fields inherited from class javax.media.j3d.Node |
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING |
| Constructor Summary | |
RasterTextLabel()
Create a new blank label with no text. |
|
RasterTextLabel(java.lang.String label,
java.awt.Color col)
Create a new blank label with the given text located at the origin. |
|
RasterTextLabel(java.lang.String label,
java.awt.Color col,
boolean alwaysOnTop)
Create a new blank label with the given text located at the origin. |
|
RasterTextLabel(java.lang.String label,
java.awt.Color col,
boolean alwaysOnTop,
boolean dynamic)
Create a new blank label with the given text located at the origin. |
|
RasterTextLabel(java.lang.String label,
java.awt.Color col,
boolean alwaysOnTop,
boolean dynamic,
float x,
float y,
float z)
Create a new blank label with the given text located at a specific point in 3D world coordinates. |
|
RasterTextLabel(java.lang.String label,
java.awt.Color col,
boolean alwaysOnTop,
boolean dynamic,
float x,
float y,
float z,
java.awt.Color border,
java.awt.Font font)
Create a new blank label with the given text located at a specific point in 3D world coordinates and an option to show a border and selected font. |
|
RasterTextLabel(java.lang.String label,
java.awt.Color col,
boolean alwaysOnTop,
float x,
float y,
float z)
Create a new blank label with the given text located at a specific point in 3D world coordinates. |
|
| Method Summary | |
void |
crop()
Crop the image used for the raster to the length of the string the next time a string is set. |
void |
fixSize(boolean fixed)
Set the condition of whether the implementation should resize the canvas after each new label is set or just stick to a fixed size canvas. |
void |
setText(java.lang.String text)
Set the label string that is to be rendered. |
void |
setText(java.lang.String text,
boolean crop)
Set the label string that is to be rendered with the option of croping it to the length of the string. |
void |
setText(java.lang.String text,
java.awt.Color col)
Set the label string that is to be rendered and changes the color to the new value. |
void |
setText(java.lang.String text,
java.awt.Color col,
boolean crop)
Set the label string that is to be rendered and changes the color to the new value. |
| Methods inherited from class javax.media.j3d.Shape3D |
addGeometry, cloneNode, duplicateNode, getAllGeometries, getAppearance, getAppearanceOverrideEnable, getBounds, getCollisionBounds, getGeometry, getGeometry, indexOfGeometry, insertGeometry, intersect, intersect, intersect, numGeometries, removeAllGeometries, removeGeometry, removeGeometry, setAppearance, setAppearanceOverrideEnable, setCollisionBounds, setGeometry, setGeometry |
| Methods inherited from class javax.media.j3d.Node |
cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, getBoundsAutoCompute, getCollidable, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable |
| 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 |
| Constructor Detail |
public RasterTextLabel()
public RasterTextLabel(java.lang.String label,
java.awt.Color col)
label - The string to use on the labelcol - The text color to be drawn in
public RasterTextLabel(java.lang.String label,
java.awt.Color col,
boolean alwaysOnTop)
label - The string to use on the labelcol - The text color to be drawn inalwaysOnTop - true if this should never be obscured by content
public RasterTextLabel(java.lang.String label,
java.awt.Color col,
boolean alwaysOnTop,
boolean dynamic)
label - The string to use on the labelcol - The text color to be drawn indynamic - True if this will change text over timealwaysOnTop - true if this should never be obscured by content
public RasterTextLabel(java.lang.String label,
java.awt.Color col,
boolean alwaysOnTop,
float x,
float y,
float z)
label - The string to use on the labelcol - The text color to be drawn inalwaysOnTop - true if this should never be obscured by contentx - The x world coordinate to place the labely - The y world coordinate to place the labelz - The z world coordinate to place the label
public RasterTextLabel(java.lang.String label,
java.awt.Color col,
boolean alwaysOnTop,
boolean dynamic,
float x,
float y,
float z)
label - The string to use on the labelcol - The text color to be drawn inx - The x world coordinate to place the labely - The y world coordinate to place the labelz - The z world coordinate to place the labelalwaysOnTop - true if this should never be obscured by contentdynamic - True if this will change text over time
public RasterTextLabel(java.lang.String label,
java.awt.Color col,
boolean alwaysOnTop,
boolean dynamic,
float x,
float y,
float z,
java.awt.Color border,
java.awt.Font font)
label - The string to use on the labelcol - The text color to be drawn inx - The x world coordinate to place the labely - The y world coordinate to place the labelz - The z world coordinate to place the labelborder - The color to use for the border or null for nonefont - The font to draw the string in or null for defaultdynamic - True if this will change text over time| Method Detail |
public void setText(java.lang.String text)
throws java.lang.IllegalStateException
text - The string to be rendered
java.lang.IllegalStateException - The label was not set up to be dynamic
in the constructor
public void setText(java.lang.String text,
boolean crop)
throws java.lang.IllegalStateException
text - The string to be renderedcrop - true to crop the underlying raster
java.lang.IllegalStateException - The label was not set up to be dynamic
in the constructor
public void setText(java.lang.String text,
java.awt.Color col)
throws java.lang.IllegalStateException
text - The string to be renderedcol - The new color to be used or null for the default (white)
java.lang.IllegalStateException - The label was not set up to be dynamic
in the constructor
public void setText(java.lang.String text,
java.awt.Color col,
boolean crop)
throws java.lang.IllegalStateException
text - The string to be renderedcol - The new color to be used or null for the default (white)crop - true to crop the underlying raster
java.lang.IllegalStateException - The label was not set up to be dynamic
in the constructor
public void fixSize(boolean fixed)
throws java.lang.IllegalStateException
fixed - true if the label size should remain fixed
java.lang.IllegalStateException - The label was not set up to be dynamic
in the constructor
public void crop()
throws java.lang.IllegalStateException
java.lang.IllegalStateException - The label was not set up to be dynamic
in the constructor
|
j3d.org Code | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||