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
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #ifdef SOQT
00051 # include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
00052 #elif defined _WIN32
00053 # include <Inventor/Win/viewers/SoWinExaminerViewer.h>
00054 #else // _WIN32
00055
00056 #ifndef _SO_XT_EXAMINER_VIEWER_
00057 #define _SO_XT_EXAMINER_VIEWER_
00058
00059 #include <Inventor/Xt/viewers/SoXtFullViewer.h>
00060 #include <Inventor/events/SoMouseButtonEvent.h>
00061 #include <Inventor/Gui/viewers/SoGuiExaminerViewer.h>
00062
00063
00064 class SbSphereSheetProjector;
00065 class SoFieldSensor;
00066 class SoSeparator;
00067 class SoSwitch;
00068 class SoTranslation;
00069 class SoScale;
00070 class SoXtBitmapButton;
00071
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00098
00218 class SoXtExaminerViewer : public SoXtFullViewer
00219 {
00220 public:
00221
00225 enum ViewingMode
00226 {
00230 VIEWING_MODE_SPIN,
00231
00241 VIEWING_MODE_SPIN_CONSTRAINED,
00242
00246 VIEWING_MODE_PAN,
00247
00252 VIEWING_MODE_ZOOM
00253 };
00254
00258 enum ConstrainedViewingMode
00259 {
00263 NONE,
00267 CONSTRAINED_VIEWING_MODE_X,
00268
00272 CONSTRAINED_VIEWING_MODE_Y,
00273
00277 CONSTRAINED_VIEWING_MODE_Z
00278 };
00279
00284 SoXtExaminerViewer( SoWidget parent = NULL,
00285 const char* name = NULL,
00286 SbBool buildInsideParent = TRUE,
00287 SoXtFullViewer::BuildFlag flag = SoXtFullViewer::BUILD_ALL,
00288 SoXtViewer::Type type = SoXtViewer::BROWSER );
00292 ~SoXtExaminerViewer();
00293
00300 void setViewingMode( ViewingMode viewingMode ) ;
00301
00305 ViewingMode getViewingMode() const
00306 { return (ViewingMode)m_guiExamViewer->getViewingMode(); }
00307
00319 void setConstrainedViewingMode( ConstrainedViewingMode mode );
00320
00324 ConstrainedViewingMode getConstrainedViewingMode() const
00325 { return m_constrainedMode; }
00326
00331 void setFeedbackVisibility( SbBool onOrOff );
00332
00336 SbBool isFeedbackVisible() const { return m_guiExamViewer->isFeedbackVisible(); }
00337
00341 void setFeedbackSize( int newSize );
00342
00346 int getFeedbackSize() const { return m_guiExamViewer->getFeedbackSize(); }
00347
00355 void setAnimationEnabled( SbBool onOrOff );
00356
00360 SbBool isAnimationEnabled() { return m_guiExamViewer->isAnimationEnabled(); }
00361
00365 void stopAnimating();
00366
00370 SbBool isAnimating() { return m_guiExamViewer->isAnimating(); }
00371
00372
00373
00374
00375 virtual void viewAll();
00376 virtual void resetToHomePosition();
00377 virtual void setCamera( SoCamera* cam );
00378 virtual void setViewing( SbBool onOrOff );
00379 virtual void setCursorEnabled( SbBool onOrOff );
00380 virtual void setSeekMode( SbBool onOrOff );
00381
00392 virtual void activateSpinning( const SbVec2s& newLocator );
00393
00404 virtual void activatePanning( const SbVec2s& newLocator );
00405
00416 virtual void activateDolly( const SbVec2s& newLocator );
00417
00428 virtual void activateRoll( const SbVec2s& newLocator );
00429
00436 virtual void rollCamera( const SbVec2s& newLocator );
00437
00438
00445 virtual void spinCamera( const SbVec2f& newLocator );
00446
00457 virtual void spinConstrainedCamera( const SbVec2f& newLocator, int axisIndex );
00458
00467 virtual void dollyCamera( const SbVec2s& newLocator );
00468
00475 virtual void reverseDollyCamera( const SbVec2s& newLocator );
00476
00483 virtual void panCamera( const SbVec2f& newLocator );
00484
00485 private:
00486
00491 virtual void rotateCamera( const SbRotation& rot );
00492
00502 void constrainCameraRotation( bool x = false, bool y = false, bool z = false );
00503
00504 private:
00505
00506 SoGuiExaminerViewer* getGuiExaminerViewer() const;
00507
00508
00509
00510
00511
00512 private:
00513 SoXtExaminerViewer( SoWidget parent,
00514 const char* name,
00515 SbBool buildInsideParent,
00516 SoXtFullViewer::BuildFlag flag,
00517 SoXtViewer::Type type,
00518 SbBool buildNow,
00519 SbBool sync = TRUE );
00520
00521 private:
00522
00523 virtual SbString getDefaultWidgetName() const;
00524 virtual SbString getDefaultTitle() const;
00525 virtual SbString getDefaultIconTitle() const;
00526
00527
00528 virtual void processEvent( XAnyEvent* anyevent );
00529 virtual void actualRedraw();
00530
00531
00532 SoWidget buildWidget( SoWidget parent );
00533
00534
00535 virtual void bottomWheelMotion( float newVal );
00536 virtual void leftWheelMotion( float newVal );
00537 virtual void rightWheelMotion( float newVal );
00538
00539
00540 virtual void bottomWheelStart();
00541 virtual void leftWheelStart();
00542
00543
00544 virtual void createPrefSheet();
00545
00546
00547 virtual void createViewerButtons( SoWidget parent );
00548
00549
00550 virtual void openViewerHelpCard();
00551
00552 virtual void updateCursor();
00553
00554 private:
00555
00556 Cursor spinCursor, panCursor, dollyCursor, seekCursor;
00557 SbBool firstBuild;
00558
00559
00560 void createFeedbackNodes();
00561
00562
00563 unsigned long lastMotionTime;
00564 static void visibilityChangeCB( void* pt, SbBool visible );
00565
00566 void setViewerMode();
00567 void updateViewerMode( unsigned int state );
00568 void switchMode( int newMode );
00569 void defineCursors();
00570
00571
00572 SoWidget createExamPrefSheetGuts( SoWidget parent );
00573 static void animPrefSheetToggleCB( SoWidget w, SoXtExaminerViewer* v, void* data );
00574
00575
00576 int feedbackSizeWheelVal;
00577 SoWidget feedbackLabel[2], feedbackField, feedbackSizeWheel;
00578 static void feedbackSizeWheelCB( SoWidget w, SoXtExaminerViewer* v, XtPointer* d );
00579 static void feedbackSizeFieldCB( SoWidget w, SoXtExaminerViewer* v, void* data );
00580 static void feedbackPrefSheetToggleCB( SoWidget w, SoXtExaminerViewer* v, void* data );
00581 void toggleFeedbackWheelSize( SoWidget toggle );
00582
00583
00584 SoXtBitmapButton* buttonList[10];
00585 static void camPushCB( SoWidget w, SoXtExaminerViewer* v, void* data);
00586
00587
00588 void constructorCommon( SbBool buildNow );
00589
00590 SoGuiExaminerViewer* m_guiExamViewer;
00591
00592
00593 SoGuiExaminerViewer::ViewingSpinType m_viewingSpinType;
00594 ConstrainedViewingMode m_constrainedMode;
00595 };
00596
00597 #endif
00598
00599 #endif // _WIN32
00600
00601
00602