TextBox Class Reference

VSG extension [PREVIEW] [Medical] Shape node to display a text box in window coordinates. More...

#include <Medical/nodes/TextBox.h>

Inheritance diagram for TextBox:
SoAnnotation SoSeparator SoGroup SoNode SoFieldContainer SoBase SoRefCounter SoTypedObject DicomInfo

List of all members.

Public Types

enum  AlignmentH {
  LEFT = SoTextProperty::LEFT,
  CENTER = SoTextProperty::CENTER,
  RIGHT = SoTextProperty::RIGHT
enum  AlignmentV {
  TOP = SoTextProperty::TOP,
  MIDDLE = SoTextProperty::HALF,
  BOTTOM = SoTextProperty::BOTTOM

Public Member Functions

virtual SoType getTypeId () const
void setLine (const SbString &text, int line=0)
const SbStringgetLine (int line)
void addLine (const SbString &text)
void deleteLines (int startLine, int numToDelete=1)
void deleteAll ()
int getNumLines () const
SoFontgetFontNode ()
SoText2getTextNode ()
 TextBox ()

Static Public Member Functions

static SoType getClassTypeId ()
static void initClass ()
static void exitClass ()

Public Attributes

SoSFVec3f position
SoSFEnum alignmentH
SoSFEnum alignmentV
SoSFEnum textAlignH
SoSFString fontName
SoSFFloat fontSize
SoSFBool border
SoSFColor borderColor

Detailed Description

VSG extension [PREVIEW] [Medical] Shape node to display a text box in window coordinates.

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 textAlignH 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.

If you are using one of the Open Inventor viewer classes (e.g. SoWinExaminerViewer). You must explicitly create a camera node (e.g. SoPerspectiveCamera) and add it to the scene graph. The viewer will not automatically create a camera, because it will find the camera in this node's internal scene graph.



InventorMedical, DicomInfo, Gnomon, Magnifier, Ruler

What is a Preview Feature ?:

Member Enumeration Documentation

Horizontal alignment values.


Left edge.




Right edge.

Vertical alignment values.


Top edge.




Bottom edge.

Constructor & Destructor Documentation

TextBox::TextBox (  ) 


Member Function Documentation

void TextBox::addLine ( const SbString text  ) 

Add a line of text at the bottom of the box.

void TextBox::deleteAll (  ) 

Delete all lines of text.

void TextBox::deleteLines ( int  startLine,
int  numToDelete = 1 

Delete one or more lines of text.

'startLine' is the first line to delete.
'numToDelete' is the number of lines to delete. Default (1) is to delete one line. -1 means delete all lines starting with 'startLine'.

static void TextBox::exitClass (  )  [static]

Finish using the class.

Reimplemented from SoAnnotation.

Reimplemented in DicomInfo.

static SoType TextBox::getClassTypeId (  )  [static]

Returns the type identifier for this class.

Reimplemented from SoAnnotation.

Reimplemented in DicomInfo.

SoFont* TextBox::getFontNode (  ) 

Get the internal font node (allows to modify font parameters directly).

const SbString& TextBox::getLine ( int  line  ) 

Get the contents of the specified line of text.

int TextBox::getNumLines (  )  const

Get number of lines of text currently in the box.

SoText2* TextBox::getTextNode (  ) 

Get the internal text node (allows to modify line spacing directly).

virtual SoType TextBox::getTypeId (  )  const [virtual]

Returns the type identifier for this specific instance.

Reimplemented from SoAnnotation.

Reimplemented in DicomInfo.

static void TextBox::initClass (  )  [static]

Initialize the class.

Reimplemented from SoAnnotation.

Reimplemented in DicomInfo.

void TextBox::setLine ( const SbString text,
int  line = 0 

Set the contents of the specified line of text (convenience method).

Member Data Documentation

Horizontal 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").

See SoFont::name for details.

Specify the font size in pixels (default is 15).

Position of the text box in normalized screen coordinates (-1 to 1).

Default is 0,0,0.

Horizontal alignment of the text inside the box (default is LEFT).

The documentation for this class was generated from the following file:

Open Inventor Toolkit reference manual, generated on 12 Sep 2022
Copyright © Thermo Fisher Scientific All rights reserved.