1SoSurroundScale(3IV)() SoSurroundScale(3IV)()
2
3
4
6 SoSurroundScale — transformation node that adjusts the current matrix
7 so a default cube will surround other objects
8
10 SoBase > SoFieldContainer > SoNode > SoTransformation > SoSurroundScale
11
13 #include <Inventor/nodes/SoSurroundScale.h>
14
15 Fields from class SoSurroundScale:
16
17 SoSFInt32 numNodesUpToContainer
18 SoSFInt32 numNodesUpToReset
19
20 Methods from class SoSurroundScale:
21
22 SoSurroundScale()
23 void invalidate()
24 static SoType getClassTypeId()
25
26 Methods from class SoNode:
27
28 void setOverride(SbBool state)
29 SbBool isOverride() const
30 SoNode * copy(SbBool copyConnections = FALSE) const
31 virtual SbBool affectsState() const
32 static SoNode * getByName(const SbName &name)
33 static int getByName(const SbName &name, SoNodeList &list)
34
35 Methods from class SoFieldContainer:
36
37 void setToDefaults()
38 SbBool hasDefaultValues() const
39 SbBool fieldsAreEqual(const SoFieldContainer *fc) const
40 void copyFieldValues(const SoFieldContainer *fc, SbBool
41 copyConnections = FALSE)
42 SbBool set(const char *fieldDataString)
43 void get(SbString &fieldDataString)
44 virtual int getFields(SoFieldList &resultList) const
45 virtual SoField * getField(const SbName &fieldName) const
46 SbBool getFieldName(const SoField *field, SbName &fieldName)
47 const
48 SbBool isNotifyEnabled() const
49 SbBool enableNotify(SbBool flag)
50
51 Methods from class SoBase:
52
53 void ref()
54 void unref() const
55 void unrefNoDelete() const
56 void touch()
57 virtual SoType getTypeId() const
58 SbBool isOfType(SoType type) const
59 virtual void setName(const SbName &name)
60 virtual SbName getName() const
61
62
64 When traversed by an action, this node appends a transformation to the
65 current transformation matrix so that a default size cube will surround
66 the objects specified by its fields. Transform manipulators, such as
67 SoHandleBoxManip, use these nodes to make themselves surround other
68 objects.
69
70 This node only recalculates after the invalidate() method has been
71 called. Otherwise it uses a saved scale and translation.
72
73 When calculating what to surround, the SoSurroundScale looks at the
74 current path in the action and at its own field values. Then SoSur‐
75 roundScale applies an SoGetBoundingBoxAction to the node that is
76 numNodesUpToContainer nodes above it on the path. SoSurroundScale also
77 tells the action to reset the bounding box upon traversal of the node
78 located numNodesUpToReset nodes above it in the path. The SoSurround‐
79 Scale then appends a translation and scale to the current transforma‐
80 tion so that a default size SoCube will translate and scale to fit this
81 bounding box.
82
83 For example, when an SoHandleBoxManip wants to surround the objects it
84 is going to move, the scene graph will look something like this:
85 RootNode
86 -------------------------
87 | |
88 handleBoxManip movingStuff
89 |
90 handleBoxDragger
91 |
92 separator
93 -----------------------------------
94 | | |
95 motionMatrix surroundScale cubeGeom
96 The SoHandleBoxDragger wants to transform the cubeGeom so that it sur‐
97 rounds the movingStuff. So it sets the surroundScale fields to:
98
99 numNodesUpToContainer = 4;
100 numNodesUpToReset = 3;
101
102 The SoBoundingBoxAction will then be applied to RootNode, with a reset
103 after traversing the SoHandleBoxManip. So the SoSurroundScale will sur‐
104 round the objects below separator, and to the right of handleBoxManip,
105 producing the desired effect.
106
108 SoSFInt32 numNodesUpToContainer
109 When traversed by an action, if surroundScale needs to calculate a
110 new box, surroundScale looks at the current path in the action. It
111 travels up this path a distance of numNodesUpToContainer and applies
112 an SoGetBoundingBoxAction to the node that it finds there.
113
114 SoSFInt32 numNodesUpToReset
115 Before applying the SoGetBoundingBoxAction (see the numNodesUpToCon‐
116 tainer field aove) the surroundScale node travels up the path a dis‐
117 tance of numNodesUpToReset and tells the action to reset the bound‐
118 ing box upon traversal of that node.
119
120
122 SoSurroundScale()
123 Creates a surround scale node with default settings.
124
125 void invalidate()
126 If you call this, then next time an action is applied the node will
127 re-calculate it's cached translation and scale values.
128
129 static SoType getClassTypeId()
130 Returns type identifier for this class.
131
132
134 SoGLRenderAction, SoCallbackAction, SoGetBoundingBoxAction, SoRayPick‐
135 Action
136 Accumulates scaling and translation transformations into the current
137 transformation.
138
139 SoGetMatrixAction
140 Returns the matrix corresponding to the scaling and translation.
141
142
144 SurroundScale {
145 numNodesUpToContainer 0
146 numNodesUpToReset 0
147 }
148
150 SoTransformation, SoTransformManip, SoCenterballDragger, SoCenterball‐
151 Manip, SoHandleBoxDragger, SoHandleBoxManip, SoJackDragger, SoJackMa‐
152 nip, SoTabBoxDragger, SoTabBoxManip, SoTrackballDragger, SoTrackballMa‐
153 nip, SoTransformBoxDragger, SoTransformBoxManip
154
155
156
157
158 SoSurroundScale(3IV)()