public class TextBox extends SoAnnotation
Preview Feature means this class is fully supported and can be used in Open Inventor applications. Being tagged as a Preview Feature just means that the implementation is still subject to API changes and adjustments based on feedback from early adopters. Please be also aware that source compatibility might be broken regardless of the Open Inventor compatibility changes policy due to our commitment to bring needed changes to be sure the specifications of this Preview Feature match the expectations of our customers.
This node displays a text box at a fixed location in the viewer window.
The position
is specified in normalized device coordinates -1 to 1.
Horizontal alignmentH
and vertical alignmentV
can be specified. For example
position -0.98, -0.98, 0 with TOP/LEFT alignment (the default) puts a text
box in the upper left corner of the window. The text box automatically
expands or shrinks when lines of text are added to or deleted from the box.
Positioning a text box in the lower left corner creates a sort of 'console'
output overlaying the scene. Note that the alignment options control the
positioning of the text box. The text can be left, center or right justified
inside the box using the alignmentH
field.
In order to have convenient default values for the font properties, by
default the font properties are not inherited from the scene graph. By
default the text is rendered using an SoText2 node with font name
'Arial:Bold', font size 15 and line spacing 1.1. The application can modify
the fontName
and fontSize
fields or modify text properties directly using
the getFontNode() and getTextNode() methods.
Lighting and picking are disabled. A border
can be drawn around the box.
Text will be rendered on top of whatever is rendered in the main scene graph.
The application can modify the text strings directly, but this class also
provides some convenience methods that are very useful. For example, the
addLine() method appends a new string to the end of the list.
The bounding box of this node is ignored, i.e. it does not contribute to an SoGetBoundingBoxAction traversal and it does not affect a "viewAll" call on the camera or viewer.
File format/default:
TextBox {
position | 0 0 0 |
alignmentH | LEFT |
alignmentV | TOP |
textAlignH | LEFT |
fontName | Arial:Bold |
fontSize | 15 |
border | FALSE |
borderColor | 1 1 1 |
Modifier and Type | Class and Description |
---|---|
static class |
TextBox.AlignmentH
Horizontal alignment values.
|
static class |
TextBox.AlignmentV
Vertical alignment values.
|
SoSeparator.Cachings, SoSeparator.FastEditings, SoSeparator.RenderUnitIds
Inventor.ConstructorCommand
Modifier and Type | Field and Description |
---|---|
SoSFEnum<TextBox.AlignmentH> |
alignmentH
Horizontal alignment of the text box (default is LEFT).
|
SoSFEnum<TextBox.AlignmentV> |
alignmentV
Vertical alignment of the text box (default is TOP).
|
SoSFBool |
border
Enable drawing a border around the text box (default is false).
|
SoSFColor |
borderColor
Border color (default is 1,1,1).
|
SoSFString |
fontName
Specify the font name (default is "Arial:Bold").
|
SoSFFloat |
fontSize
Specify the font size in pixels (default is 15).
|
SoSFVec3f |
position
Position of the text box in normalized screen coordinates (-1 to 1).
|
SoSFEnum<TextBox.AlignmentH> |
textAlignH
Horizontal alignment of the text inside the box (default is LEFT).
|
AUTO, boundingBoxCaching, CLEAR_ZBUFFER, directVizCaching, DISABLE, fastEditing, KEEP_ZBUFFER, OFF, ON, pickCulling, renderCaching, renderCulling, renderUnitId
boundingBoxIgnoring
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
TextBox()
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addLine(java.lang.String text)
Add a line of text at the bottom of the box.
|
int |
getNumLines()
Get number of lines of text currently in the box
|
void |
setLine(java.lang.String text,
int line)
Set the contents of the specified line of text (convenience method).
|
getNumRenderCaches, setNumRenderCaches
addChild, findChild, getChild, getNumChildren, insertChild, removeAllChildren, removeChild, removeChild, replaceChild, replaceChild
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
dispose, getEXTERNPROTO, getName, getPROTO, isDisposable, isSynchronizable, setName, setSynchronizable
getAddress, getNativeResourceHandle, startInternalThreads, stopInternalThreads
public SoSFVec3f position
public SoSFEnum<TextBox.AlignmentH> alignmentH
public SoSFEnum<TextBox.AlignmentV> alignmentV
public SoSFEnum<TextBox.AlignmentH> textAlignH
public SoSFString fontName
public SoSFFloat fontSize
public SoSFBool border
public SoSFColor borderColor
public void setLine(java.lang.String text, int line)
public void addLine(java.lang.String text)
public int getNumLines()
Generated on January 23, 2025, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com