Class TextBox
- All Implemented Interfaces:
SafeDisposable
- Direct Known Subclasses:
DicomInfo
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 |
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Horizontal alignment values.static enum
Vertical alignment values.Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoSeparator
SoSeparator.Cachings, SoSeparator.FastEditings, SoSeparator.RenderUnitIds
Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoNode
SoNode.RenderModes
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
Field Summary
FieldsModifier and TypeFieldDescriptionHorizontal alignment of the text box (default is LEFT).Vertical alignment of the text box (default is TOP).Enable drawing a border around the text box (default is false).Border color (default is 1,1,1).Specify the font name (default is "Arial:Bold").Specify the font size in pixels (default is 15).Position of the text box in normalized screen coordinates (-1 to 1).Horizontal alignment of the text inside the box (default is LEFT).Fields inherited from class com.openinventor.inventor.nodes.SoSeparator
boundingBoxCaching, fastEditing, pickCulling, renderCaching, renderCulling, renderUnitId
Fields inherited from class com.openinventor.inventor.nodes.SoGroup
boundingBoxIgnoring
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a line of text at the bottom of the box.int
Get number of lines of text currently in the boxReturns the supported Render engine mode.void
Set the contents of the specified line of text (convenience method).Methods inherited from class com.openinventor.inventor.nodes.SoGroup
addChild, findChild, getChild, getNumChildren, insertChild, removeAllChildren, removeChild, removeChild, replaceChild, replaceChild
Methods inherited from class com.openinventor.inventor.nodes.SoNode
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
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
Field Details
-
position
Position of the text box in normalized screen coordinates (-1 to 1). Default is 0,0,0. -
alignmentH
Horizontal alignment of the text box (default is LEFT). -
alignmentV
Vertical alignment of the text box (default is TOP). -
textAlignH
Horizontal alignment of the text inside the box (default is LEFT). -
fontName
Specify the font name (default is "Arial:Bold"). See SoFont.name for details -
fontSize
Specify the font size in pixels (default is 15). -
border
Enable drawing a border around the text box (default is false). -
borderColor
Border color (default is 1,1,1).
-
-
Constructor Details
-
TextBox
public TextBox()Constructor
-
-
Method Details
-
setLine
Set the contents of the specified line of text (convenience method). -
addLine
Add a line of text at the bottom of the box. -
getNumLines
public int getNumLines()Get number of lines of text currently in the box -
getRenderEngineMode
Description copied from class:SoNode
Returns the supported Render engine mode.For custom node, this method returns by default
SoNode.RenderModes.OIV_UNKNOWN_RENDERING_MODE
, override this method to specify the Render engine mode supported by your custom node.- Overrides:
getRenderEngineMode
in classSoNode
- Returns:
- the supported Render engine mode for this node.
-