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
00026 #ifndef _SO_WIN_EXAMINER_VIEWER_
00027 #define _SO_WIN_EXAMINER_VIEWER_
00028
00029 #include <Inventor/Win/SoWinBeginStrict.h>
00030
00031 #include <Inventor/Win/viewers/SoWinFullViewer.h>
00032 #include <Inventor/events/SoMouseButtonEvent.h>
00033 #include <Inventor/Gui/viewers/SoGuiExaminerViewer.h>
00034
00035
00036 class SbSphereSheetProjector;
00037 class SoFieldSensor;
00038 class SoSeparator;
00039 class SoSwitch;
00040 class SoTranslation;
00041 class SoScale;
00042 class SoWinBitmapButton;
00043
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00074
00187 class SoWinExaminerViewer : public SoWinFullViewer
00188 {
00189
00190 public:
00191
00195 enum ViewingMode
00196 {
00200 VIEWING_MODE_SPIN,
00201
00211 VIEWING_MODE_SPIN_CONSTRAINED,
00212
00216 VIEWING_MODE_PAN,
00217
00222 VIEWING_MODE_ZOOM
00223 };
00224
00228 enum ConstrainedViewingMode
00229 {
00233 NONE,
00237 CONSTRAINED_VIEWING_MODE_X,
00238
00242 CONSTRAINED_VIEWING_MODE_Y,
00243
00247 CONSTRAINED_VIEWING_MODE_Z,
00248 };
00249
00258 SoWinExaminerViewer( SoWidget parent = NULL,
00259 const char* name = NULL,
00260 SbBool buildInsideParent = TRUE,
00261 SoWinFullViewer::BuildFlag flag = SoWinFullViewer::BUILD_ALL,
00262 SoWinViewer::Type type = SoWinViewer::BROWSER );
00266 ~SoWinExaminerViewer();
00267
00274 void setViewingMode( ViewingMode viewingMode ) ;
00275
00279 ViewingMode getViewingMode() const
00280 { return (ViewingMode)m_guiExamViewer->getViewingMode(); }
00281
00293 void setConstrainedViewingMode( ConstrainedViewingMode mode );
00294
00298 ConstrainedViewingMode getConstrainedViewingMode() const
00299 { return m_constrainedMode; }
00300
00302
00315 class SoViewingFunction
00316 {
00317 public:
00321 void setViewer(SoWinViewer* viewer) { m_viewer = viewer; }
00322
00326 virtual void apply() const = 0;
00327
00328 private:
00329 SoWinViewer* m_viewer;
00330 };
00331
00348 class SoViewingSphericalRotation : public SoViewingFunction
00349 {
00350 private:
00354 void apply() const;
00355 };
00356
00369 class SoViewingTranslation : public SoViewingFunction
00370 {
00371 private:
00375 void apply() const;
00376 };
00377
00391 class SoViewingRotationX : public SoViewingFunction
00392 {
00393 private:
00397 void apply() const;
00398 };
00399
00412 class SoViewingRotationY : public SoViewingFunction
00413 {
00414 private:
00418 void apply() const;
00419 };
00420
00433 class SoViewingRotationZ : public SoViewingFunction
00434 {
00435 private:
00439 void apply() const;
00440 };
00441
00454 class SoViewingRotationXViewer : public SoViewingFunction
00455 {
00456 private:
00460 void apply() const;
00461 };
00462
00475 class SoViewingRotationYViewer : public SoViewingFunction
00476 {
00477 private:
00481 void apply() const;
00482 };
00483
00496 class SoViewingRotationZViewer : public SoViewingFunction
00497 {
00498 private:
00502 void apply() const;
00503 };
00504
00517 class SoViewingSeek : public SoViewingFunction
00518 {
00519 private:
00523 void apply() const;
00524 };
00525
00539 class SoViewingDolly : public SoViewingFunction
00540 {
00541 private:
00545 void apply() const;
00546 };
00547
00561 class SoViewingReverseDolly : public SoViewingFunction
00562 {
00563 private:
00567 void apply() const;
00568 };
00569
00582 class SoViewingEmpty : public SoViewingFunction
00583 {
00584 private:
00588 void apply() const;
00589 };
00590
00601 virtual void addFunctionKeyBinding( SoKeyboardEvent::Key key, const SoViewingFunction* viewingFunc );
00602
00606 virtual void removeFunctionKeyBinding( SoKeyboardEvent::Key functionKey );
00607
00657 virtual void addViewingMouseBinding( SoKeyboardEvent::Key* keys = NULL,
00658 int numKey = 0,
00659 SoMouseButtonEvent::Button *mouseBtn = NULL,
00660 int numMouseBtn = 0,
00661 const SoViewingFunction *viewingFunc = NULL );
00668 virtual void removeViewingMouseBinding( SoKeyboardEvent::Key* keys = NULL,
00669 int numKeys = 0,
00670 SoMouseButtonEvent::Button* mouseBtn = NULL,
00671 int numMouseBtn = 0 );
00672
00673
00674
00676
00678
00683 void setFeedbackVisibility( SbBool onOrOff );
00684
00688 SbBool isFeedbackVisible() const { return m_guiExamViewer->isFeedbackVisible(); }
00689
00693 void setFeedbackSize( int newSize );
00694
00698 int getFeedbackSize() const { return m_guiExamViewer->getFeedbackSize(); }
00699
00707 void setAnimationEnabled( SbBool onOrOff );
00708
00712 SbBool isAnimationEnabled() { return m_guiExamViewer->isAnimationEnabled(); }
00713
00717 void stopAnimating();
00718
00722 SbBool isAnimating() { return m_guiExamViewer->isAnimating(); }
00723
00724
00725 virtual void viewAll();
00726 virtual void resetToHomePosition();
00727 virtual void setCamera( SoCamera* cam );
00728 virtual void setViewing( SbBool onOrOff );
00729 virtual void setCursorEnabled( SbBool onOrOff );
00730 virtual void setSeekMode( SbBool onOrOff );
00731
00742 virtual void activateSpinning( const SbVec2s& newLocator );
00743
00754 virtual void activatePanning( const SbVec2s& newLocator );
00755
00766 virtual void activateDolly( const SbVec2s& newLocator );
00767
00778 virtual void activateRoll( const SbVec2s& newLocator );
00779
00786 virtual void rollCamera( const SbVec2s &newLocator );
00787
00794 virtual void spinCamera( const SbVec2f &newLocator );
00795
00806 virtual void spinConstrainedCamera( const SbVec2f& newLocator, int axisIndex );
00807
00816 virtual void dollyCamera( const SbVec2s &newLocator );
00817
00824 virtual void reverseDollyCamera( const SbVec2s& newLocator );
00825
00832 virtual void panCamera( const SbVec2f& newLocator );
00833
00834 private:
00835
00836 SoGuiExaminerViewer* getGuiExaminerViewer() const;
00837
00838 private:
00839
00844 virtual void rotateCamera( const SbRotation& rot );
00845
00855 void constrainCameraRotation( bool x = false, bool y = false, bool z = false );
00856
00857 private:
00858
00859
00860
00861
00862 SoEXTENDER
00863 SoWinExaminerViewer( SoWidget parent,
00864 const char* name,
00865 SbBool buildInsideParent,
00866 SoWinFullViewer::BuildFlag flag,
00867 SoWinViewer::Type type,
00868 SbBool buildNow,
00869 SbBool sync = TRUE );
00870
00871
00872 virtual SbString getDefaultWidgetName() const;
00873 virtual SbString getDefaultTitle() const;
00874 virtual SbString getDefaultIconTitle() const;
00875
00876
00877 virtual void processEvent( XAnyEvent* anyevent );
00878 virtual void actualRedraw();
00879
00880
00881 SoWidget buildWidget( SoWidget parent );
00882
00883
00884 virtual void bottomWheelMotion( float newVal );
00885 virtual void leftWheelMotion( float newVal );
00886 virtual void rightWheelMotion( float newVal );
00887 virtual void mouseWheelMotion( float newVal );
00888
00889
00890 virtual void bottomWheelStart();
00891 virtual void leftWheelStart();
00892
00893
00894 virtual void createPrefSheet();
00895
00896
00897 virtual void createViewerButtons( SoWidget parent );
00898
00899
00900
00901
00902 virtual void buildPopupMenu();
00903
00904
00905 virtual void openViewerHelpCard();
00906
00907
00908
00909
00910
00911
00912
00913 virtual void pushButtonCB( SoWidget w, int id, void* data );
00914
00915 virtual void doSpinAnimation();
00916
00917 virtual void updateCursor();
00918
00919 private:
00920 SoGuiExaminerViewer* m_guiExamViewer;
00921
00922
00923 SoGuiExaminerViewer::ViewingSpinType m_viewingSpinType;
00924 ConstrainedViewingMode m_constrainedMode;
00925
00926 SbBool firstBuild;
00927
00928
00929 static char* geometryBuffer;
00930
00931
00932 long lastMotionTime;
00933 static void visibilityChangeCB( void* pt, SbBool visible );
00934
00935 private:
00936
00937
00938 int m_mouseReady;
00939 SbBool m_viewingOnOffFlag;
00940
00941 int m_prevFlag;
00942
00943
00944
00945 SbBool m_needToBeReset;
00946
00947 int m_prevCursorMode;
00948
00949 void updateViewerMode( unsigned int state );
00950 void switchMode( int newMode );
00951 void setViewerMode();
00952
00953
00954 SoWinBitmapButton* buttonList[10];
00955 static void camPushCB( SoWidget w, SoWinExaminerViewer* v, void* data );
00956
00957
00958 void constructorCommon( SbBool buildNow );
00959
00960
00961 void processPopupItem( int item );
00962 };
00963
00964 #include <Inventor/Win/SoWinEndStrict.h>
00965
00966 #endif
00967
00968