00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2022 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : David Beilloin (Dec 2008) 00022 **=======================================================================*/ 00023 00024 00025 00026 #ifndef _SO_ORTHOSLICE_DRAGGER_H_ 00027 #define _SO_ORTHOSLICE_DRAGGER_H_ 00028 00029 #include <Inventor/draggers/SoTranslate1Dragger.h> 00030 #include <Inventor/fields/SoSFPath.h> 00031 #include <Inventor/fields/SoSFVec3i32.h> 00032 #include <Inventor/fields/SoSFBox3f.h> 00033 #include <Inventor/fields/SoSFColor.h> 00034 00035 class SoCallback; 00036 class SoOrthoSlice; 00037 class SoSensor; 00038 class SoNodeSensor; 00039 class SoFieldSensor; 00040 class SoGetBoundingBoxAction; 00041 namespace inventor{namespace helper{class SoOrthoSliceBorderHelper;}} 00042 00163 class SoOrthoSliceDragger : public SoTranslate1Dragger 00164 { 00165 SO_KIT_HEADER(SoOrthoSliceDragger); 00166 00167 public: 00171 SoOrthoSliceDragger(); 00172 00177 SoSFPath orthoSlicePath; 00178 00179 #if 1 SoDEPRECATED 00185 SoSFVec3i32 volumeDimension; 00186 SoDEPRECATED 00191 SoSFBox3f volumeExtent; 00192 00193 #endif 00199 SoSFColor highlightColor; 00200 00208 SoSFBool enableHighlight; 00209 00210 private: 00214 static void initClass(); 00218 static void exitClass(); 00219 00220 virtual void internalRemoveChild(int); 00221 virtual void internalRemoveChild(SoNode*); 00222 virtual void internalRemoveAllChildren(); 00223 virtual void internalAddChild(SoNode*); 00224 virtual void internalInsertChild(SoNode*, int); 00225 virtual void internalReplaceChild(int, SoNode*); 00226 virtual void internalReplaceChild(SoNode*, SoNode*); 00227 00228 private: 00232 virtual void grabEventsSetup(); 00233 00234 virtual void callback(SoCallbackAction* action); 00235 virtual void getBoundingBox(SoGetBoundingBoxAction* action); 00236 virtual void getMatrix(SoGetMatrixAction* action); 00237 virtual void rayPick(SoRayPickAction* action); 00238 00239 private: 00243 virtual ~SoOrthoSliceDragger(); 00244 00248 virtual void notify(SoNotList *list); 00249 00250 void handleEvent(SoHandleEventAction *action) override; 00251 00253 virtual SbBool readInstance(SoInput* in, unsigned short flags); 00254 00255 private: 00259 static void valueChangedCB( void *data, SoDragger *dragger); 00260 00266 void initialize( const SoPath *pathToSlice); 00267 00271 void synchronize(); 00272 00276 void setDraggerDirection(); 00277 00278 void GLRender(SoGLRenderAction* action) override; 00279 00280 bool pushDataSetModelMatrix(SoAction* action); 00281 00282 private: 00283 // current handled orthoSlice. 00284 SoOrthoSlice* m_orthoSlice; 00285 SoCallback* m_updateBorderCBNode; 00286 SoCallback* m_orthoSliceMatrixCBNode; 00287 bool m_useDataSetMatrix; 00288 SbMatrix m_savedDataSetMatrix; 00289 int m_sliceAxis; 00290 int m_sliceNumber; 00291 00292 // Enables/disables axis switch when camera faces the dragger 00293 // ( see m_isOrthoSliceInSamePlaneThanViewer ) 00294 static bool s_enableAxisSwitch; 00295 00296 // Detect if orthoSlice is in the same plane than the viewer 00297 // If true then draggerDirection is changed to be able to move the slices. 00298 bool m_isOrthoSliceInSamePlaneThanViewer; 00299 00300 // Track changes to SoOrthoSlice node 00301 SoNodeSensor* m_sliceChangedSensor; 00302 static void sliceChangedSensorCB( void *, SoSensor * ); 00303 static void sliceDeletedSensorCB( void *, SoSensor * ); 00304 00305 // Used to avoid recursive notification. 00306 static bool m_isNotifying; 00307 00308 inventor::helper::SoOrthoSliceBorderHelper *m_orthoSliceBorderHelper; 00309 void drawHighLight(const bool enable); 00310 bool m_drawHightLight; 00311 SoFieldSensor* m_onValueChangedFieldSensorEnableBorder; 00312 SoFieldSensor* m_onValueChangedFieldSensorEnableImage; 00313 00314 void setupAutoValues(SoState* state); 00315 SbVec3i32 m_autoVolumeDimensions; 00316 SbBox3f m_autoVolumeExtent; 00317 }; 00318 00319 #endif //_SO_ORTHOSLICE_DRAGGER_H_ 00320 00321 00322