Open Inventor Reference
SoText2 Class Reference

Internal class. More...

#include <Inventor/nodes/SoText2.h>

Inheritance diagram for SoText2:
SoShape SoNode SoFieldContainer SoBase

List of all members.

Public Types

enum  Justification { LEFT = 0x01, RIGHT = 0x02, CENTER = 0x03 }
 Justification types. More...

Public Member Functions

 SoText2 ()
 Creates a 2D text node with default settings.
virtual void GLRender (SoGLRenderAction *action)
 Implements rendering by rendering each primitive generated by subclass.
virtual void rayPick (SoRayPickAction *action)
 Implements picking along a ray by intersecting the ray with each primitive generated by subclass.

Static Public Member Functions

static void initClass ()
 Initializes base node class.

Public Attributes

Fields
SoMFString string
 The text string(s) to display.
SoSFFloat spacing
 Defines the distance (in the negative y direction) between the base points of successive strings, measured with respect to the current font height.
SoSFEnum justification
 Indicates placement and alignment of strings.

Protected Member Functions

virtual void generatePrimitives (SoAction *action)
 This method is a no-op for SoText2, since there are no primitives it can generate.
virtual void computeBBox (SoAction *action, SbBox3f &box, SbVec3f &center)
 Computes bounding box of text.
virtual ~SoText2 ()

Detailed Description

Screen-aligned 2D text shape node.

This node defines one or more strings of 2D text. The text is always aligned horizontally with the screen and does not change size with distance in a perspective projection. The text origin is at (0,0,0) after applying the current transformation. Rotations and scales have no effect on the orientation or size of 2D text, just the location.

SoText2 uses the current font to determine the typeface and size. The text is always drawn with the diffuse color of the current material; it is not lit, regardless of the lighting model. Furthermore, 2D text can not be textured, and it ignores the current drawing style and complexity.

Because 2D text is screen-aligned, it has some unusual characteristics. For example, the 3D bounding box surrounding a 2D text string depends on the current camera and the current viewport size, since changing the field of view or the mapping onto the window changes the relative size of the text with respect to the rest of the scene. This has implications for caching as well, since a render cache in an SoSeparator that contains an SoText2 node depends on the current camera.

File Format/Default
Text2 {
  string ""
  spacing 1
  justification LEFT
}
Action Behavior
SoGLRenderAction
Draws text based on the current font, at a location based on the current transformation.
SoRayPickAction
Performs a pick on the text. Text will be picked if the picking ray intersects the bounding box of the strings. The string index and character position are available from the SoTextDetail.
SoGetBoundingBoxAction
Computes the bounding box that encloses the text.
See Also
SoFont, SoText3, SoTextDetail

Definition at line 122 of file SoText2.h.


Member Enumeration Documentation

Enumerator:
LEFT 
RIGHT 
CENTER 

Definition at line 128 of file SoText2.h.


Constructor & Destructor Documentation

SoText2::SoText2 ( )
virtual SoText2::~SoText2 ( ) [protected, virtual]

Member Function Documentation

virtual void SoText2::computeBBox ( SoAction action,
SbBox3f box,
SbVec3f center 
) [protected, virtual]

Implements SoShape.

virtual void SoText2::generatePrimitives ( SoAction action) [protected, virtual]

Implements SoShape.

virtual void SoText2::GLRender ( SoGLRenderAction action) [virtual]

May be overridden in subclass.

Reimplemented from SoShape.

static void SoText2::initClass ( ) [static]

Reimplemented from SoShape.

virtual void SoText2::rayPick ( SoRayPickAction action) [virtual]

May be overridden in subclass.

Reimplemented from SoShape.


Member Data Documentation

With LEFT justification, the left edge of the first line is at the (transformed) origin, and all left edges are aligned. RIGHT justification is similar. CENTER justification places the center of the first string at the (transformed) origin, with the centers of all remaining strings aligned under it.

Definition at line 153 of file SoText2.h.

A value of 1 indicates single spacing, a value of 2 indicates double spacing, and so on.

Definition at line 145 of file SoText2.h.

Each string will appear on its own line. The string(s) can be ascii or UTF-8.

Definition at line 139 of file SoText2.h.


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