Open Inventor Reference
SoSurroundScale Class Reference

Transformation node that adjusts the current matrix so a default cube will surround other objects. More...

#include <Inventor/nodes/SoSurroundScale.h>

Inheritance diagram for SoSurroundScale:
SoTransformation SoNode SoFieldContainer SoBase

List of all members.

Public Member Functions

 SoSurroundScale ()
 Creates a surround scale node with default settings.
void invalidate ()
 If you call this, then next time an action is applied the node will re-calculate it's cached translation and scale values.
void doAction (SoAction *action)
 Called by actions that need to change the state with a new matrix.
void setDoingTranslations (SbBool doEm)
SbBool isDoingTranslations ()

Static Public Member Functions

static void initClass ()
 Initializes base node class.

Public Attributes

Fields
SoSFInt32 numNodesUpToContainer
 When traversed by an action, if surroundScale needs to calculate a new box, surroundScale looks at the current path in the action.
SoSFInt32 numNodesUpToReset
 Before applying the SoGetBoundingBoxAction (see the numNodesUpToContainer field aove) the surroundScale node travels up the path a distance of numNodesUpToReset and tells the action to reset the bounding box upon traversal of that node.

Protected Member Functions

virtual void callback (SoCallbackAction *action)
virtual void GLRender (SoGLRenderAction *action)
 These virtual functions implement all of the actions for nodes, Most of the default implementations do nothing.
virtual void getBoundingBox (SoGetBoundingBoxAction *action)
virtual void getMatrix (SoGetMatrixAction *action)
virtual void pick (SoPickAction *action)
void updateMySurroundParams (SoAction *action, const SbMatrix &inv)
void setIgnoreInBbox (SbBool newVal)
SbBool isIgnoreInBbox ()
virtual ~SoSurroundScale ()

Protected Attributes

SbVec3f cachedScale
SbVec3f cachedInvScale
SbVec3f cachedTranslation
SbBool cacheOK
SbBool doTranslations

Detailed Description

When traversed by an action, this node appends a transformation to the current transformation matrix so that a default size cube will surround the objects specified by its fields. Transform manipulators, such as SoHandleBoxManip, use these nodes to make themselves surround other objects.

This node only recalculates after the invalidate() method has been called. Otherwise it uses a saved scale and translation.

When calculating what to surround, the SoSurroundScale looks at the current path in the action and at its own field values. Then SoSurroundScale applies an SoGetBoundingBoxAction to the node that is numNodesUpToContainer nodes above it on the path. SoSurroundScale also tells the action to reset the bounding box upon traversal of the node located numNodesUpToReset nodes above it in the path. The SoSurroundScale then appends a translation and scale to the current transformation so that a default size SoCube will translate and scale to fit this bounding box.

For example, when an SoHandleBoxManip wants to surround the objects it is going to move, the scene graph will look something like this:

(Cr
                 RootNode
       -------------------------
       |                        |
     handleBoxManip        movingStuff
       |
     handleBoxDragger
       |
     separator
      -----------------------------------
      |            |                     |
    motionMatrix  surroundScale      cubeGeom
The SoHandleBoxDragger wants to transform the cubeGeom so that it
surrounds the movingStuff. So it sets the surroundScale fields to:
     numNodesUpToContainer = 4;
     numNodesUpToReset = 3;

The SoBoundingBoxAction will then be applied to RootNode, with a reset after traversing the SoHandleBoxManip. So the SoSurroundScale will surround the objects below separator, and to the right of handleBoxManip, producing the desired effect.

Action Behavior
SoGLRenderAction, SoCallbackAction, SoGetBoundingBoxAction, SoRayPickAction
Accumulates scaling and translation transformations into the current transformation.
SoGetMatrixAction
Returns the matrix corresponding to the scaling and translation.
See Also
SoTransformation, SoTransformManip, SoCenterballDragger, SoCenterballManip, SoHandleBoxDragger, SoHandleBoxManip, SoJackDragger, SoJackManip, SoTabBoxDragger, SoTabBoxManip, SoTrackballDragger, SoTrackballManip, SoTransformBoxDragger, SoTransformBoxManip

Definition at line 137 of file SoSurroundScale.h.


Constructor & Destructor Documentation

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

Member Function Documentation

virtual void SoSurroundScale::callback ( SoCallbackAction action) [protected, virtual]

Reimplemented from SoNode.

void SoSurroundScale::doAction ( SoAction action) [virtual]

Reimplemented from SoNode.

virtual void SoSurroundScale::getBoundingBox ( SoGetBoundingBoxAction action) [protected, virtual]

Reimplemented from SoNode.

virtual void SoSurroundScale::getMatrix ( SoGetMatrixAction action) [protected, virtual]

Reimplemented from SoNode.

virtual void SoSurroundScale::GLRender ( SoGLRenderAction action) [protected, virtual]

Reimplemented from SoNode.

static void SoSurroundScale::initClass ( ) [static]

Reimplemented from SoTransformation.

void SoSurroundScale::invalidate ( )
SbBool SoSurroundScale::isDoingTranslations ( ) [inline]

Definition at line 175 of file SoSurroundScale.h.

SbBool SoSurroundScale::isIgnoreInBbox ( ) [inline, protected]

Definition at line 191 of file SoSurroundScale.h.

virtual void SoSurroundScale::pick ( SoPickAction action) [protected, virtual]

Reimplemented from SoNode.

void SoSurroundScale::setDoingTranslations ( SbBool  doEm) [inline]

Definition at line 174 of file SoSurroundScale.h.

void SoSurroundScale::setIgnoreInBbox ( SbBool  newVal) [inline, protected]

Definition at line 190 of file SoSurroundScale.h.

void SoSurroundScale::updateMySurroundParams ( SoAction action,
const SbMatrix inv 
) [protected]

Member Data Documentation

Definition at line 194 of file SoSurroundScale.h.

Definition at line 193 of file SoSurroundScale.h.

Definition at line 195 of file SoSurroundScale.h.

Definition at line 196 of file SoSurroundScale.h.

Definition at line 198 of file SoSurroundScale.h.

It travels up this path a distance of numNodesUpToContainer and applies an SoGetBoundingBoxAction to the node that it finds there.

Definition at line 155 of file SoSurroundScale.h.


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