Class SoSurroundScale
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.misc.SoBase
-
- com.openinventor.inventor.fields.SoFieldContainer
-
- com.openinventor.inventor.nodes.SoNode
-
- com.openinventor.inventor.nodes.SoTransformation
-
- com.openinventor.inventor.nodes.SoSurroundScale
-
- All Implemented Interfaces:
SafeDisposable
public class SoSurroundScale extends SoTransformation
Transformation node that adjusts the current matrix so a default cube will surround other objects. 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 asSoHandleBoxManip
, 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. ThenSoSurroundScale
applies anSoGetBoundingBoxAction
to the node that isnumNodesUpToContainer
nodes above it on the path.SoSurroundScale
also tells the action to reset the bounding box upon traversal of the node locatednumNodesUpToReset
nodes above it in the path. TheSoSurroundScale
then appends a translation and scale to the current transformation so that a default sizeSoCube
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:
TheRootNode ------------------------- | | handleBoxManip movingStuff | handleBoxDragger | separator ----------------------------------- | | | motionMatrix surroundScale cubeGeom SoHandleBoxDragger
wants to transform the cubeGeom so that it surrounds the movingStuff . So it sets the surroundScale fields to:
The SoBoundingBoxAction will then be applied to RootNode , with a reset after traversing thenumNodesUpToContainer = 4; numNodesUpToReset = 3; SoHandleBoxManip
. So theSoSurroundScale
will surround the objects below separator , and to the right of handleBoxManip , producing the desired effect.File format/default:
SurroundScale {
numNodesUpToContainer 0 numNodesUpToReset 0 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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoNode
SoNode.RenderModes
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
Fields Modifier and Type Field Description 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 theSoGetBoundingBoxAction
(see thenumNodesUpToContainer
field above) the surroundScale node travels up the path a distance ofnumNodesUpToReset
and tells the action to reset the bounding box upon traversal of that node.-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoSurroundScale()
Creates a surround scale node with default settings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
invalidate()
If you call this, then next time an action is applied the node will re-calculate its cached translation and scale values.-
Methods inherited from class com.openinventor.inventor.nodes.SoNode
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderEngineMode, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
-
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
-
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
-
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
-
-
-
Field Detail
-
numNodesUpToContainer
public final SoSFInt32 numNodesUpToContainer
When traversed by an action, if surroundScale needs to calculate a new box, surroundScale looks at the current path in the action. It travels up this path a distance ofnumNodesUpToContainer
and applies anSoGetBoundingBoxAction
to the node that it finds there.
-
numNodesUpToReset
public final SoSFInt32 numNodesUpToReset
Before applying theSoGetBoundingBoxAction
(see thenumNodesUpToContainer
field above) the surroundScale node travels up the path a distance ofnumNodesUpToReset
and tells the action to reset the bounding box upon traversal of that node.
-
-