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
00187 class SoQtExaminerViewer : public SoQtFullViewer
00188 {
00189
00190 Q_OBJECT
00191
00192 public:
00193
00197 enum ViewingMode
00198 {
00202 VIEWING_MODE_SPIN,
00203
00213 VIEWING_MODE_SPIN_CONSTRAINED,
00214
00218 VIEWING_MODE_PAN,
00219
00223 VIEWING_MODE_ROLL,
00224
00229 VIEWING_MODE_ZOOM
00230 } ;
00231
00235 enum ConstrainedViewingMode
00236 {
00240 NONE,
00244 CONSTRAINED_VIEWING_MODE_X,
00245
00249 CONSTRAINED_VIEWING_MODE_Y,
00250
00254 CONSTRAINED_VIEWING_MODE_Z
00255 } ;
00256
00261 SoQtExaminerViewer( QWidget* parent = NULL,
00262 const char* name = NULL,
00263 SbBool buildInsideParent = TRUE,
00264 SoQtFullViewer::BuildFlag flag = SoQtFullViewer::BUILD_ALL,
00265 SoQtViewer::Type type = SoQtViewer::BROWSER );
00269 ~SoQtExaminerViewer();
00270
00277 void setViewingMode( ViewingMode viewingMode ) ;
00278
00282 ViewingMode getViewingMode() const { return (ViewingMode)m_guiExamViewer->getViewingMode(); }
00283
00295 void setConstrainedViewingMode( ConstrainedViewingMode mode );
00296
00300 ConstrainedViewingMode getConstrainedViewingMode() const
00301 { return m_constrainedMode; }
00302
00307 void setFeedbackVisibility( SbBool onOrOff );
00308
00312 SbBool isFeedbackVisible() const { return m_guiExamViewer->isFeedbackVisible(); }
00313
00317 void setFeedbackSize( int newSize );
00318
00322 int getFeedbackSize() const { return m_guiExamViewer->getFeedbackSize(); }
00323
00331 void setAnimationEnabled( SbBool onOrOff );
00332
00336 SbBool isAnimationEnabled() { return m_guiExamViewer->isAnimationEnabled(); }
00337
00341 void stopAnimating();
00342
00346 SbBool isAnimating() { return m_guiExamViewer->isAnimating(); }
00347
00348
00349
00350
00351 virtual void viewAll();
00352 virtual void resetToHomePosition();
00353 virtual void setCamera( SoCamera* cam );
00354 virtual void setViewing( SbBool onOrOff );
00355 virtual void setCursorEnabled( SbBool onOrOff );
00356 virtual void setSeekMode( SbBool onOrOff );
00357
00368 virtual void activateSpinning( const SbVec2s& newLocator );
00369
00380 virtual void activatePanning( const SbVec2s& newLocator );
00381
00392 virtual void activateDolly( const SbVec2s& newLocator );
00393
00404 virtual void activateRoll( const SbVec2s& newLocator );
00405
00412 virtual void rollCamera( const SbVec2s& newLocator );
00413
00420 virtual void spinCamera( const SbVec2f& newLocator );
00421
00432 virtual void spinConstrainedCamera( const SbVec2f& newLocator, int axisIndex );
00433
00442 virtual void dollyCamera( const SbVec2s& newLocator );
00443
00450 virtual void reverseDollyCamera( const SbVec2s& newLocator );
00451
00458 virtual void panCamera( const SbVec2f& newLocator );
00459
00460 private:
00461
00462 SoGuiExaminerViewer* getGuiExaminerViewer() const;
00463
00464 virtual void internalSetViewingMode( int viewingMode ) { setViewingMode( ViewingMode(viewingMode) ); };
00465 virtual int internalGetViewingMode() const { return (int)m_guiExamViewer->getViewingMode(); };
00466
00467 private:
00468
00473 virtual void rotateCamera( const SbRotation& rot );
00474
00484 void constrainCameraRotation( bool x = false, bool y = false, bool z = false );
00485
00486
00487
00488
00489 SoQtExaminerViewer( QWidget* parent,
00490 const char* name,
00491 SbBool buildInsideParent,
00492 SoQtFullViewer::BuildFlag flag,
00493 SoQtViewer::Type type,
00494 SbBool buildNow,
00495 SbBool sync = true );
00496 private:
00497
00498
00499 virtual SbString getDefaultWidgetName() const;
00500 virtual SbString getDefaultTitle() const;
00501 virtual SbString getDefaultIconTitle() const;
00502
00503
00504 virtual void processEvent( QEvent* anyevent );
00505 virtual void actualRedraw();
00506
00507
00508 QWidget* buildWidget( QWidget* parent );
00509
00510
00511 virtual void bottomWheelMotion( float newVal );
00512 virtual void leftWheelMotion( float newVal );
00513 virtual void rightWheelMotion( float newVal );
00514 virtual void mouseWheelMotion( float newVal );
00515
00516
00517 virtual void bottomWheelStart();
00518 virtual void leftWheelStart();
00519
00520
00521 virtual void createPrefSheet();
00522
00523
00524 virtual void createViewerButtons( QWidget* parent );
00525
00526
00527
00528
00529 virtual void buildPopupMenu();
00530
00531
00532 virtual void openViewerHelpCard();
00533
00534 virtual void pushButtonCB( int id );
00535
00536 virtual void updateCursor();
00537
00538 virtual void switchMode( int newMode );
00539
00540 virtual void doSpinAnimation();
00541
00542 int mode;
00543
00544 SbVec2s locator;
00545
00546 private:
00547 SoGuiExaminerViewer* m_guiExamViewer;
00548
00549
00550 SoGuiExaminerViewer::ViewingSpinType m_viewingSpinType;
00551 ConstrainedViewingMode m_constrainedMode;
00552
00553 SbBool firstBuild;
00554
00555
00556 SbTime lastMotionTime;
00557
00558 void setViewerMode();
00559 void updateViewerMode( unsigned int state );
00560
00561
00562 QPointer<SoQtButton> buttonList[10];
00563 static void camPushCB( SoQtExaminerViewer* v);
00564
00565
00566 void constructorCommon( SbBool buildNow );
00567
00568
00569 QPixmap IDB_PUSH_PERSP;
00570 QPixmap IDB_PUSH_ORTHO;
00571
00572 #ifndef HIDDEN_FROM_DOC
00573 private Q_SLOTS:
00574
00575 void slotCamPushButton();
00576
00577
00578 void slot_popup_spin();
00579 void slot_popup_axes();
00580
00581 #endif // HIDDEN_FROM_DOC
00582
00583 private Q_SLOTS:
00584 void visibilityChangeCB( SbBool visible );
00585
00586 };
00587
00588 #endif
00589
00590
00591