SoAsciiText(3)

NAME
SoAsciiText - The SoAsciiText class renders flat 3D text.

SYNOPSIS

#include <Inventor/nodes/SoAsciiText.h>

Inherits SoShape.

  Public Types
enum Justification { LEFT = 1, RIGHT, CENTER }

  Public Member Functions
virtual SoType getTypeId (void) const
SoAsciiText (void)
virtual void GLRender (SoGLRenderAction *action)
virtual void getPrimitiveCount (SoGetPrimitiveCountAction *action)

  Static Public Member Functions
static SoType getClassTypeId (void)
static void initClass (void)
Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system.

  Public Attributes
SoMFString string
SoSFFloat spacing
SoSFEnum justification
SoMFFloat width

  Protected Member Functions
virtual const SoFieldData * getFieldData (void) const
virtual ~SoAsciiText ()
virtual void computeBBox (SoAction *action, SbBox3f &box, SbVec3f &center)
virtual void generatePrimitives (SoAction *)
virtual SoDetail * createTriangleDetail (SoRayPickAction *action, const SoPrimitiveVertex *v1, const SoPrimitiveVertex *v2, const SoPrimitiveVertex *v3, SoPickedPoint *pp)
virtual void notify (SoNotList *list)

  Static Protected Member Functions
static const SoFieldData ** getFieldDataPtr (void)

  Additional Inherited Members

Detailed Description

The SoAsciiText class renders flat 3D text. The text is rendered using 3D polygon geometry.

The size of the textual geometry representation is decided from the SoFont::size field of a preceding SoFont-node in the scene graph, which specifies the size in unit coordinates. This value sets the approximate vertical size of the letters. The default value if no SoFont-nodes are used, is 10.

The complexity of the glyphs is controlled by a preceding SoComplexity node with Type set to OBJECT_SPACE. Please note that the default built-in 3D font will not be affected by the SoComplexity node.

This node is different from the SoText2 node in that it rotates, scales, translates etc just like other geometry in the scene. It is different from the SoText3 node in that it renders the text 'flat', i.e. does not extrude the fonts to have depth.

To get an intuitive feeling for how SoAsciiText works, take a look at this sample Inventor file in examiner viewer:

#Inventor V2.1 ascii
Separator {
  Font {
    size 10
    name 'Arial:Bold Italic'
  }
  BaseColor {
    rgb 1 0 0 #red
  }
  AsciiText {
    width [ 0, 1, 50 ]
    justification LEFT #Standard alignment
    string [ 'LEFT', 'LEFT', 'LEFT', 'LEFT', 'LEFT LEFT' ]
  }
  BaseColor {
    rgb 1 1 0
  }
  Sphere { radius 1.5 }
  Translation {
    translation 0 -50 0
  }
  BaseColor {
    rgb 0 1 0 #green
  }
  AsciiText {
    width [ 0, 1, 50 ]
    justification RIGHT
    string [ 'RIGHT', 'RIGHT', 'RIGHT', 'RIGHT', 'RIGHT RIGHT' ]
  }
  BaseColor {
    rgb 0 1 1
  }
  Sphere { radius 1.5 }
  Translation {
    translation 0 -50 0
  }
  BaseColor {
    rgb 0 0 1 #blue
  }
  AsciiText {
    width [ 0, 1, 50 ]
    justification CENTER
    string [ 'CENTER', 'CENTER', 'CENTER', 'CENTER', 'CENTER CENTER' ]
  }
  BaseColor {
    rgb 1 0 1
  }
  Sphere { radius 1.5 }
}

In examinerviewer the Inventor file looks something like this:

 Rendering of Example Scenegraph

FILE FORMAT/DEFAULTS:

AsciiText {
    string ""
    spacing 1
    justification LEFT
    width 0
}

See also
    SoFont, SoFontStyle, SoText2, SoText3

Since
    SGI Inventor 2.1

Member Enumeration Documentation

  enum SoAsciiText::Justification
Used to specify horizontal string alignment.

Enumerator

LEFT
    Left edges of strings are aligned.

RIGHT
    Right edges of strings are aligned.

CENTER
    Centers of strings are aligned.

Constructor & Destructor Documentation

  SoAsciiText::SoAsciiText (void)
Constructor.

  SoAsciiText::~SoAsciiText () [protected], [virtual]
Destructor.

Member Function Documentation

  SoType SoAsciiText::getClassTypeId (void) [static]
This static method returns the SoType object associated with objects of this class.

  SoType SoAsciiText::getTypeId (void) const [virtual]
Returns the type identification of an object derived from a class inheriting SoBase. This is used for runtime type checking and 'downward' casting.

Reimplemented from SoShape.

  const SoFieldData ** SoAsciiText::getFieldDataPtr (void) [static], [protected]
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
 Returns the SoFieldData class which holds information about fields in this node.

  const SoFieldData * SoAsciiText::getFieldData (void) const [protected], [virtual]
Returns a pointer to the class-wide field data storage object for this instance. If no fields are present, returns NULL.

Reimplemented from SoShape.

  void SoAsciiText::GLRender (SoGLRenderAction * action) [virtual]
Action method for the SoGLRenderAction.

This is called during rendering traversals. Nodes influencing the rendering state in any way or want to throw geometry primitives at OpenGL override this method.

Reimplemented from SoShape.

  void SoAsciiText::getPrimitiveCount (SoGetPrimitiveCountAction * action) [virtual]
Action method for the SoGetPrimitiveCountAction.

Calculates the number of triangle, line segment and point primitives for the node and adds these to the counters of the action.

Nodes influencing how geometry nodes calculate their primitive count also override this method to change the relevant state variables.

Reimplemented from SoShape.

  void SoAsciiText::computeBBox (SoAction * action, SbBox3f & box, SbVec3f & center) [protected], [virtual]
Implemented by SoShape subclasses to let the SoShape superclass know the exact size and weighted center point of the shape's bounding box.

The bounding box and center point should be calculated and returned in the local coordinate system.

The method implements action behavior for shape nodes for SoGetBoundingBoxAction. It is invoked from SoShape::getBoundingBox(). (Subclasses should not override SoNode::getBoundingBox().)

The box parameter sent in is guaranteed to be an empty box, while center is undefined upon function entry.

Implements SoShape.

  void SoAsciiText::generatePrimitives (SoAction * action) [protected], [virtual]
The method implements action behavior for shape nodes for SoCallbackAction. It is invoked from SoShape::callback(). (Subclasses should not override SoNode::callback().)

The subclass implementations uses the convenience methods SoShape::beginShape(), SoShape::shapeVertex(), and SoShape::endShape(), with SoDetail instances, to pass the primitives making up the shape back to the caller.

Implements SoShape.

  SoDetail * SoAsciiText::createTriangleDetail (SoRayPickAction * action, const SoPrimitiveVertex * v1, const SoPrimitiveVertex * v2, const SoPrimitiveVertex * v3, SoPickedPoint * pp) [protected], [virtual]
Will create triangle detail for a SoPickedPoint. This method will only be called internally, when generatePrimitives() is used for picking (SoShape::rayPick() is not overridden).

This method returns NULL in Open Inventor, and subclasses will need to override this method to create details for a SoPickedPoint.

This is not necessary with Coin. Of course, if you choose to override it, it will work in the same way as Open Inventor.

For this to work, you must supply a face or line detail when generating primitives. If you supply NULL for the detail argument in SoShape::beginShape(), you'll have to override this method.

Reimplemented from SoShape.

  void SoAsciiText::notify (SoNotList * l) [protected], [virtual]
Notifies all auditors for this instance when changes are made.

Reimplemented from SoShape.

Member Data Documentation

  SoMFString SoAsciiText::string
The set of strings to render. Each string in the multiple value field will be rendered on a separate line.

The default value of the field is a single empty string.

  SoSFFloat SoAsciiText::spacing
Vertical spacing between the baselines of two consecutive horizontal lines. Default value is 1.0, which means that it is equal to the vertical size of the highest character in the bitmap alphabet.

  SoSFEnum SoAsciiText::justification
Determines horizontal alignment of text strings.

If justification is set to SoAsciiText::LEFT, the left edge of the first string is at the origin and all strings are aligned with their left edges. If set to SoAsciiText::RIGHT, the right edge of the first string is at the origin and all strings are aligned with their right edges. Otherwise, if set to SoAsciiText::CENTER, the center of the first string is at the origin and all strings are aligned with their centers. The origin is always located at the baseline of the first line of text.

Default value is SoAsciiText::LEFT.

  SoMFFloat SoAsciiText::width
Defines the width of each line. The text is scaled to be within the specified units. The size of the characters will remain the same; only the X-positions are scaled. When width <= 0, the width value is ignored and the text rendered as normal. The exact width of the rendered text depends not only on the width field, but also on the maximum character width in the rendered string. The string will be attempted to fit within the specified width, but if it is unable to do so, it uses the largest character in the string as the width. If fewer widths are specified than the number of strings, the strings without matching widths are rendered with default width.

Author

Generated automatically by Doxygen for Coin from the source code.