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
00066 class SoClipPlaneManip : public SoClipPlane {
00067
00068 SO_NODE_HEADER(SoClipPlaneManip) ;
00069
00070 public:
00074 SoClipPlaneManip() ;
00075
00076
00081 SoSFVec3f draggerPosition ;
00082
00086 SoDragger *getDragger() ;
00087
00088 virtual SoNode *copy(SbBool copyConnections = FALSE) const;
00089
00104 void setValue(const SbBox3f &box, const SbVec3f &planeNormal, float draggerScaleFactor) ;
00105
00109 SbBool replaceNode(SoPath *p) ;
00110
00114 SbBool replaceManip(SoPath *p, SoClipPlane *newOne) const;
00115
00116 private:
00117
00118
00119
00120
00121
00122
00124 virtual void doAction(SoAction *action);
00126 virtual void callback(SoCallbackAction *action);
00128 virtual void GLRender(SoGLRenderAction *action);
00130 virtual void getBoundingBox(SoGetBoundingBoxAction *action);
00132 virtual void getMatrix(SoGetMatrixAction *action);
00134 virtual void handleEvent(SoHandleEventAction *action);
00136 virtual void pick(SoPickAction *action);
00138 virtual void search(SoSearchAction *action);
00140 virtual void write( SoWriteAction *action );
00141
00142 private:
00143
00144
00145 static void initClass();
00146 static void exitClass();
00147
00148 virtual SoChildList *getChildren() const;
00149 virtual bool isGroup() { return true; }
00150
00151
00152 virtual void internalRemoveChild( int index );
00153 virtual void internalRemoveChild( SoNode *child) { internalRemoveChild(internalFindChild(child)); }
00154 virtual void internalRemoveAllChildren();
00155 virtual void internalAddChild( SoNode *child );
00156 virtual int internalFindChild( const SoNode *child ) const;
00157 virtual void internalInsertChild( SoNode *child, int newChildIndex );
00158 virtual SoNode *internalGetChild( int index) const { return (*children)[index]; }
00159 virtual void internalReplaceChild( int index, SoNode *newChild);
00160 virtual void internalReplaceChild( SoNode *oldChild, SoNode *newChild) { internalReplaceChild(internalFindChild(oldChild),newChild); }
00161
00162 private:
00163
00164
00165 static void valueChangedCB(void *,SoDragger *);
00166
00167
00168
00169 SoFieldSensor *planeFieldSensor ;
00170 SoFieldSensor *onFieldSensor ;
00171 SoFieldSensor *draggerPosFieldSensor ;
00172 static void fieldSensorCB(void *, SoSensor *);
00173
00174
00175 void setDragger(SoDragger *newDragger);
00176
00177
00178 SoChildList *children ;
00179 virtual SbBool readInstance(SoInput *in, unsigned short flags);
00180 virtual SbBool readChildren(SoInput *in);
00181
00182
00183 ~SoClipPlaneManip();
00184
00185 private:
00186 SbVec3f projectPointPlane() const ;
00187
00188 int getNumChildren() const { return (children->getLength()); }
00189 } ;
00190
00191
00192 #endif
00193
00194