Class TextBox
- java.lang.Object
-
- All Implemented Interfaces:
SafeDisposable
- Direct Known Subclasses:
DicomInfo
public class TextBox extends SoAnnotation
(Preview Feature) Shape node to display a text box in window coordinates.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. HorizontalalignmentH
and verticalalignmentV
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 thealignmentH
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
andfontSize
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TextBox.AlignmentH
Horizontal alignment values.static class
TextBox.AlignmentV
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
Fields Modifier and Type Field 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).-
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 Constructor Description TextBox()
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 boxSoNode.RenderModes
getRenderEngineMode()
Returns the supported Render engine mode.void
setLine(java.lang.String text, int line)
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 Detail
-
position
public SoSFVec3f position
Position of the text box in normalized screen coordinates (-1 to 1). Default is 0,0,0.
-
alignmentH
public SoSFEnum<TextBox.AlignmentH> alignmentH
Horizontal alignment of the text box (default is LEFT).
-
alignmentV
public SoSFEnum<TextBox.AlignmentV> alignmentV
Vertical alignment of the text box (default is TOP).
-
textAlignH
public SoSFEnum<TextBox.AlignmentH> textAlignH
Horizontal alignment of the text inside the box (default is LEFT).
-
fontName
public SoSFString fontName
Specify the font name (default is "Arial:Bold"). See SoFont.name for details
-
fontSize
public SoSFFloat fontSize
Specify the font size in pixels (default is 15).
-
border
public SoSFBool border
Enable drawing a border around the text box (default is false).
-
borderColor
public SoSFColor borderColor
Border color (default is 1,1,1).
-
-
Method Detail
-
setLine
public void setLine(java.lang.String text, int line)
Set the contents of the specified line of text (convenience method).
-
addLine
public void addLine(java.lang.String text)
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
public SoNode.RenderModes 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.
-
-