Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SoROIManip.h
Go to the documentation of this file.
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2022 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : P. ESTRADE (Jul 2002)
22** Modified by : T.DUFOUR (MMM yyyy)
23**=======================================================================*/
24
25/* include files */
26#ifndef _SO_ROI_MANIP_
27#define _SO_ROI_MANIP_
28
30#include <LDM/nodes/SoROI.h>
31
32class SoOneShotSensor;
33class SoState;
34class SoCallback;
35
36/*----------------------------------------------------------------------------*/
37
108class SoROIManip : public SoROI {
109
111
112public:
117
118 // Fields
124
129
134
154
173 SbBool replaceManip(SoPath *p, SoROI *newOne) const;
174
175private:
176 // These functions implement all actions for this manip.
177 // They first traverse the children, then use the
178 // SoROI version of the actions. They traverse first
179 // so that the SoROI will affect objects which
180 // follow it in the tree, but not the dragger-child.
182 virtual void doAction(SoAction *action);
184 virtual void callback(SoCallbackAction *action);
186 virtual void GLRender(SoGLRenderAction *action);
188 virtual void getBoundingBox(SoGetBoundingBoxAction *action);
190 virtual void getMatrix(SoGetMatrixAction *action);
192 virtual void handleEvent(SoHandleEventAction *action);
194 virtual void pick(SoPickAction *action);
196 virtual void search(SoSearchAction *action);
198 virtual void write( SoWriteAction *action );
199
200private:
201 // call this after SoInteraction::init();
202 static void initClass();
203 static void exitClass();
204
205 virtual SoChildList *getChildren() const;
206
207private:
208 // When the dragger moves, this interprets the fields modifications
209 // of the dragger and sets the fields of this SoROI accordingly
210 static void valueChangedCB(void *,SoDragger *);
211
212 // When one of the field of this node changes, moves the
213 // child-dragger to a new location, if necessary.
214 SoFieldSensor *m_boxOnSensor;
215 SoFieldSensor *m_boxFieldSensor;
216 SoFieldSensor *m_subVolumeFieldSensor;
217 SoFieldSensor *m_relativeFieldSensor;
218 SoOneShotSensor *m_wasInitSensor;
219
220 static void fieldSensorCB(void *, SoSensor *);
221 static void oneShotSensorCB(void *, SoSensor *);
222
223 // Establishes the given dragger as the new child-dragger
224 void setDragger(SoDragger *newDragger);
225
226 // The hidden children.
227 SoChildList *m_children;
228 virtual SbBool readInstance(SoInput *in, unsigned short flags);
229 virtual SbBool readChildren(SoInput *in);
230
231 // Destructor
232 virtual ~SoROIManip();
233
234private:
235 SbVec3i32 m_dimension;
236 SbBox3f m_size;
237 SbBool m_init;
238 SbVec3i32 m_boxmin, m_boxmax;
239
240 SoCallback* m_dataSetMatrixCBNode;
241 bool m_useDataSetMatrix;
242 SbMatrix m_savedDataSetMatrix;
243
244 static void dataToGeometry( const SbVec3i32 &, const SbVec3i32 &, SbVec3f &, SbVec3f &, const SoROIManip * );
245 static void geometryToData( const SbVec3f &, const SbVec3f &, SbVec3i32 &, SbVec3i32 &, const SoROIManip *, bool );
246
247 int getNumChildren() const { return (m_children->getLength()); }
248 void initBox(SoAction* action);
249
250 bool hasVolumeDataSizeChanged(SoState *state);
251
252 bool pushDataSetModelMatrix(SoAction* action, SoNode* node);
253} ;
254/*----------------------------------------------------------------------------*/
255
256#endif /* _SO_ROI_MANIP_ */
257
258
#define SO_NODE_HEADER(className)
Definition SoSubNode.h:151
3D box class.
Definition SbBox.h:649
4x4 matrix class.
Definition SbMatrix.h:309
3D vector class.
Definition SbVec.h:932
3D vector class.
Definition SbVec.h:1517
Abstract base class for all actions.
Definition SoAction.h:132
Performs a generic traversal of a scene graph or path.
Provides custom behavior during actions.
Definition SoCallback.h:437
Base class for nodekits that move in response to click-drag-release mouse events.
Definition SoDragger.h:534
Sensor class that can be attached to Open Inventor fields.
Renders a scene graph using Open Inventor's Render Engine.
Computes bounding box of a scene.
Computes transformation matrix for a subgraph.
Allows nodes in a graph to receive input events.
Used to read Open Inventor data files.
Definition SoInput.h:363
Abstract base class for all database nodes.
Definition SoNode.h:145
friend class SoChildList
Definition SoNode.h:473
Sensor for one-time only callbacks.
Path that points to a list of hierarchical nodes.
Definition SoPath.h:187
Abstract base class for picking objects in a scene.
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Region o...
Definition SoROI.h:320
SoSFBitMask flags
Specifies how the bounds of the box are used.
Definition SoROI.h:349
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Manipula...
Definition SoROIManip.h:108
SoSFBool constrained
Constrains the dragger to fit in the data volume.
Definition SoROIManip.h:128
SoROIManip()
Constructor.
SbBool replaceManip(SoPath *p, SoROI *newOne) const
Replaces the tail of the path, which must be this manipulator, with the given SoROI node.
SoDragger * getDragger()
Returns the dragger node being employed by this manip.
SbBool replaceNode(SoPath *p)
Replaces the tail of the path with this manipulator.
SoSFBool boxOn
Chooses between the 'box' (TRUE) or the 'subVolume' (FALSE) field in the SoROI.
Definition SoROIManip.h:123
Field containing a single Boolean value.
Definition SoSFBool.h:79
Searches for nodes in a scene graph.
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:97
Traversal state.
Definition SoState.h:74
Writes a scene graph to a file.
int SbBool
Boolean type.
Definition SbBase.h:87