SoText2 Class |
Screen-aligned 2D text shape node.
Namespace: OIV.Inventor.Nodes
The SoText2 type exposes the following members.
Name | Description | |
---|---|---|
AffectsState | Overrides default method on OIV.Inventor.Nodes.SoNode. | |
BeginShape(SoAction, SoShapeTriangleShapes) | Calls BeginShape(action, shapeType, (OIV.Inventor.Details.SoFaceDetail ^)nullptr). (Inherited from SoShape.) | |
BeginShape(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. | |
Callback | Implements primitive generation for all shapes. | |
ComputeBBox(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). | |
ComputeBBox(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). | |
Copy | Calls Copy(false). (Inherited from SoNode.) | |
Copy(Boolean) | Creates and returns an exact copy of the node. | |
CopyFieldValues(SoFieldContainer) | Calls CopyFieldValues(fc, false). (Inherited from SoFieldContainer.) | |
CopyFieldValues(SoFieldContainer, Boolean) | Copies the contents of fc's fields into this object's fields. | |
Dispose |
Releases all resources used by SoDisposable.
(Inherited from SoDisposable.) | |
Distribute | (Inherited from SoNode.) | |
DoAction | (Inherited from SoNode.) | |
EnableNotify | Notification at this Field Container is enabled (if flag == true) or disabled (if flag == false). | |
EndShape | end shape previously started with OIV.Inventor.Nodes.SoShape.BeginShape(OIV.Inventor.Actions.SoAction, OIV.Inventor.Nodes.SoShape.TriangleShapes, OIV.Inventor.Details.SoFaceDetail). | |
Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
FieldsAreEqual | Returns true if this object's fields are exactly equal to fc's fields. | |
Get | Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string. | |
GetAllFields | Returns a list of fields, including the eventIn's and eventOut's. | |
GetAlternateRep | Returns an alternative representation of this node for PDF and U3D exports. | |
GetBoundingBox | Implements bounding box method using virtual OIV.Inventor.Nodes.SoShape.ComputeBBox(OIV.Inventor.Actions.SoAction, OIV.Inventor.SbBox3f@, OIV.Inventor.SbVec3f@) method. | |
GetEventIn | Returns a the eventIn with the given name. | |
GetEventOut | Returns the eventOut with the given name. | |
GetField | Returns a the field of this object whose name is fieldName. | |
GetFieldName | Returns the name of the given field in the fieldName argument. | |
GetFields | Appends references to all of this object's fields to resultList, and returns the number of fields appended. | |
GetHashCode |
Overrides GetHashCode().
(Inherited from SoNetBase.) | |
GetMatrix | (Inherited from SoNode.) | |
GetName | Returns the name of an instance. | |
GetPrimitiveCount | Counts number of primitives produced by this shape. | |
GetRenderEngineMode | Returns the supported Render engine mode. | |
GetRenderUnitID | (Inherited from SoNode.) | |
GetShapeType | Gets the current shape Full Scene Antialiasing type. | |
GetStringName | (Inherited from SoBase.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GLRender | Implements rendering by rendering each primitive generated by subclass. | |
GLRenderBelowPath | (Inherited from SoNode.) | |
GLRenderInPath | (Inherited from SoNode.) | |
GLRenderOffPath | (Inherited from SoNode.) | |
GrabEventsCleanup | (Inherited from SoNode.) | |
GrabEventsSetup | (Inherited from SoNode.) | |
HandleEvent | (Inherited from SoNode.) | |
HasDefaultValues | Returns true if all of the object's fields have their default values. | |
IsBoundingBoxIgnoring | Used by BoundingBoxAction to know if bounding box computation should be ignored or not. | |
IsNotifyEnabled | Notification is the process of telling interested objects that this object has changed. | |
IsOverride | Returns the state of the override flag. | |
IsSynchronizable | Gets the ScaleViz synchronizable state of this object. | |
Pick | (Inherited from SoNode.) | |
RayPick | Implements picking along a ray by intersecting the ray with each primitive generated by subclass. | |
Search | (Inherited from SoNode.) | |
Set | 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. | |
SetName | (Inherited from SoBase.) | |
SetOverride | Turns the override flag on or off. | |
SetShapeType | set the antialiasing type for this shape. | |
SetSynchronizable | Sets this to be a ScaleViz synchronizable object. | |
SetToDefaults | Sets all fields in this object to their default values. | |
ShapeVertex | 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). | |
TestRayPick | ||
ToString |
Converts this SoBase structure to a human readable string.
(Inherited from SoBase.) | |
Touch | Marks an instance as modified, simulating a change to it. | |
Write | (Inherited from SoNode.) |
Name | Description | |
---|---|---|
boundingBoxIgnoring | Whether to ignore this node during bounding box traversal. | |
IsDisposable | ISafeDisposable interface implementation.
(Inherited from SoDisposable.) | |
justification | Specifies horizontal alignment of strings. | |
spacing | Defines the distance (in the negative y direction) between the base points of successive strings, measured with respect to the current font height. | |
stringField | The text string(s) to display. | |
UserData |
Gets or sets the user data to be contained by the field container.
(Inherited from SoFieldContainer.) |
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.
Text2 {
string | "" |
spacing | 1 |
justification | LEFT |
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.