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 00127 class SoQtPlaneViewer : public SoQtFullViewer 00128 { 00129 00130 Q_OBJECT 00131 00132 public: 00141 SoQtPlaneViewer( QWidget* parent = NULL, 00142 const char* name = NULL, 00143 SbBool buildInsideParent = TRUE, 00144 SoQtFullViewer::BuildFlag flag = SoQtFullViewer::BUILD_ALL, 00145 SoQtViewer::Type type = SoQtViewer::BROWSER ); 00149 ~SoQtPlaneViewer(); 00150 00154 void setPlane( const SbVec3f& newNormal, const SbVec3f& newRight ); 00155 00156 // 00157 // redefine these to add Plane viewer functionality 00158 // 00159 virtual void setViewing( SbBool onOrOff ); 00160 virtual void setCamera( SoCamera* cam ); 00161 virtual void setCursorEnabled( SbBool onOrOff ); 00162 virtual void setSeekMode( SbBool onOrOff ); 00163 00164 private: 00165 SoGuiPlaneViewer* getGuiPlaneViewer() const; 00166 00167 // This constructor takes a boolean whether to build the widget now. 00168 // Subclasses can pass FALSE, then call SoQtPlaneViewer::buildWidget() 00169 // when they are ready for it to be built. 00170 private: 00171 SoQtPlaneViewer( QWidget* parent, 00172 const char* name, 00173 SbBool buildInsideParent, 00174 SoQtFullViewer::BuildFlag flag, 00175 SoQtViewer::Type type, 00176 SbBool buildNow, 00177 SbBool sync = true ); 00178 00179 private: 00180 00181 QWidget* buildWidget( QWidget* parent ); 00182 00183 // redefine these 00184 virtual SbString getDefaultWidgetName() const; 00185 virtual SbString getDefaultTitle() const; 00186 virtual SbString getDefaultIconTitle() const; 00187 00188 // redefine those routines to do viewer specific stuff 00189 virtual void processEvent( QEvent* anyevent ); 00190 virtual void actualRedraw(); 00191 00192 // Define those thumb wheels to translate in the viewer plane 00193 virtual void bottomWheelMotion( float newVal ); 00194 virtual void leftWheelMotion( float newVal ); 00195 virtual void rightWheelMotion( float newVal ); 00196 virtual void mouseWheelMotion( float newVal ); 00197 00198 // add viewer preference stuff 00199 virtual void createPrefSheet(); 00200 00201 // add some viewer buttons 00202 virtual void createViewerButtons( QWidget* parent ); 00203 00204 // Define this to bring the viewer help card 00205 virtual void openViewerHelpCard(); 00206 00207 // Redefine this to keep the same camera rotation when seeking 00208 virtual void computeSeekFinalOrientation(); 00209 00210 // It's a long story, but since we can't attach callbacks to a window 00211 // quite like we can to an Xt widget, it makes more sense for the 00212 // subclass viewer to handle the buttons it knows about then pass 00213 // the rest back up to SoQtFullViewer. 00214 // 00215 // So WINxx this function must be virtual and protected, not private. 00216 virtual void pushButtonCB( int id ); 00217 00218 virtual void updateCursor(); 00219 00220 private: 00221 00222 SoGuiPlaneViewer* m_guiPlaneViewer; // Implementation class for SoXxPlaneViewer 00223 00224 // push button vars and callbacks 00225 QPointer<SoQtButton> buttonList[10]; 00226 00227 // Added for WINxx port, makes it easier to merge WINxx and X code. 00228 // For _WIN32 saving this value saves us having to reload the normal 00229 // cursor all the time. For X it's always NULL. --mmh 2/12/95 00230 00231 void updateViewerMode( unsigned int state ); 00232 void switchMode( int newMode ); 00233 00234 // this is called by both constructors 00235 void constructorCommon( SbBool buildNow ); 00236 00237 // Utility function called from processEvent 00238 void processPopupItem( int item ); 00239 00240 private Q_SLOTS: 00241 00242 void slot_xButton(); 00243 void slot_yButton(); 00244 void slot_zButton(); 00245 void slotCamPushButton(); 00246 }; 00247 00248 00249 #endif /* _SO_QT_PLANE_VIEWER_ */ 00250 00251