00001 /*======================================================================= 00002 * Copyright 1991-1996, Silicon Graphics, Inc. 00003 * ALL RIGHTS RESERVED 00004 * 00005 * UNPUBLISHED -- Rights reserved under the copyright laws of the United 00006 * States. Use of a copyright notice is precautionary only and does not 00007 * imply publication or disclosure. 00008 * 00009 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND: 00010 * Use, duplication or disclosure by the Government is subject to restrictions 00011 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights 00012 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or 00013 * in similar or successor clauses in the FAR, or the DOD or NASA FAR 00014 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc., 00015 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311. 00016 * 00017 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY 00018 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION, 00019 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY 00020 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON 00021 * GRAPHICS, INC. 00022 **=======================================================================*/ 00023 /*======================================================================= 00024 ** Author : Alain Dumesny (MMM yyyy) 00025 **=======================================================================*/ 00026 /*======================================================================= 00027 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00028 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00029 *** *** 00030 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00031 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00032 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00033 *** *** 00034 *** RESTRICTED RIGHTS LEGEND *** 00035 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00036 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00037 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00038 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00039 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00040 *** *** 00041 *** COPYRIGHT (C) 1996-2023 BY FEI S.A.S, *** 00042 *** BORDEAUX, FRANCE *** 00043 *** ALL RIGHTS RESERVED *** 00044 **=======================================================================*/ 00045 /*======================================================================= 00046 ** Modified by : VSG (MMM YYYY) 00047 **=======================================================================*/ 00048 00049 00050 #ifdef SOQT 00051 # include <Inventor/Qt/viewers/SoQtFlyViewer.h> 00052 #elif defined _WIN32 00053 # include <Inventor/Win/viewers/SoWinFlyViewer.h> 00054 #else // _WIN32 00055 00056 #ifndef _SO_XT_FLY_VIEWER_ 00057 #define _SO_XT_FLY_VIEWER_ 00058 00059 #include <Inventor/Xt/viewers/SoXtConstrainedViewer.h> 00060 #include <Inventor/SbLinear.h> 00061 #include <Inventor/SbTime.h> 00062 #include <Inventor/Gui/viewers/SoGuiFlyViewer.h> 00063 00064 class SoFieldSensor; 00065 00067 // 00068 // Class: SoXtFlyViewer 00069 // 00070 // 00071 // Keys used by this viewer: 00072 // ------------------------- 00073 // 00074 // Left Mouse: Click to increase speed. 00075 // 00076 // <s> + Left Mouse: Alternative to the Seek button. Press (but do not 00077 // hold down) the <s> key, then click on a target object. 00078 // 00079 // <U> + Left Mouse: Press (but do not hold down) the <U> key, then 00080 // click on a target object to set the "up" direction to the surface normal. 00081 // By default +y is the "up" direction. 00082 // 00083 // Middle Mouse: Click to decrease speed. 00084 // 00085 // Left and Middle Mouse: Click boths simultaneously to stop. 00086 // 00087 // Ctrl: Hold the key down to temporary stop and rotate the viewpoint. 00088 // 00089 // Right Mouse: Open the popup menu. 00090 // 00092 00168 class SoXtFlyViewer : public SoXtConstrainedViewer 00169 { 00170 public: 00171 00176 SoXtFlyViewer( SoWidget parent = NULL, 00177 const char* name = NULL, 00178 SbBool buildInsideParent = TRUE, 00179 SoXtFullViewer::BuildFlag flag = SoXtFullViewer::BUILD_ALL, 00180 SoXtViewer::Type type = SoXtViewer::BROWSER ); 00181 00185 ~SoXtFlyViewer(); 00186 00187 // redefine these to add fly viewer functionality 00188 virtual void setViewing( SbBool onOrOff ); 00189 virtual void resetToHomePosition(); 00190 virtual void setCamera( SoCamera* cam ); 00191 virtual void setCursorEnabled( SbBool onOrOff ); 00192 virtual void setSeekMode( SbBool onOrOff ); 00193 00194 // This is redefined to prevent the camera type from being changed 00195 virtual void setCameraType( SoType type ); 00196 00197 // set/get minimum speed in word coodinate / second 00198 // default value is 0, meaning the minimum speed is computed according to scene graph extent 00199 void setMinSpeed( float speed ); 00200 float getMinSpeed(); 00201 00202 // set/get speed multiplier. default value is 1.5 00203 void setSpeedMultiplier( float speedInc ); 00204 float getSpeedMultiplier(); 00205 00206 private: 00207 00208 SoGuiFlyViewer* getGuiFlyViewer() const; 00209 00210 // This constructor takes a boolean whether to build the widget now. 00211 // Subclasses can pass FALSE, then call SoXtFlyViewer::buildWidget() 00212 // when they are ready for it to be built. 00213 private: 00214 SoXtFlyViewer( SoWidget parent, 00215 const char* name, 00216 SbBool buildInsideParent, 00217 SoXtFullViewer::BuildFlag flag, 00218 SoXtViewer::Type type, 00219 SbBool buildNow, 00220 SbBool sync = TRUE ); 00221 00222 private: 00223 // redefine these 00224 virtual SbString getDefaultWidgetName() const; 00225 virtual SbString getDefaultTitle() const; 00226 virtual SbString getDefaultIconTitle() const; 00227 00228 // redefine those routines to do viewer specific stuff 00229 virtual void processEvent( XAnyEvent* anyevent ); 00230 virtual void actualRedraw(); 00231 virtual void rightWheelMotion( float newVal ); 00232 00233 // add viewer preference stuff 00234 virtual void createPrefSheet(); 00235 00236 // Define this to bring the viewer help card 00237 virtual void openViewerHelpCard(); 00238 00239 private: 00240 // viewer state variables 00241 Cursor viewerCursor, seekCursor, upCursor; 00242 SbRotation camStartOrientation; 00243 00244 // preference sheet stuff 00245 SoWidget createFlyPrefSheetGuts( SoWidget parent ); 00246 static void incPrefSheetButtonCB( SoWidget w, SoXtFlyViewer* v, void* data); 00247 static void decPrefSheetButtonCB( SoWidget w, SoXtFlyViewer* v, void* data ); 00248 00249 void defineCursors(); 00250 void switchMode( int newMode ); 00251 void changeMaxStraightSpeed( SbBool increase ); 00252 00253 // this is called by both constructors 00254 void constructorCommon( SbBool buildNow ); 00255 00256 SoGuiFlyViewer* m_guiFlyViewer; 00257 }; 00258 00259 #endif /* _SO_XT_FLY_VIEWER_ */ 00260 00261 #endif // _WIN32 00262 00263 00264