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(SOWX)
00053 # include <Inventor/Wx/viewers/SoWxExaminerViewer.h>
00054 #elif defined _WIN32
00055 # include <Inventor/Win/viewers/SoWinExaminerViewer.h>
00056 #else // _WIN32
00057
00058 #ifndef _SO_XT_EXAMINER_VIEWER_
00059 #define _SO_XT_EXAMINER_VIEWER_
00060
00061 #include <Inventor/Xt/viewers/SoXtFullViewer.h>
00062 #include <Inventor/events/SoMouseButtonEvent.h>
00063 #include <Inventor/Gui/viewers/SoGuiExaminerViewer.h>
00064
00065
00066 class SbSphereSheetProjector;
00067 class SoFieldSensor;
00068 class SoSeparator;
00069 class SoSwitch;
00070 class SoTranslation;
00071 class SoScale;
00072 class SoXtBitmapButton;
00073
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00100
00221 class SoXtExaminerViewer : public SoXtFullViewer
00222 {
00223 public:
00224
00228 enum ViewingMode
00229 {
00233 VIEWING_MODE_SPIN,
00234
00244 VIEWING_MODE_SPIN_CONSTRAINED,
00245
00249 VIEWING_MODE_PAN,
00250
00255 VIEWING_MODE_ZOOM
00256 };
00257
00261 enum ConstrainedViewingMode
00262 {
00266 NONE,
00270 CONSTRAINED_VIEWING_MODE_X,
00271
00275 CONSTRAINED_VIEWING_MODE_Y,
00276
00280 CONSTRAINED_VIEWING_MODE_Z
00281 };
00282
00287 SoXtExaminerViewer( SoWidget parent = NULL,
00288 const char* name = NULL,
00289 SbBool buildInsideParent = TRUE,
00290 SoXtFullViewer::BuildFlag flag = SoXtFullViewer::BUILD_ALL,
00291 SoXtViewer::Type type = SoXtViewer::BROWSER );
00295 ~SoXtExaminerViewer();
00296
00303 void setViewingMode( ViewingMode viewingMode ) ;
00304
00308 ViewingMode getViewingMode() const
00309 { return (ViewingMode)m_guiExamViewer->getViewingMode(); }
00310
00322 void setConstrainedViewingMode( ConstrainedViewingMode mode );
00323
00327 ConstrainedViewingMode getConstrainedViewingMode() const
00328 { return m_constrainedMode; }
00329
00334 void setFeedbackVisibility( SbBool onOrOff );
00335
00339 SbBool isFeedbackVisible() const { return m_guiExamViewer->isFeedbackVisible(); }
00340
00344 void setFeedbackSize( int newSize );
00345
00349 int getFeedbackSize() const { return m_guiExamViewer->getFeedbackSize(); }
00350
00358 void setAnimationEnabled( SbBool onOrOff );
00359
00363 SbBool isAnimationEnabled() { return m_guiExamViewer->isAnimationEnabled(); }
00364
00368 void stopAnimating();
00369
00373 SbBool isAnimating() { return m_guiExamViewer->isAnimating(); }
00374
00375
00376
00377
00378 virtual void viewAll();
00379 virtual void resetToHomePosition();
00380 virtual void setCamera( SoCamera* cam );
00381 virtual void setViewing( SbBool onOrOff );
00382 virtual void setCursorEnabled( SbBool onOrOff );
00383 virtual void setSeekMode( SbBool onOrOff );
00384
00395 virtual void activateSpinning( const SbVec2s& newLocator );
00396
00407 virtual void activatePanning( const SbVec2s& newLocator );
00408
00419 virtual void activateDolly( const SbVec2s& newLocator );
00420
00431 virtual void activateRoll( const SbVec2s& newLocator );
00432
00439 virtual void rollCamera( const SbVec2s& newLocator );
00440
00441
00448 virtual void spinCamera( const SbVec2f& newLocator );
00449
00460 virtual void spinConstrainedCamera( const SbVec2f& newLocator, int axisIndex );
00461
00470 virtual void dollyCamera( const SbVec2s& newLocator );
00471
00478 virtual void reverseDollyCamera( const SbVec2s& newLocator );
00479
00486 virtual void panCamera( const SbVec2f& newLocator );
00487
00488 private:
00489
00494 virtual void rotateCamera( const SbRotation& rot );
00495
00505 void constrainCameraRotation( bool x = false, bool y = false, bool z = false );
00506
00507 private:
00508
00509 SoGuiExaminerViewer* getGuiExaminerViewer() const;
00510
00511
00512
00513
00514
00515 private:
00516 SoXtExaminerViewer( SoWidget parent,
00517 const char* name,
00518 SbBool buildInsideParent,
00519 SoXtFullViewer::BuildFlag flag,
00520 SoXtViewer::Type type,
00521 SbBool buildNow,
00522 SbBool sync = TRUE );
00523
00524 private:
00525
00526 virtual SbString getDefaultWidgetName() const;
00527 virtual SbString getDefaultTitle() const;
00528 virtual SbString getDefaultIconTitle() const;
00529
00530
00531 virtual void processEvent( XAnyEvent* anyevent );
00532 virtual void actualRedraw();
00533
00534
00535 SoWidget buildWidget( SoWidget parent );
00536
00537
00538 virtual void bottomWheelMotion( float newVal );
00539 virtual void leftWheelMotion( float newVal );
00540 virtual void rightWheelMotion( float newVal );
00541
00542
00543 virtual void bottomWheelStart();
00544 virtual void leftWheelStart();
00545
00546
00547 virtual void createPrefSheet();
00548
00549
00550 virtual void createViewerButtons( SoWidget parent );
00551
00552
00553 virtual void openViewerHelpCard();
00554
00555 virtual void updateCursor();
00556
00557 private:
00558
00559 Cursor spinCursor, panCursor, dollyCursor, seekCursor;
00560 SbBool firstBuild;
00561
00562
00563 void createFeedbackNodes();
00564
00565
00566 unsigned long lastMotionTime;
00567 static void visibilityChangeCB( void* pt, SbBool visible );
00568
00569 void setViewerMode();
00570 void updateViewerMode( unsigned int state );
00571 void switchMode( int newMode );
00572 void defineCursors();
00573
00574
00575 SoWidget createExamPrefSheetGuts( SoWidget parent );
00576 static void animPrefSheetToggleCB( SoWidget w, SoXtExaminerViewer* v, void* data );
00577
00578
00579 int feedbackSizeWheelVal;
00580 SoWidget feedbackLabel[2], feedbackField, feedbackSizeWheel;
00581 static void feedbackSizeWheelCB( SoWidget w, SoXtExaminerViewer* v, XtPointer* d );
00582 static void feedbackSizeFieldCB( SoWidget w, SoXtExaminerViewer* v, void* data );
00583 static void feedbackPrefSheetToggleCB( SoWidget w, SoXtExaminerViewer* v, void* data );
00584 void toggleFeedbackWheelSize( SoWidget toggle );
00585
00586
00587 SoXtBitmapButton* buttonList[10];
00588 static void camPushCB( SoWidget w, SoXtExaminerViewer* v, void* data);
00589
00590
00591 void constructorCommon( SbBool buildNow );
00592
00593 SoGuiExaminerViewer* m_guiExamViewer;
00594
00595
00596 SoGuiExaminerViewer::ViewingSpinType m_viewingSpinType;
00597 ConstrainedViewingMode m_constrainedMode;
00598 };
00599
00600 #endif
00601
00602 #endif // _WIN32
00603
00604
00605