|
Aviatrix3D 2.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.j3d.aviatrix3d.SceneGraphObject org.j3d.aviatrix3d.NodeComponent org.j3d.aviatrix3d.Geometry org.j3d.renderer.aviatrix3d.geom.Text2D
public class Text2D
Flat, ploygonalised 2D text representation.
A single line of text is normalise to always be one unit high regardless of
the original font size. The relative size can then be changed using a
multiplication factor, though the polygonalisation stays the same. If using
large text, and need fine polygonalisation, then making use of a custom
CharacterCreator
with a large point size font and finer
flatness would be recommended.
Because all the methods for setting values in this class can influence the final bounds of the object, they are all required to use the boundsChanged() callback from NodeUpdateListener.
Since the text is 2D, it has no depth. If an intersection test is created such that the ray is parallel to the local X-Y plane and does not change in Z depth, then no intersection will be generated. The implementation attempts to optimise the testing based on the bounds of the individual character before checking polygons.
The default setup following construction follows English requirements:
horizontal: true
leftToRight: true
topToBottom: true
size: 1.0
spacing: 1.0
horizontal justification: JUSTIFY_BEGIN
vertical justification: JUSTIFY_BEGIN
Field Summary | |
---|---|
static int |
JUSTIFY_BEGIN
Justify to the beginning of the line |
static int |
JUSTIFY_END
Justify to the end of the string |
static int |
JUSTIFY_FIRST
Justify to the first character of the line |
static int |
JUSTIFY_MIDDLE
Justify about the middle |
Fields inherited from class org.j3d.aviatrix3d.Geometry |
---|
bounds, implicitBounds, internalUpdater, INVALID_BOUNDS, lastParentList, parentList, pickFlags, validAlpha |
Fields inherited from class org.j3d.aviatrix3d.NodeComponent |
---|
lastParent, liveCount |
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject |
---|
alive, LISTENER_SET_TIMING_ERR_PROP, updateHandler |
Fields inherited from interface org.j3d.aviatrix3d.picking.PickableObject |
---|
COLLIDABLE_OBJECT, GENERAL_OBJECT, PROXIMITY_OBJECT, VISIBLE_OBJECT |
Fields inherited from interface org.j3d.aviatrix3d.picking.PickTarget |
---|
CUSTOM_PICK_TYPE, GROUP_PICK_TYPE, LEAF_PICK_TYPE, SINGLE_PICK_TYPE |
Constructor Summary | |
---|---|
Text2D()
Create a new, default text representation. |
|
Text2D(org.j3d.geom.CharacterCreator charGen)
Create a new text representation using the provided CharacterCreator . |
Method Summary | |
---|---|
int |
compareTo(java.lang.Object o)
Compares this object with the specified object for order. |
int |
compareTo(Text2D txt)
Compares this object with the specified object for order. |
boolean |
equals(java.lang.Object o)
Compare this object for equality to the given object. |
boolean |
equals(Text2D txt)
Compares this object with the specified object to check for equivalence. |
float |
getHorizontalJustification()
Get the value of the line size multiplier. |
float |
getSize()
Get the value of the line size multiplier. |
float |
getSpacing()
Get the value of the line spacing multiplier. |
java.lang.String[] |
getText()
Get a reference to the currently set collection of strings. |
float |
getVerticalJustification()
Get the value of the line size multiplier. |
boolean |
is2D()
Check to see whether this shape is something that represents 2D or 3D geometry. |
boolean |
isHorizontal()
Get the state of the horizontal rendering flag. |
boolean |
isLeftToRight()
Get the state of the left to right rendering flag. |
boolean |
isTopToBottom()
Get the state of the top to bottom rendering flag. |
protected boolean |
isVisible()
Check to see if this geometry is making the geometry visible or not. |
boolean |
pickLineRay(float[] origin,
float[] direction,
boolean findAny,
float[] dataOut,
int dataOutFlags)
Check for all intersections against this geometry using a line ray and return the exact distance away of the closest picking point. |
boolean |
pickLineSegment(float[] start,
float[] end,
boolean findAny,
float[] dataOut,
int dataOutFlags)
Check for all intersections against this geometry using a line segment and return the exact distance away of the closest picking point. |
void |
postRender(javax.media.opengl.GL gl)
|
protected void |
recomputeBounds()
Internal method to recalculate the implicit bounds of this Node. |
void |
render(javax.media.opengl.GL gl)
This method is called to render this node. |
void |
setCharacterCreator(org.j3d.geom.CharacterCreator charGen)
Replace the internal character generator with another. |
void |
setHorizontal(boolean horizontal)
Change whether the text should be rendered vertically or horizontally. |
void |
setHorizontalJustification(int justify)
Change the horizontal justification of the text. |
void |
setLeftToRight(boolean leftToRight)
Change whether the text should be placing characters left to right or right to left. |
protected void |
setLive(boolean state)
Notification that this object is live now. |
void |
setSize(float size)
Change size multiplier of a single row of text. |
void |
setSpacing(float spacing)
Change spacing multiplier between rows of text. |
void |
setText(java.lang.String[] text,
int numText)
Set the list of strings that you want to have rendered. |
void |
setTopToBottom(boolean topToBottom)
Change whether the text should be placed from top to bottom or bottom to top. |
void |
setVerticalJustification(int justify)
Change the vertical justification of the text. |
Methods inherited from class org.j3d.aviatrix3d.Geometry |
---|
addParent, boundsChanged, checkPickMask, getBounds, getPickableBounds, getPickMask, getPickTargetType, hasTransparency, markBoundsDirty, pickBatch, pickSingle, removeParent, setBounds, setPickMask, updateBounds |
Methods inherited from class org.j3d.aviatrix3d.NodeComponent |
---|
addParent, getParents, numParents, removeParent |
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject |
---|
checkForCyclicChild, checkForCyclicParent, dataChanged, getAppUpdateWriteTimingMessage, getBoundsWriteTimingMessage, getDataWriteTimingMessage, getUserData, isLive, setUpdateHandler, setUserData |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int JUSTIFY_FIRST
public static final int JUSTIFY_BEGIN
public static final int JUSTIFY_MIDDLE
public static final int JUSTIFY_END
Constructor Detail |
---|
public Text2D()
public Text2D(org.j3d.geom.CharacterCreator charGen)
CharacterCreator
. If the argument is null, then
the default generator is used.
charGen
- The creator of characters to use, or nullMethod Detail |
---|
public void render(javax.media.opengl.GL gl)
gl
- The gl context to draw withpublic void postRender(javax.media.opengl.GL gl)
public int compareTo(java.lang.Object o) throws java.lang.ClassCastException
o
- The objec to be compared
java.lang.ClassCastException
- The specified object's type prevents it from
being compared to this Objectpublic boolean equals(java.lang.Object o)
equals
in interface Renderable
equals
in class java.lang.Object
o
- The object to be compared
protected boolean isVisible()
isVisible
in class Geometry
public boolean is2D()
EffectRenderable
, while 3D is.
Note that this can be changed depending on the type of geometry itself.
A Shape3D node with an IndexedLineArray that only has 2D coordinates is
as much a 2D geometry as a raster object.
is2D
in class Geometry
protected void setLive(boolean state)
setLive
in class SceneGraphObject
state
- true if this should be marked as live nowprotected void recomputeBounds()
recomputeBounds
in class Geometry
public boolean pickLineSegment(float[] start, float[] end, boolean findAny, float[] dataOut, int dataOutFlags) throws NotPickableException
pickLineSegment
in interface LeafPickTarget
pickLineSegment
in class Geometry
start
- The start point of the segmentend
- The end point of the segmentfindAny
- True if it only has to find a single intersection and can
exit as soon as it finds the first intersection. False if it must find
the closest polygondataOut
- An array to put the data in for the intersection. Exact
format is described by the flagsdataOutFlags
- A set of derived-class specific flags describing what
data should be included in the output array
NotPickableException
- This object has been marked as non pickable,
but you decided to try to call the method anywaypublic boolean pickLineRay(float[] origin, float[] direction, boolean findAny, float[] dataOut, int dataOutFlags) throws NotPickableException
pickLineRay
in interface LeafPickTarget
pickLineRay
in class Geometry
origin
- The start point of the raydirection
- The direction vector of the rayfindAny
- True if it only has to find a single intersection and can
exit as soon as it finds the first intersection. False if it must find
the closest polygondataOut
- An array to put the data in for the intersection. Exact
format is described by the flagsdataOutFlags
- A set of derived-class specific flags describing what
data should be included in the output array
NotPickableException
- This object has been marked as non pickable,
but you decided to try to call the method anywaypublic void setCharacterCreator(org.j3d.geom.CharacterCreator charGen)
charGen
- The creator of characters to use, or nullpublic void setText(java.lang.String[] text, int numText)
text
- An array of strings to rendernumText
- The number of strings to render
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener bounds callback methodpublic java.lang.String[] getText()
public void setHorizontal(boolean horizontal) throws InvalidWriteTimingException
horizontal
- true if the text should be rendered horizontally
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener bounds callback methodpublic boolean isHorizontal()
public void setLeftToRight(boolean leftToRight) throws InvalidWriteTimingException
leftToRight
- true if the text should be rendered leftToRightly
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener bounds callback methodpublic boolean isLeftToRight()
public void setTopToBottom(boolean topToBottom) throws InvalidWriteTimingException
topToBottom
- true if the text should be rendered top to bottom
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener bounds callback methodpublic boolean isTopToBottom()
public void setSpacing(float spacing) throws InvalidWriteTimingException, java.lang.IllegalArgumentException
spacing
- true if the text should be rendered horizontally
java.lang.IllegalArgumentException
- The value was not positive
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener bounds callback methodpublic float getSpacing()
public void setSize(float size) throws InvalidWriteTimingException, java.lang.IllegalArgumentException
size
- true if the text should be rendered horizontally
java.lang.IllegalArgumentException
- The value was not positive
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener bounds callback methodpublic float getSize()
public void setHorizontalJustification(int justify) throws InvalidWriteTimingException, java.lang.IllegalArgumentException
justify
- One of the JUSTIFY_ values
java.lang.IllegalArgumentException
- The value was not valid
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener bounds callback methodpublic float getHorizontalJustification()
public void setVerticalJustification(int justify) throws InvalidWriteTimingException, java.lang.IllegalArgumentException
justify
- One of the JUSTIFY_ values
java.lang.IllegalArgumentException
- The value was not valid
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener bounds callback methodpublic float getVerticalJustification()
public int compareTo(Text2D txt)
txt
- The argument instance to be compared
public boolean equals(Text2D txt)
txt
- The Text2D instance to be compared
|
Aviatrix3D 2.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |