Click or drag to resize
SoText2 Class

Screen-aligned 2D text shape node.

Inheritance Hierarchy

Namespace: OIV.Inventor.Nodes
Assembly: OIV.Inventor (in OIV.Inventor.dll) Version: 10.12.3.0 (10.12.3.0)
Syntax
public class SoText2 : SoShape

The SoText2 type exposes the following members.

Constructors
  NameDescription
Public methodSoText2

Creates a 2D text node with default settings.

Top
Methods
  NameDescription
Public methodAffectsState

Overrides default method on OIV.Inventor.Nodes.SoNode.

(Inherited from SoShape.)
Public methodBeginShape(SoAction, SoShapeTriangleShapes)
Calls BeginShape(action, shapeType, (OIV.Inventor.Details.SoFaceDetail ^)nullptr).
(Inherited from SoShape.)
Public methodBeginShape(SoAction, SoShapeTriangleShapes, SoFaceDetail)

These methods can be used by subclasses to generate triangles more easily when those triangles are part of a larger structure, such as a triangle strip, triangle fan, or triangulated polygon, according to the TriangleShape enumerated type.

(Inherited from SoShape.)
Public methodCallback

Implements primitive generation for all shapes.

(Inherited from SoShape.)
Public methodComputeBBox(SoAction, SbXfBox3d, SbVec3d)

Compute object oriented bounding box (OOB) for subclass using information in the given action (which may not necessarily be an OIV.Inventor.Actions.SoGetBoundingBoxAction).

(Inherited from SoShape.)
Public methodComputeBBox(SoAction, SbBox3f, SbVec3f)

Compute axis aligned bounding box (AABB) for subclass using information in the given action (which may not necessarily be an OIV.Inventor.Actions.SoGetBoundingBoxAction).

(Overrides SoShapeComputeBBox(SoAction, SbBox3f, SbVec3f).)
Public methodCopy
Calls Copy(false).
(Inherited from SoNode.)
Public methodCopy(Boolean)

Creates and returns an exact copy of the node.

(Inherited from SoNode.)
Public methodCopyFieldValues(SoFieldContainer)
Calls CopyFieldValues(fc, false).
(Inherited from SoFieldContainer.)
Public methodCopyFieldValues(SoFieldContainer, Boolean)

Copies the contents of fc's fields into this object's fields.

(Inherited from SoFieldContainer.)
Public methodDispose
Releases all resources used by SoDisposable.
(Inherited from SoDisposable.)
Public methodDistribute
(Inherited from SoNode.)
Public methodDoAction
(Inherited from SoNode.)
Public methodEnableNotify

Notification at this Field Container is enabled (if flag == true) or disabled (if flag == false).

(Inherited from SoFieldContainer.)
Public methodEndShape

end shape previously started with OIV.Inventor.Nodes.SoShape.BeginShape(OIV.Inventor.Actions.SoAction, OIV.Inventor.Nodes.SoShape.TriangleShapes, OIV.Inventor.Details.SoFaceDetail).

(Inherited from SoShape.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodFieldsAreEqual

Returns true if this object's fields are exactly equal to fc's fields.

(Inherited from SoFieldContainer.)
Public methodGet

Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.

(Inherited from SoFieldContainer.)
Public methodGetAllFields

Returns a list of fields, including the eventIn's and eventOut's.

(Inherited from SoFieldContainer.)
Public methodGetAlternateRep

Returns an alternative representation of this node for PDF and U3D exports.

(Overrides SoNodeGetAlternateRep(SoAction).)
Public methodGetBoundingBox

Implements bounding box method using virtual OIV.Inventor.Nodes.SoShape.ComputeBBox(OIV.Inventor.Actions.SoAction, OIV.Inventor.SbBox3f@, OIV.Inventor.SbVec3f@) method.

(Inherited from SoShape.)
Public methodGetEventIn

Returns a the eventIn with the given name.

(Inherited from SoFieldContainer.)
Public methodGetEventOut

Returns the eventOut with the given name.

(Inherited from SoFieldContainer.)
Public methodGetField

Returns a the field of this object whose name is fieldName.

(Inherited from SoFieldContainer.)
Public methodGetFieldName

Returns the name of the given field in the fieldName argument.

(Inherited from SoFieldContainer.)
Public methodGetFields

Appends references to all of this object's fields to resultList, and returns the number of fields appended.

(Inherited from SoFieldContainer.)
Public methodGetHashCode
Overrides GetHashCode().
(Inherited from SoNetBase.)
Public methodGetMatrix
(Inherited from SoNode.)
Public methodGetName

Returns the name of an instance.

(Inherited from SoBase.)
Public methodGetPrimitiveCount

Counts number of primitives produced by this shape.

(Overrides SoShapeGetPrimitiveCount(SoGetPrimitiveCountAction).)
Public methodGetRenderEngineMode

Returns the supported Render engine mode.

(Inherited from SoNode.)
Public methodGetRenderUnitID
(Inherited from SoNode.)
Public methodGetShapeType

Gets the current shape Full Scene Antialiasing type.

(Inherited from SoShape.)
Public methodGetStringName (Inherited from SoBase.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGLRender

Implements rendering by rendering each primitive generated by subclass.

(Overrides SoShapeGLRender(SoGLRenderAction).)
Public methodGLRenderBelowPath
(Inherited from SoNode.)
Public methodGLRenderInPath
(Inherited from SoNode.)
Public methodGLRenderOffPath
(Inherited from SoNode.)
Public methodGrabEventsCleanup
(Inherited from SoNode.)
Public methodGrabEventsSetup
(Inherited from SoNode.)
Public methodHandleEvent
(Inherited from SoNode.)
Public methodHasDefaultValues

Returns true if all of the object's fields have their default values.

(Inherited from SoFieldContainer.)
Public methodIsBoundingBoxIgnoring

Used by BoundingBoxAction to know if bounding box computation should be ignored or not.

(Inherited from SoShape.)
Public methodIsNotifyEnabled

Notification is the process of telling interested objects that this object has changed.

(Inherited from SoFieldContainer.)
Public methodIsOverride

Returns the state of the override flag.

(Inherited from SoNode.)
Public methodIsSynchronizable

Gets the ScaleViz synchronizable state of this object.

(Inherited from SoBase.)
Public methodPick
(Inherited from SoNode.)
Public methodRayPick

Implements picking along a ray by intersecting the ray with each primitive generated by subclass.

(Overrides SoShapeRayPick(SoRayPickAction).)
Public methodSearch
(Inherited from SoNode.)
Public methodSet

Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.

(Inherited from SoFieldContainer.)
Public methodSetName (Inherited from SoBase.)
Public methodSetOverride

Turns the override flag on or off.

(Inherited from SoNode.)
Public methodSetShapeType

set the antialiasing type for this shape.

(Inherited from SoShape.)
Public methodSetSynchronizable

Sets this to be a ScaleViz synchronizable object.

(Inherited from SoBase.)
Public methodSetToDefaults

Sets all fields in this object to their default values.

(Inherited from SoFieldContainer.)
Public methodShapeVertex

add a primitive vertex to the shape prevously started with OIV.Inventor.Nodes.SoShape.BeginShape(OIV.Inventor.Actions.SoAction, OIV.Inventor.Nodes.SoShape.TriangleShapes, OIV.Inventor.Details.SoFaceDetail).

(Inherited from SoShape.)
Public methodTestRayPick
Public methodToString
Converts this SoBase structure to a human readable string.
(Inherited from SoBase.)
Public methodTouch

Marks an instance as modified, simulating a change to it.

(Inherited from SoNode.)
Public methodWrite
(Inherited from SoNode.)
Top
Properties
  NameDescription
Public propertyboundingBoxIgnoring

Whether to ignore this node during bounding box traversal.

(Inherited from SoShape.)
Public propertyIsDisposable
ISafeDisposable interface implementation.
(Inherited from SoDisposable.)
Public propertyjustification

Specifies horizontal alignment of strings.

Public propertyspacing

Defines the distance (in the negative y direction) between the base points of successive strings, measured with respect to the current font height.

Public propertystringField

The text string(s) to display.

Public propertyUserData
Gets or sets the user data to be contained by the field container.
(Inherited from SoFieldContainer.)
Top
Remarks

This node defines one or more strings of 2D text. The text is always horizontal, aligned with the screen and does not change size with distance from the camera. However the position of the text is specified in 3D units and is affected by viewing and modeling transformations. 2D text cannot be rotated, but because it always faces the user, it is often used for annotation, for example labels on axes.

The text position is always at the local origin (0,0,0). Rotations and scales have no effect on the orientation or size of 2D text, just the location.

Note: A transform node, e.g. OIV.Inventor.Nodes.SoTranslation, must be used to position the text in 3D space.

Text supports both single byte Latin1 (ISO8859-1) characters and multi-byte UNICODE characters. ISO8859-1 is an 8-bit character set which is a superset of the older 7-bit ASCII character set. See the String class for more information.

Rendering:

The typeface and size (default = 10) are specified using an OIV.Inventor.Nodes.SoFont node. Note that for OIV.Inventor.Nodes.SoText2 the size is interpreted as a value in pixels, not 3D units.

Setting the OIV.Inventor.Nodes.SoFont renderStyle field to TEXTURE is recommended for best appearance and performance. (antialiasing is applied).

Additional rendering styles can be applied using an OIV.Inventor.Nodes.SoTextProperty node, including underline, overline, strikethrough, background and background outline.

OIV.Inventor.Nodes.SoText2 is drawn using the diffuse color of the current material (OIV.Inventor.Nodes.SoMaterial). Lighting is not applied, regardless of the lighting model. Textures do not affect OIV.Inventor.Nodes.SoText2 (note this is independent of the fact that textures are used internally to render OIV.Inventor.Nodes.SoText2). Complexity (OIV.Inventor.Nodes.SoComplexity) does not affect OIV.Inventor.Nodes.SoText2. Drawing styles (OIV.Inventor.Nodes.SoDrawStyle) other than INVISIBLE do not affect OIV.Inventor.Nodes.SoText2.

Justification:

Horizontal alignment of the text can be specified using the OIV.Inventor.Nodes.SoText2.justification field. Both horizontal and vertical alignment can be controlled using an OIV.Inventor.Nodes.SoTextProperty node, however the justification setting in the OIV.Inventor.Nodes.SoText2 node overrides the horizontal setting unless it is explicitly set to INHERITED.

Clipping:

If the transformed position (origin point) of the OIV.Inventor.Nodes.SoText2 is clipped, then the entire string is clipped, even if some part of the string should conceptually be visible. If the origin point is inside the view volume then the string is clipped similar to other geometry.

Bounding box:

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.

When computing the bounding box of a 2D text node (see OIV.Inventor.Actions.SoGetBoundingBoxAction), be careful to:

  • Initialize the bounding box action with the correct viewport region. Typically this information is queried from the viewer.

  • Make sure the action will traverse the camera node. Apply the action to a node above the camera or create a path to the 2D text node from the root of the scene graph (e.g. using OIV.Inventor.Actions.SoSearchAction).

Picking:

Text can be picked (OIV.Inventor.Actions.SoRayPickAction) like any other geometry. If a text node has been picked then OIV.Inventor.SoPickedPoint can return an OIV.Inventor.Details.SoTextDetail object. This object contains information about which string (in a multi-string text node) was picked and which character within the string was picked.

Render caching:

If your Open Inventor version is older than 9.2, then OIV.Inventor.Nodes.SoText2 nodes using CENTER or RIGHT justification cannot be render cached because the bounding box and justification offset depend on the camera. As a result, no OIV.Inventor.Nodes.SoSeparator above the OIV.Inventor.Nodes.SoText2 will be able to build a render cache or a bounding box cache and this can reduce performance. If possible put other geometry, that can be cached, under its own OIV.Inventor.Nodes.SoSeparator. OIV.Inventor.Nodes.SoText2 nodes using LEFT justification (the default) can be cached. Since Open Inventor 9.2, OIV.Inventor.Nodes.SoText2 nodes can be render cached in all cases.

Antialiasing: Shape Antialiasing type is OIV.Inventor.Nodes.SoShape.ShapeTypes.TEXT.

Export limitations:

  • OIV.Inventor.Nodes.SoText2 can be exported to PDF3D/U3D (OIV.HardCopy.SoToPDFAction), but... due to limitations of that file format, the text will not be "screen locked".

  • OIV.Inventor.Nodes.SoText2 can be exported to various Hardcopy formats (OIV.HardCopy.SoVectorizeAction), but... native fonts are used, so the requested font name must be available on the rendering device.

FILE FORMAT/DEFAULT

Text2 {
string ""
spacing 1
justification LEFT
}

ACTION BEHAVIOR

OIV.Inventor.Actions.SoGLRenderAction Draws text based on the current font, at a location based on the current transformation.

OIV.Inventor.Actions.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 OIV.Inventor.Details.SoTextDetail.

OIV.Inventor.Actions.SoGetBoundingBoxAction Computes the bounding box that encloses the text.

See Also