Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoClipPlaneManip.h
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-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : R. ALBOU (Feb 1997)
22**=======================================================================*/
23
24 /* include files */
25#ifndef _SO_CLIP_PLANE_MANIP_
26#define _SO_CLIP_PLANE_MANIP_
27
28#include <Inventor/draggers/SoDragger.h>
29#include <Inventor/nodes/SoClipPlane.h>
30#include <Inventor/sensors/SoFieldSensor.h>
31#include <Inventor/fields/SoSFVec3f.h>
32
33/*----------------------------------------------------------------------------*/
34
67
68 SO_NODE_HEADER(SoClipPlaneManip) ;
69
70 public:
75
76 // Fields
82
87
88 virtual SoNode *copy(SbBool copyConnections = FALSE) const;
89
104 void setValue(const SbBox3f &box, const SbVec3f &planeNormal, float draggerScaleFactor) ;
105
110
115
116 private:
117
118 // These functions implement all actions for this manip.
119 // They first traverse the children, then use the
120 // SoClipPlane version of the actions. They traverse first
121 // so that the SoClipPlane will affect objects which
122 // follow it in the tree, but not the dragger-child.
124 virtual void doAction(SoAction *action);
126 virtual void callback(SoCallbackAction *action);
128 virtual void GLRender(SoGLRenderAction *action);
130 virtual void getBoundingBox(SoGetBoundingBoxAction *action);
132 virtual void getMatrix(SoGetMatrixAction *action);
134 virtual void handleEvent(SoHandleEventAction *action);
136 virtual void pick(SoPickAction *action);
138 virtual void search(SoSearchAction *action);
140 virtual void write( SoWriteAction *action );
141
142 private:
143
144 // call this after SoInteraction::init();
145 static void initClass();
146 static void exitClass();
147
148 virtual SoChildList *getChildren() const;
149 virtual bool isGroup() { return true; }
150
151 // Internal child management following inheritance of classes.
152 virtual void internalRemoveChild( int index );
153 virtual void internalRemoveChild( SoNode *child) { internalRemoveChild(internalFindChild(child)); }
154 virtual void internalRemoveAllChildren();
155 virtual void internalAddChild( SoNode *child );
156 virtual int internalFindChild( const SoNode *child ) const;
157 virtual void internalInsertChild( SoNode *child, int newChildIndex );
158 virtual SoNode *internalGetChild( int index) const { return (*children)[index]; }
159 virtual void internalReplaceChild( int index, SoNode *newChild);
160 virtual void internalReplaceChild( SoNode *oldChild, SoNode *newChild) { internalReplaceChild(internalFindChild(oldChild),newChild); }
161
162 private:
163 // When the dragger moves, this interprets the fields modifications
164 // of the dragger and sets the fields of this SoClip plane accordingly
165 static void valueChangedCB(void *,SoDragger *);
166
167 // When one of the field of this node changes, moves the
168 // child-dragger to a new location, if necessary.
169 SoFieldSensor *planeFieldSensor ;
170 SoFieldSensor *onFieldSensor ;
171 SoFieldSensor *draggerPosFieldSensor ;
172 static void fieldSensorCB(void *, SoSensor *);
173
174 // Establishes the given dragger as the new child-dragger
175 void setDragger(SoDragger *newDragger);
176
177 // The hidden children.
178 SoChildList *children ;
179 virtual SbBool readInstance(SoInput *in, unsigned short flags);
180 virtual SbBool readChildren(SoInput *in);
181
182 // Destructor
184
185 private:
186 SbVec3f projectPointPlane() const ;
187
188 int getNumChildren() const { return (children->getLength()); }
189} ;
190/*----------------------------------------------------------------------------*/
191
192#endif /* _SO_CLIP_PLANE_MANIP_ */
193
3D box class.
Definition SbBox.h:649
3D vector class.
Definition SbVec.h:932
Abstract base class for all actions.
Definition SoAction.h:132
Performs a generic traversal of a scene graph or path.
Clipping plane node.
Definition SoClipPlane.h:94
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Manipulator to t...
virtual SoNode * copy(SbBool copyConnections=FALSE) const
Creates and returns an exact copy of the node.
SoSFVec3f draggerPosition
Dragger position.
SbBool replaceManip(SoPath *p, SoClipPlane *newOne) const
Replaces this manipulator with a regular SoClipPlane node.
void setValue(const SbBox3f &box, const SbVec3f &planeNormal, float draggerScaleFactor)
Convenience method to set the clip plane and the dragger position, orientation and size.
SoClipPlaneManip()
Constructor.
SoDragger * getDragger()
Returns the dragger node being employed by this manip.
SbBool replaceNode(SoPath *p)
Replaces a regular SoClipPlane node with this manipulator.
Base class for nodekits that move in response to click-drag-release mouse events.
Definition SoDragger.h:537
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
Path that points to a list of hierarchical nodes.
Definition SoPath.h:187
Abstract base class for picking objects in a scene.
Field containing a three-dimensional vector.
Definition SoSFVec3f.h:80
Searches for nodes in a scene graph.
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
Writes a scene graph to a file.
int SbBool
Boolean type.
Definition SbBase.h:87