Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoQtPlaneViewer.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : Alain Dumesny (MMM yyyy)
22**=======================================================================*/
23
24
25#ifndef _SO_QT_PLANE_VIEWER_
26#define _SO_QT_PLANE_VIEWER_
27#include <Inventor/Qt/OivQtCompat.h>
28
29#include <Inventor/Qt/viewers/SoQtFullViewer.h>
30#include <Inventor/SbLinear.h>
31
32#include <Inventor/Gui/viewers/SoGuiPlaneViewer.h>
33
34#include <QPointer>
35
37//
38// Class: SoQtPlaneViewer
39//
40// Plane Viewer - allows the user to move left, right, up, and down a
41// given plane, as well as roll the viewer and zoom in and out.
42//
43//
44// Keys used by this viewer:
45// -------------------------
46//
47// Left Mouse: Dolly in and out (gets closer to and further away from the
48// object).
49//
50// Middle Mouse:
51// Ctrl + Left Mouse: Translate up, down, left and right.
52//
53// Ctrl + Middle Mouse: Used for roll action (rotates around the viewer
54// forward direction).
55//
56// Shift + Ctrl + Left Mouse: Roll (same as Ctrl + Middle Mouse behavior
57// but added by VSG to support the standard
58// Microsoft 2-button mouse).
59//
60// <s> + click: Alternative to the Seek button. Press (but do not hold down)
61// the <s> key, then click on a target object.
62//
63// Right Mouse: Open the popup menu.
64//
66
128{
129
130 Q_OBJECT
131
132 public:
141 SoQtPlaneViewer( QWidget* parent = NULL,
142 const char* name = NULL,
143 SbBool buildInsideParent = TRUE,
150
154 void setPlane( const SbVec3f& newNormal, const SbVec3f& newRight );
155
156 //
157 // redefine these to add Plane viewer functionality
158 //
159 virtual void setViewing( SbBool onOrOff );
160 virtual void setCamera( SoCamera* cam );
161 virtual void setCursorEnabled( SbBool onOrOff );
162 virtual void setSeekMode( SbBool onOrOff );
163
164 private:
165 SoGuiPlaneViewer* getGuiPlaneViewer() const;
166
167 // This constructor takes a boolean whether to build the widget now.
168 // Subclasses can pass FALSE, then call SoQtPlaneViewer::buildWidget()
169 // when they are ready for it to be built.
170 private:
171 SoQtPlaneViewer( QWidget* parent,
172 const char* name,
173 SbBool buildInsideParent,
175 SoQtViewer::Type type,
176 SbBool buildNow,
177 SbBool sync = true );
178
179private:
180
181 QWidget* buildWidget( QWidget* parent );
182
183 // redefine these
184 virtual SbString getDefaultWidgetName() const;
185 virtual SbString getDefaultTitle() const;
186 virtual SbString getDefaultIconTitle() const;
187
188 // redefine those routines to do viewer specific stuff
189 virtual void processEvent( QEvent* anyevent );
190 virtual void actualRedraw();
191
192 // Define those thumb wheels to translate in the viewer plane
193 virtual void bottomWheelMotion( float newVal );
194 virtual void leftWheelMotion( float newVal );
195 virtual void rightWheelMotion( float newVal );
196 virtual void mouseWheelMotion( float newVal );
197
198 // add viewer preference stuff
199 virtual void createPrefSheet();
200
201 // add some viewer buttons
202 virtual void createViewerButtons( QWidget* parent );
203
204 // Define this to bring the viewer help card
205 virtual void openViewerHelpCard();
206
207 // Redefine this to keep the same camera rotation when seeking
208 virtual void computeSeekFinalOrientation();
209
210 // It's a long story, but since we can't attach callbacks to a window
211 // quite like we can to an Xt widget, it makes more sense for the
212 // subclass viewer to handle the buttons it knows about then pass
213 // the rest back up to SoQtFullViewer.
214 //
215 // So WINxx this function must be virtual and protected, not private.
216 virtual void pushButtonCB( int id );
217
218 virtual void updateCursor();
219
220 private:
221
222 SoGuiPlaneViewer* m_guiPlaneViewer; // Implementation class for SoXxPlaneViewer
223
224 // push button vars and callbacks
225 QPointer<SoQtButton> buttonList[10];
226
227 // Added for WINxx port, makes it easier to merge WINxx and X code.
228 // For _WIN32 saving this value saves us having to reload the normal
229 // cursor all the time. For X it's always NULL. --mmh 2/12/95
230
231 void updateViewerMode( unsigned int state );
232 void switchMode( int newMode );
233
234 // this is called by both constructors
235 void constructorCommon( SbBool buildNow );
236
237 // Utility function called from processEvent
238 void processPopupItem( int item );
239
240 private Q_SLOTS:
241
242 void slot_xButton();
243 void slot_yButton();
244 void slot_zButton();
245 void slotCamPushButton();
246};
247
248
249#endif /* _SO_QT_PLANE_VIEWER_ */
250
Class for smart character strings.
Definition SbString.h:202
3D vector class.
Definition SbVec.h:932
Abstract base class for camera nodes.
Definition SoCamera.h:188
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Base viewer clas...
BuildFlag
Build flags.
@ BUILD_ALL
Build everything by default.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Viewer component...
virtual void setSeekMode(SbBool onOrOff)
Set the viewer into/out of seek mode (default OFF).
virtual void setCamera(SoCamera *cam)
Sets the edited camera.
SoQtPlaneViewer(QWidget *parent=NULL, const char *name=NULL, SbBool buildInsideParent=TRUE, SoQtFullViewer::BuildFlag flag=SoQtFullViewer::BUILD_ALL, SoQtViewer::Type type=SoQtViewer::BROWSER)
Constructor which specifies the viewer type.
virtual void setCursorEnabled(SbBool onOrOff)
Sets whether the viewer is allowed to change the cursor over the renderArea window.
~SoQtPlaneViewer()
Destructor.
virtual void setViewing(SbBool onOrOff)
Sets whether the viewer is turned on or off.
void setPlane(const SbVec3f &newNormal, const SbVec3f &newRight)
Moves the camera to be aligned with the given plane.
Type
Editor types.
Definition SoQtViewer.h:194
@ BROWSER
Camera views scene, but is not added to scene.
Definition SoQtViewer.h:198
int SbBool
Boolean type.
Definition SbBase.h:87