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 #if defined(_WIN32)
00026 #  include <Inventor/MP/Win/viewers/SoWinMPExaminerViewer.h>
00027 #else // _WIN32
00028 
00029 #ifndef  _SO_XT_MP_EXAMINER_VIEWER_
00030 #define  _SO_XT_MP_EXAMINER_VIEWER_
00031 
00032 #include <Inventor/MP/Xt/viewers/SoXtMPFullViewer.h>
00033 #include <Inventor/SbLinear.h>
00034 
00035 
00036 class SbSphereSheetProjector;
00037 class SoFieldSensor;
00038 class SoSeparator;
00039 class SoSwitch;
00040 class SoTranslation;
00041 class SoScale;
00042 class SoXtBitmapButton;
00043 class SoXtCursor;
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 
00071 
00145 class  SoXtMPExaminerViewer : public SoXtMPFullViewer {
00146  public:
00151   SoXtMPExaminerViewer(
00152                        SoWidget parent = NULL,
00153                        const char *name = NULL, 
00154                        SbBool buildInsideParent = TRUE, 
00155                        SoXtMPFullViewer::BuildFlag flag = BUILD_ALL, 
00156                        SoXtMPViewer::Type type = BROWSER);
00160   ~SoXtMPExaminerViewer();
00161     
00166   void        setFeedbackVisibility(SbBool onOrOff);
00170   SbBool      isFeedbackVisible() const       { return feedbackFlag; }
00171     
00175   void        setFeedbackSize(int newSize);
00179   int         getFeedbackSize() const         { return (int)feedbackSize; }
00180     
00185   void        setAnimationEnabled(SbBool onOrOff);
00189   SbBool      isAnimationEnabled()            { return animationEnabled; }
00190     
00194   void        stopAnimating();
00198   SbBool      isAnimating()                   { return animatingFlag; }
00199     
00200   
00201   
00202   
00203   virtual void        viewAll();
00204   virtual void        resetToHomePosition();
00205   virtual void        setCamera(SoCamera *cam);
00206   virtual void        setViewing(SbBool onOrOff);
00207   virtual void        setCursorEnabled(SbBool onOrOff);
00208     
00213   void setCursor(SoXtCursor *cursor);
00214 
00219   SoXtCursor * newCursor(void);
00220 
00221  private:
00222   
00223   
00224   
00225   
00226   SoEXTENDER
00227     SoXtMPExaminerViewer(
00228                          SoWidget parent,
00229                          const char *name, 
00230                          SbBool buildInsideParent, 
00231                          SoXtMPFullViewer::BuildFlag flag, 
00232                          SoXtMPViewer::Type type, 
00233                          SbBool buildNow);
00234             
00235   
00236   virtual SbString    getDefaultWidgetName() const;
00237   virtual SbString    getDefaultTitle() const;
00238   virtual SbString    getDefaultIconTitle() const;
00239     
00240   
00241   virtual void        processEvent(XAnyEvent *anyevent);
00242   virtual void        setSeekMode(SbBool onOrOff);
00243     
00244   virtual void  prepareRedraw();
00245   virtual void        actualRedraw();
00246   virtual void  endRedraw();
00247     
00248   
00249   SoWidget              buildWidget(SoWidget parent);
00250     
00251   
00252   virtual void        bottomWheelMotion(float newVal);
00253   virtual void        leftWheelMotion(float newVal);
00254   virtual void        rightWheelMotion(float newVal);
00255     
00256   
00257   virtual void        bottomWheelStart();
00258   virtual void        leftWheelStart();
00259     
00260   
00261   virtual void        createPrefSheet();
00262     
00263   
00264   virtual void        createViewerButtons(SoWidget parent);
00265     
00266   
00267   virtual void        openViewerHelpCard();
00268     
00269  private:
00270   
00271   int             mode;
00272   SbBool          createdCursors;
00273   SoXtCursor      *spinCursor, *panCursor, *dollyCursor, *seekCursor;
00274   SbSphereSheetProjector *sphereSheet;
00275   SbVec2s         locator; 
00276   SbBool          firstBuild; 
00277     
00278   
00279   SbBool          feedbackFlag;
00280   float           feedbackSize;
00281   SoSeparator     *feedbackRoot;
00282   SoSwitch        *feedbackSwitch;
00283   SoTranslation   *feedbackTransNode;
00284   SoScale         *feedbackScaleNode;
00285   static const char *geometryBuffer;
00286   void            createFeedbackNodes();
00287     
00288   
00289   SbBool          animationEnabled, animatingFlag;
00290   SoFieldSensor   *animationSensor;
00291   SbRotation      *rotBuffer;
00292   int             firstIndex, lastIndex;
00293   unsigned long   lastMotionTime;
00294   SbRotation      averageRotation;
00295   SbBool          computeAverage;
00296   static void     animationSensorCB(void *v, SoSensor *s);
00297   static void     visibilityChangeCB(void *pt, SbBool visible);
00298   void            doSpinAnimation();
00299     
00300   
00301   SbVec3f         locator3D;
00302   SbPlane         focalplane;
00303     
00304   void            updateViewerMode(unsigned int state);
00305   void            switchMode(int newMode);
00306   void            updateCursor();
00307   void            defineCursors();
00308   void            rotateCamera(const SbRotation &rot);
00309   void            panCamera(const SbVec2f &newLocator);
00310   void            spinCamera(const SbVec2f &newLocator);
00311   void            dollyCamera(const SbVec2s &newLocator);
00312     
00313   
00314   SoWidget          createExamPrefSheetGuts(SoWidget parent);
00315   static void     animPrefSheetToggleCB(SoWidget, SoXtMPExaminerViewer *, void *);
00316     
00317   
00318   int             feedbackSizeWheelVal;
00319   SoWidget          feedbackLabel[2], feedbackField, feedbackSizeWheel;
00320   static void     feedbackSizeWheelCB(SoWidget, SoXtMPExaminerViewer *p, XtPointer *d);
00321   static void     feedbackSizeFieldCB(SoWidget, SoXtMPExaminerViewer *, void *);
00322   static void     feedbackPrefSheetToggleCB(SoWidget, SoXtMPExaminerViewer *, void *);
00323   void            toggleFeedbackWheelSize(SoWidget toggle);
00324     
00325   
00326   SoXtBitmapButton  *buttonList[10];
00327   static void     camPushCB(SoWidget, SoXtMPExaminerViewer *, void *);
00328 
00329   
00330   void constructorCommon(SbBool buildNow);
00331 
00332 };
00333 
00334 #endif  
00335 
00336 #endif // _WIN32
00337 
00338 
00339