Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SoQtConstrainedViewer.h
Go to the documentation of this file.
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-2014 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_CONSTRAINED_VIEWER_
26#define _SO_QT_CONSTRAINED_VIEWER_
29#include <Inventor/SbBox.h>
30
32
34//
35// Class: SoQtConstrainedViewer
36//
38
61{
62
63 Q_OBJECT
64
65 public:
66
72 void setUpDirection( const SbVec3f& newUpDirection );
76 SbVec3f getUpDirection() { return m_guiConstViewer->getUpDirection(); }
77
78 //
79 // redefine these to add constrained viewer functionality
80 //
81 virtual void setCamera( SoCamera* newCam );
82 virtual void saveHomePosition();
83 virtual void resetToHomePosition();
84 virtual void recomputeSceneSize();
85
86 private:
87 SoGuiConstrainedViewer* getGuiConstrainedViewer() const;
88
89 // Retro compatibility only
90 SbVec3f upDirection;
91 float sceneHeight, sceneSize;
92
93 private:
94
95 SoQtConstrainedViewer( QWidget* parent,
96 const char* name,
97 SbBool buildInsideParent,
99 SoQtViewer::Type type,
100 SbBool buildNow,
101 SbBool sync = true );
102
103 SoQtConstrainedViewer( QWidget* parent,
104 const char* name,
105 SbBool buildInsideParent,
107 SoQtViewer::Type type,
108 SbBool buildNow,
109 SbBool sync,
110 SoGuiConstrainedViewer* guiConstViewer );
111
112 private:
114
115 // Tilts the camera, restraining it to 180 degree rotation from the
116 // up direction. A positive angle tilts the camera up.
117 virtual void tiltCamera( float deltaAngle );
118
119 // Moves the camera forward by the given amount
120 virtual void dollyCamera( float dist );
121
122 // Redefine these to do constrained viewing tasks.
123 // The bottom wheel rotates the camera around the up direction, the
124 // left wheel tilts the camera up/down constraning to 180 degree from
125 // the up direction. The right wheel moves the camera forward/backward
126 // withough constrain (taking the scene size into account).
127 virtual void bottomWheelMotion( float newVal );
128 virtual void leftWheelMotion( float newVal );
129 virtual void rightWheelMotion( float newVal );
130 virtual void mouseWheelMotion( float newVal );
131
132 // This is called during a paste.
133 // We redefine this to keep the right vector of the camera
134 // in a parallel plane.
135 virtual void changeCameraValues( SoCamera* newCamera );
136
137 // this routine is called by subclasses to find and set the new
138 // up direction given the current mouse position. If something is
139 // picked, the normal to the object picked will be used to specify
140 // the new up direction.
141 void findUpDirection( const SbVec2s& mouseLocation );
142
143 // this routine checks the camera orientation and makes sure that the
144 // current right vector and the ideal right vector (cross between the
145 // view vector and world up direction) are the same (i.e. no unwanted
146 // roll), else it fixes it. This keeps the up direction valid.
147 void checkForCameraUpConstrain();
148
149 // Redefine this to keep the up vector when seeking
150 virtual void computeSeekFinalOrientation();
151
152 private:
153
154 void constructorCommon( SbBool buildNow );
155 SoGuiConstrainedViewer* m_guiConstViewer; // Implementation class of SoXxConstrainedViewer
156};
157
158#endif /* _SO_QT_CONSTRAINED_VIEWER_ */
159
2D vector class.
Definition SbVec.h:700
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...
virtual void setCamera(SoCamera *newCam)
Sets the edited camera.
void setUpDirection(const SbVec3f &newUpDirection)
Specifies the upward direction of the viewer.
virtual void resetToHomePosition()
Restores the camera values.
SbVec3f getUpDirection()
Returns the upward direction of the viewer.
virtual void recomputeSceneSize()
This can be used to let the viewer know that the scene graph has changed so that the viewer can recom...
virtual void saveHomePosition()
Saves the camera values.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Base viewer clas...
BuildFlag
Build flags.
Type
Editor types.
Definition SoQtViewer.h:186
int SbBool
Boolean type.
Definition SbBase.h:87