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_QT_EXAMINER_VIEWER_
00026 #define _SO_QT_EXAMINER_VIEWER_
00027 #include <Inventor/Qt/OivQtCompat.h>
00028 #include <Inventor/Qt/viewers/SoQtFullViewer.h>
00029 #include <Inventor/events/SoMouseButtonEvent.h>
00030
00031 #include <QPointer>
00032 #include <QCursor>
00033
00034 #include <Inventor/Gui/viewers/SoGuiExaminerViewer.h>
00035
00036 class SbSphereSheetProjector;
00037 class SoFieldSensor;
00038 class SoSeparator;
00039 class SoSwitch;
00040 class SoTranslation;
00041 class SoScale;
00042
00043 class SbTime;
00044
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
00073
00075
00188 class SoQtExaminerViewer : public SoQtFullViewer
00189 {
00190
00191 Q_OBJECT
00192
00193 public:
00194
00198 enum ViewingMode
00199 {
00203 VIEWING_MODE_SPIN,
00204
00214 VIEWING_MODE_SPIN_CONSTRAINED,
00215
00219 VIEWING_MODE_PAN,
00220
00224 VIEWING_MODE_ROLL,
00225
00230 VIEWING_MODE_ZOOM
00231 } ;
00232
00236 enum ConstrainedViewingMode
00237 {
00241 NONE,
00245 CONSTRAINED_VIEWING_MODE_X,
00246
00250 CONSTRAINED_VIEWING_MODE_Y,
00251
00255 CONSTRAINED_VIEWING_MODE_Z
00256 } ;
00257
00262 SoQtExaminerViewer( QWidget* parent = NULL,
00263 const char* name = NULL,
00264 SbBool buildInsideParent = TRUE,
00265 SoQtFullViewer::BuildFlag flag = SoQtFullViewer::BUILD_ALL,
00266 SoQtViewer::Type type = SoQtViewer::BROWSER );
00270 ~SoQtExaminerViewer();
00271
00278 void setViewingMode( ViewingMode viewingMode ) ;
00279
00283 ViewingMode getViewingMode() const { return (ViewingMode)m_guiExamViewer->getViewingMode(); }
00284
00296 void setConstrainedViewingMode( ConstrainedViewingMode mode );
00297
00301 ConstrainedViewingMode getConstrainedViewingMode() const
00302 { return m_constrainedMode; }
00303
00308 void setFeedbackVisibility( SbBool onOrOff );
00309
00313 SbBool isFeedbackVisible() const { return m_guiExamViewer->isFeedbackVisible(); }
00314
00318 void setFeedbackSize( int newSize );
00319
00323 int getFeedbackSize() const { return m_guiExamViewer->getFeedbackSize(); }
00324
00332 void setAnimationEnabled( SbBool onOrOff );
00333
00337 SbBool isAnimationEnabled() { return m_guiExamViewer->isAnimationEnabled(); }
00338
00342 void stopAnimating();
00343
00347 SbBool isAnimating() { return m_guiExamViewer->isAnimating(); }
00348
00349
00350
00351
00352 virtual void viewAll();
00353 virtual void resetToHomePosition();
00354 virtual void setCamera( SoCamera* cam );
00355 virtual void setViewing( SbBool onOrOff );
00356 virtual void setCursorEnabled( SbBool onOrOff );
00357 virtual void setSeekMode( SbBool onOrOff );
00358
00369 virtual void activateSpinning( const SbVec2s& newLocator );
00370
00381 virtual void activatePanning( const SbVec2s& newLocator );
00382
00393 virtual void activateDolly( const SbVec2s& newLocator );
00394
00405 virtual void activateRoll( const SbVec2s& newLocator );
00406
00413 virtual void rollCamera( const SbVec2s& newLocator );
00414
00421 virtual void spinCamera( const SbVec2f& newLocator );
00422
00433 virtual void spinConstrainedCamera( const SbVec2f& newLocator, int axisIndex );
00434
00443 virtual void dollyCamera( const SbVec2s& newLocator );
00444
00451 virtual void reverseDollyCamera( const SbVec2s& newLocator );
00452
00459 virtual void panCamera( const SbVec2f& newLocator );
00460
00461 private:
00462
00463 SoGuiExaminerViewer* getGuiExaminerViewer() const;
00464
00465 virtual void internalSetViewingMode( int viewingMode ) { setViewingMode( ViewingMode(viewingMode) ); };
00466 virtual int internalGetViewingMode() const { return (int)m_guiExamViewer->getViewingMode(); };
00467
00468 private:
00469
00474 virtual void rotateCamera( const SbRotation& rot );
00475
00485 void constrainCameraRotation( bool x = false, bool y = false, bool z = false );
00486
00487
00488
00489
00490 SoQtExaminerViewer( QWidget* parent,
00491 const char* name,
00492 SbBool buildInsideParent,
00493 SoQtFullViewer::BuildFlag flag,
00494 SoQtViewer::Type type,
00495 SbBool buildNow,
00496 SbBool sync = true );
00497 private:
00498
00499
00500 virtual SbString getDefaultWidgetName() const;
00501 virtual SbString getDefaultTitle() const;
00502 virtual SbString getDefaultIconTitle() const;
00503
00504
00505 virtual void processEvent( QEvent* anyevent );
00506 virtual void actualRedraw();
00507
00508
00509 QWidget* buildWidget( QWidget* parent );
00510
00511
00512 virtual void bottomWheelMotion( float newVal );
00513 virtual void leftWheelMotion( float newVal );
00514 virtual void rightWheelMotion( float newVal );
00515 virtual void mouseWheelMotion( float newVal );
00516
00517
00518 virtual void bottomWheelStart();
00519 virtual void leftWheelStart();
00520
00521
00522 virtual void createPrefSheet();
00523
00524
00525 virtual void createViewerButtons( QWidget* parent );
00526
00527
00528
00529
00530 virtual void buildPopupMenu();
00531
00532
00533 virtual void openViewerHelpCard();
00534
00535 virtual void pushButtonCB( int id );
00536
00537 virtual void updateCursor();
00538
00539 virtual void switchMode( int newMode );
00540
00541 virtual void doSpinAnimation();
00542
00543 int mode;
00544
00545 SbVec2s locator;
00546
00547 private:
00548 SoGuiExaminerViewer* m_guiExamViewer;
00549
00550
00551 SoGuiExaminerViewer::ViewingSpinType m_viewingSpinType;
00552 ConstrainedViewingMode m_constrainedMode;
00553
00554 SbBool firstBuild;
00555
00556
00557 SbTime lastMotionTime;
00558
00559 void setViewerMode();
00560 void updateViewerMode( unsigned int state );
00561
00562
00563 QPointer<SoQtButton> buttonList[10];
00564 static void camPushCB( SoQtExaminerViewer* v);
00565
00566
00567 void constructorCommon( SbBool buildNow );
00568
00569
00570 QPixmap IDB_PUSH_PERSP;
00571 QPixmap IDB_PUSH_ORTHO;
00572
00573 #ifndef HIDDEN_FROM_DOC
00574 private Q_SLOTS:
00575
00576 void slotCamPushButton();
00577
00578
00579 void slot_popup_spin();
00580 void slot_popup_axes();
00581
00582 #endif // HIDDEN_FROM_DOC
00583
00584 private Q_SLOTS:
00585 void visibilityChangeCB( SbBool visible );
00586
00587 };
00588
00589 #endif
00590
00591
00592