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