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/Win/viewers/SoWinFlyViewer.h>
00027 #else // _WIN32
00028 
00029 #ifndef  _SO_XT_MP_FLY_VIEWER_
00030 #define  _SO_XT_MP_FLY_VIEWER_
00031 
00032 #include <Inventor/MP/Xt/viewers/SoXtMPConstrainedViewer.h>
00033 #include <Inventor/SbLinear.h>
00034 #include <Inventor/SbTime.h>
00035 
00036 class   SoFieldSensor;
00037 
00039 
00040 
00041 
00042 
00043 
00044 
00045 
00046 
00047 
00048 
00049 
00050 
00051 
00052 
00053 
00054 
00055 
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00064 
00143 class  SoXtMPFlyViewer : public SoXtMPConstrainedViewer {
00144  public:
00145     
00150   SoXtMPFlyViewer(
00151                   SoWidget parent = NULL,
00152                   const char *name = NULL, 
00153                   SbBool buildInsideParent = TRUE, 
00154                   SoXtMPFullViewer::BuildFlag flag = BUILD_ALL,
00155                   SoXtMPViewer::Type type = BROWSER);
00159   ~SoXtMPFlyViewer();
00160     
00161   
00162   
00163   
00164   virtual void    setViewing(SbBool onOrOff);
00165   virtual void    resetToHomePosition();
00166   virtual void    setCamera(SoCamera *cam);
00167   virtual void    setCursorEnabled(SbBool onOrOff);
00168     
00169   
00170   virtual void    setCameraType(SoType type);
00171 
00172   
00173   
00174   void  setMinSpeed( float speed );
00175   float getMinSpeed();
00176 
00177   
00178   void  setSpeedMultiplier( float speedInc );
00179   float getSpeedMultiplier();
00180     
00181  private:
00182   
00183   
00184   
00185   
00186   SoEXTENDER
00187     SoXtMPFlyViewer(
00188                     SoWidget parent,
00189                     const char *name, 
00190                     SbBool buildInsideParent, 
00191                     SoXtMPFullViewer::BuildFlag flag, 
00192                     SoXtMPViewer::Type type, 
00193                     SbBool buildNow);
00194             
00195   
00196   virtual SbString    getDefaultWidgetName() const;
00197   virtual SbString    getDefaultTitle() const;
00198   virtual SbString    getDefaultIconTitle() const;
00199     
00200   
00201   virtual void        processEvent(XAnyEvent *anyevent);
00202   virtual void        setSeekMode(SbBool onOrOff);
00203   virtual void        actualRedraw();
00204   virtual void        rightWheelMotion(float);
00205     
00206   
00207   virtual void        createPrefSheet();
00208     
00209   
00210   virtual void        openViewerHelpCard();
00211     
00212  private:
00213   
00214   int             mode;
00215   SbBool          createdCursors;
00216   
00217   Cursor          *viewerCursor, *seekCursor, *upCursor;
00218 
00219   SbVec2s         locator; 
00220   SbVec2s         startPos; 
00221   SbRotation      camStartOrientation;
00222     
00223   
00224   SoFieldSensor   *animationSensor;
00225   SbTime          prevAnimTime;
00226   float           speed, maxSpeed, maxStraightSpeed;
00227   float           speedLimit, speedLimitFactor;
00228   float           minSpeed, maxInc;
00229     
00230   
00231   SoWidget          createFlyPrefSheetGuts(SoWidget parent);
00232   static void     incPrefSheetButtonCB(SoWidget, SoXtMPFlyViewer *, void *);
00233   static void     decPrefSheetButtonCB(SoWidget, SoXtMPFlyViewer *, void *);
00234     
00235   void            defineCursors();
00236   void            drawViewerFeedback();
00237   void            switchMode(int newMode);
00238   void            changeMaxStraightSpeed(SbBool increase);
00239   void            calculateMaxSpeed();
00240   static void     animationSensorCB(void *, SoSensor *);
00241   void            doCameraAnimation();
00242 
00243   
00244   void constructorCommon(SbBool buildNow);
00245         
00246   
00247   void mpXDefineCursor(Cursor *);
00248   void mpXUndefineCursor(void);
00249 
00250 };
00251 
00252 #endif  
00253 
00254 #endif // _WIN32
00255 
00256 
00257