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-2020 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/SoQtPlaneViewer.h> 00052 #elif defined _WIN32 00053 # include <Inventor/Win/viewers/SoWinPlaneViewer.h> 00054 #else // _WIN32 00055 00056 #ifndef _SO_XT_PLANE_VIEWER_ 00057 #define _SO_XT_PLANE_VIEWER_ 00058 00059 #include <Inventor/Xt/viewers/SoXtFullViewer.h> 00060 #include <Inventor/SbLinear.h> 00061 00062 #include <Inventor/Gui/viewers/SoGuiPlaneViewer.h> 00063 00064 class SoXtBitmapButton; 00065 00066 00068 // 00069 // Class: SoXtPlaneViewer 00070 // 00071 // Plane Viewer - allows the user to move the camera in a plane, zoom in 00072 // and out, as well as rotate the viewing plane. 00073 // 00074 // Keys used by this viewer: 00075 // ------------------------- 00076 // 00077 // Left Mouse: Dolly in and out (gets closer to and further away from the 00078 // object). 00079 // 00080 // Middle Mouse: 00081 // Ctrl + Left Mouse: Translate up, down, left and right. 00082 // 00083 // Ctrl + Middle Mouse: Used for roll action (rotates around the viewer 00084 // forward direction). 00085 // 00086 // <s> + click: Alternative to the Seek button. Press (but do not hold down) 00087 // the <s> key, then click on a target object. 00088 // 00089 // Right Mouse: Open the popup menu. 00090 // 00092 00168 class SoXtPlaneViewer : public SoXtFullViewer 00169 { 00170 public: 00175 SoXtPlaneViewer( SoWidget parent = NULL, 00176 const char* name = NULL, 00177 SbBool buildInsideParent = TRUE, 00178 SoXtFullViewer::BuildFlag flag = SoXtFullViewer::BUILD_ALL, 00179 SoXtViewer::Type type = SoXtViewer::BROWSER ); 00183 ~SoXtPlaneViewer(); 00184 00188 void setPlane( const SbVec3f& newNormal, const SbVec3f& newRight ); 00189 00190 // redefine these to add Plane viewer functionality 00191 virtual void setViewing( SbBool onOrOff ); 00192 virtual void setCamera( SoCamera* cam ); 00193 virtual void setCursorEnabled( SbBool onOrOff ); 00194 virtual void setSeekMode( SbBool onOrOff ); 00195 00196 private: 00197 SoGuiPlaneViewer* getGuiPlaneViewer() const; 00198 00199 // This constructor takes a boolean whether to build the widget now. 00200 // Subclasses can pass FALSE, then call SoXtPlaneViewer::buildWidget() 00201 // when they are ready for it to be built. 00202 private: 00203 SoXtPlaneViewer( SoWidget parent, 00204 const char* name, 00205 SbBool buildInsideParent, 00206 SoXtFullViewer::BuildFlag flag, 00207 SoXtViewer::Type type, 00208 SbBool buildNow, 00209 SbBool sync = TRUE ); 00210 private: 00211 00212 SoWidget buildWidget( SoWidget parent ); 00213 00214 // redefine these 00215 virtual SbString getDefaultWidgetName() const; 00216 virtual SbString getDefaultTitle() const; 00217 virtual SbString getDefaultIconTitle() const; 00218 00219 // redefine those routines to do viewer specific stuff 00220 virtual void processEvent( XAnyEvent* anyevent ); 00221 virtual void actualRedraw(); 00222 00223 // Define those thumb wheels to translate in the viewer plane 00224 virtual void bottomWheelMotion( float newVal ); 00225 virtual void leftWheelMotion( float newVal ); 00226 virtual void rightWheelMotion( float newVal ); 00227 00228 // add viewer preference stuff 00229 virtual void createPrefSheet(); 00230 00231 // add some viewer buttons 00232 virtual void createViewerButtons( SoWidget parent ); 00233 00234 // Define this to bring the viewer help card 00235 virtual void openViewerHelpCard(); 00236 00237 // Redefine this to keep the same camera rotation when seeking 00238 virtual void computeSeekFinalOrientation(); 00239 00240 virtual void updateCursor(); 00241 00242 private: 00243 // viewer state variables 00244 Cursor transCursor, dollyCursor, seekCursor; 00245 00246 // push button vars and callbacks 00247 SoXtBitmapButton* buttonList[10]; 00248 static void pushButtonCB( SoWidget w, int id, void* data ); 00249 00250 void updateViewerMode( unsigned int state ); 00251 void switchMode( int newMode ); 00252 void defineCursors(); 00253 00254 // this is called by both constructors 00255 void constructorCommon( SbBool buildNow ); 00256 00257 SoGuiPlaneViewer* m_guiPlaneViewer; // Implementation class for SoXxPlaneViewer 00258 }; 00259 00260 #endif /* _SO_XT_PLANE_VIEWER_ */ 00261 00262 #endif // _WIN32 00263 00264 00265