00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _SO_CLIP_PLANE_MANIP_
00026 #define _SO_CLIP_PLANE_MANIP_
00027
00028 #include <Inventor/draggers/SoDragger.h>
00029 #include <Inventor/nodes/SoClipPlane.h>
00030 #include <Inventor/sensors/SoFieldSensor.h>
00031 #include <Inventor/fields/SoSFVec3f.h>
00032
00033
00034
00067 class SoClipPlaneManip : public SoClipPlane {
00068
00069 SO_NODE_HEADER(SoClipPlaneManip) ;
00070
00071 public:
00075 SoClipPlaneManip() ;
00076
00077
00082 SoSFVec3f draggerPosition ;
00083
00087 SoDragger *getDragger() ;
00088
00089 virtual SoNode *copy(SbBool copyConnections = FALSE) const;
00090
00105 void setValue(const SbBox3f &box, const SbVec3f &planeNormal, float draggerScaleFactor) ;
00106
00110 SbBool replaceNode(SoPath *p) ;
00111
00115 SbBool replaceManip(SoPath *p, SoClipPlane *newOne) const;
00116
00117 private:
00118
00119
00120
00121
00122
00123 virtual void doAction(SoAction *action);
00124 virtual void callback(SoCallbackAction *action);
00125 virtual void GLRender(SoGLRenderAction *action);
00126 virtual void getBoundingBox(SoGetBoundingBoxAction *action);
00127 virtual void getMatrix(SoGetMatrixAction *action);
00128 virtual void handleEvent(SoHandleEventAction *action);
00129 virtual void pick(SoPickAction *action);
00130 virtual void search(SoSearchAction *action);
00131 virtual void write( SoWriteAction *action );
00132
00133
00134 static void initClass();
00135 static void exitClass();
00136
00137 virtual SoChildList *getChildren() const;
00138 virtual bool isGroup() { return true; }
00139
00140
00141 virtual void internalRemoveChild( int index );
00142 virtual void internalRemoveChild( SoNode *child) { internalRemoveChild(internalFindChild(child)); }
00143 virtual void internalRemoveAllChildren();
00144 virtual void internalAddChild( SoNode *child );
00145 virtual int internalFindChild( const SoNode *child ) const;
00146 virtual void internalInsertChild( SoNode *child, int newChildIndex );
00147 virtual SoNode *internalGetChild( int index) const { return (*children)[index]; }
00148 virtual void internalReplaceChild( int index, SoNode *newChild);
00149 virtual void internalReplaceChild( SoNode *oldChild, SoNode *newChild) { internalReplaceChild(internalFindChild(oldChild),newChild); }
00150
00151 private:
00152
00153
00154 static void valueChangedCB(void *,SoDragger *);
00155
00156
00157
00158 SoFieldSensor *planeFieldSensor ;
00159 SoFieldSensor *onFieldSensor ;
00160 SoFieldSensor *draggerPosFieldSensor ;
00161 static void fieldSensorCB(void *, SoSensor *);
00162
00163
00164 void setDragger(SoDragger *newDragger);
00165
00166
00167 SoChildList *children ;
00168 virtual SbBool readInstance(SoInput *in, unsigned short flags);
00169 virtual SbBool readChildren(SoInput *in);
00170
00171
00172 ~SoClipPlaneManip();
00173
00174 private:
00175 SbVec3f projectPointPlane() const ;
00176
00177 int getNumChildren() const { return (children->getLength()); }
00178 } ;
00179
00180
00181 #endif
00182
00183