00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : Alain Dumesny (MMM yyyy) 00022 **=======================================================================*/ 00023 00024 00025 #ifndef _SO_QT_PLANE_VIEWER_ 00026 #define _SO_QT_PLANE_VIEWER_ 00027 #include <Inventor/Qt/OivQtCompat.h> 00028 00029 #include <Inventor/Qt/viewers/SoQtFullViewer.h> 00030 #include <Inventor/SbLinear.h> 00031 00032 #include <Inventor/Gui/viewers/SoGuiPlaneViewer.h> 00033 00034 #include <QPointer> 00035 00037 // 00038 // Class: SoQtPlaneViewer 00039 // 00040 // Plane Viewer - allows the user to move left, right, up, and down a 00041 // given plane, as well as roll the viewer and zoom in and out. 00042 // 00043 // 00044 // Keys used by this viewer: 00045 // ------------------------- 00046 // 00047 // Left Mouse: Dolly in and out (gets closer to and further away from the 00048 // object). 00049 // 00050 // Middle Mouse: 00051 // Ctrl + Left Mouse: Translate up, down, left and right. 00052 // 00053 // Ctrl + Middle Mouse: Used for roll action (rotates around the viewer 00054 // forward direction). 00055 // 00056 // Shift + Ctrl + Left Mouse: Roll (same as Ctrl + Middle Mouse behavior 00057 // but added by VSG to support the standard 00058 // Microsoft 2-button mouse). 00059 // 00060 // <s> + click: Alternative to the Seek button. Press (but do not hold down) 00061 // the <s> key, then click on a target object. 00062 // 00063 // Right Mouse: Open the popup menu. 00064 // 00066 00128 class SoQtPlaneViewer : public SoQtFullViewer 00129 { 00130 00131 Q_OBJECT 00132 00133 public: 00142 SoQtPlaneViewer( QWidget* parent = NULL, 00143 const char* name = NULL, 00144 SbBool buildInsideParent = TRUE, 00145 SoQtFullViewer::BuildFlag flag = SoQtFullViewer::BUILD_ALL, 00146 SoQtViewer::Type type = SoQtViewer::BROWSER ); 00150 ~SoQtPlaneViewer(); 00151 00155 void setPlane( const SbVec3f& newNormal, const SbVec3f& newRight ); 00156 00157 // 00158 // redefine these to add Plane viewer functionality 00159 // 00160 virtual void setViewing( SbBool onOrOff ); 00161 virtual void setCamera( SoCamera* cam ); 00162 virtual void setCursorEnabled( SbBool onOrOff ); 00163 virtual void setSeekMode( SbBool onOrOff ); 00164 00165 private: 00166 SoGuiPlaneViewer* getGuiPlaneViewer() const; 00167 00168 // This constructor takes a boolean whether to build the widget now. 00169 // Subclasses can pass FALSE, then call SoQtPlaneViewer::buildWidget() 00170 // when they are ready for it to be built. 00171 private: 00172 SoQtPlaneViewer( QWidget* parent, 00173 const char* name, 00174 SbBool buildInsideParent, 00175 SoQtFullViewer::BuildFlag flag, 00176 SoQtViewer::Type type, 00177 SbBool buildNow, 00178 SbBool sync = true ); 00179 00180 private: 00181 00182 QWidget* buildWidget( QWidget* parent ); 00183 00184 // redefine these 00185 virtual SbString getDefaultWidgetName() const; 00186 virtual SbString getDefaultTitle() const; 00187 virtual SbString getDefaultIconTitle() const; 00188 00189 // redefine those routines to do viewer specific stuff 00190 virtual void processEvent( QEvent* anyevent ); 00191 virtual void actualRedraw(); 00192 00193 // Define those thumb wheels to translate in the viewer plane 00194 virtual void bottomWheelMotion( float newVal ); 00195 virtual void leftWheelMotion( float newVal ); 00196 virtual void rightWheelMotion( float newVal ); 00197 virtual void mouseWheelMotion( float newVal ); 00198 00199 // add viewer preference stuff 00200 virtual void createPrefSheet(); 00201 00202 // add some viewer buttons 00203 virtual void createViewerButtons( QWidget* parent ); 00204 00205 // Define this to bring the viewer help card 00206 virtual void openViewerHelpCard(); 00207 00208 // Redefine this to keep the same camera rotation when seeking 00209 virtual void computeSeekFinalOrientation(); 00210 00211 // It's a long story, but since we can't attach callbacks to a window 00212 // quite like we can to an Xt widget, it makes more sense for the 00213 // subclass viewer to handle the buttons it knows about then pass 00214 // the rest back up to SoQtFullViewer. 00215 // 00216 // So WINxx this function must be virtual and protected, not private. 00217 virtual void pushButtonCB( int id ); 00218 00219 virtual void updateCursor(); 00220 00221 private: 00222 00223 SoGuiPlaneViewer* m_guiPlaneViewer; // Implementation class for SoXxPlaneViewer 00224 00225 // push button vars and callbacks 00226 QPointer<SoQtButton> buttonList[10]; 00227 00228 // Added for WINxx port, makes it easier to merge WINxx and X code. 00229 // For _WIN32 saving this value saves us having to reload the normal 00230 // cursor all the time. For X it's always NULL. --mmh 2/12/95 00231 00232 void updateViewerMode( unsigned int state ); 00233 void switchMode( int newMode ); 00234 00235 // this is called by both constructors 00236 void constructorCommon( SbBool buildNow ); 00237 00238 // Utility function called from processEvent 00239 void processPopupItem( int item ); 00240 00241 private Q_SLOTS: 00242 00243 void slot_xButton(); 00244 void slot_yButton(); 00245 void slot_zButton(); 00246 void slotCamPushButton(); 00247 }; 00248 00249 00250 #endif /* _SO_QT_PLANE_VIEWER_ */ 00251 00252