Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoWinPlaneViewer.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 : VSG (MMM YYYY)
22**=======================================================================*/
23
24
25
26#ifndef _SO_WIN_PLANE_VIEWER_
27#define _SO_WIN_PLANE_VIEWER_
28
29#include <Inventor/Win/SoWinBeginStrict.h>
30
31#include <Inventor/Win/viewers/SoWinFullViewer.h>
32#include <Inventor/SbLinear.h>
33
34#include <Inventor/Gui/viewers/SoGuiPlaneViewer.h>
35
36class SoWinBitmapButton;
37
39//
40// Class: SoWinPlaneViewer
41//
42// Plane Viewer - allows the user to move left, right, up, and down a
43// given plane, as well as roll the viewer and zoom in and out.
44//
45//
46// Keys used by this viewer:
47// -------------------------
48//
49// Left Mouse: Dolly in and out (gets closer to and further away from the
50// object).
51//
52// Middle Mouse:
53// Ctrl + Left Mouse: Translate up, down, left and right.
54//
55// Ctrl + Middle Mouse: Used for roll action (rotates around the viewer
56// forward direction).
57//
58// Shift + Ctrl + Left Mouse: Roll (same as Ctrl + Middle Mouse behavior
59// but added by VSG to support the standard
60// Microsoft 2-button mouse).
61//
62// <s> + click: Alternative to the Seek button. Press (but do not hold down)
63// the <s> key, then click on a target object.
64//
65// Right Mouse: Open the popup menu.
66//
68
130{
131
132 public:
141 SoWinPlaneViewer( SoWidget 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 // This constructor takes a boolean whether to build the widget now.
165 // Subclasses can pass FALSE, then call SoWinPlaneViewer::buildWidget()
166 // when they are ready for it to be built.
167 private:
168
169 SoGuiPlaneViewer* getGuiPlaneViewer() const;
170
171 SoWinPlaneViewer( SoWidget parent,
172 const char* name,
173 SbBool buildInsideParent,
175 SoWinViewer::Type type,
176 SbBool buildNow,
177 SbBool sync = TRUE );
178
179 private:
180 SoWidget buildWidget( SoWidget parent );
181
182 // redefine these
183 virtual SbString getDefaultWidgetName() const;
184 virtual SbString getDefaultTitle() const;
185 virtual SbString getDefaultIconTitle() const;
186
187 // redefine those routines to do viewer specific stuff
188 virtual void processEvent( XAnyEvent* anyevent );
189 virtual void actualRedraw();
190
191 // Define those thumb wheels to translate in the viewer plane
192 virtual void bottomWheelMotion( float newVal );
193 virtual void leftWheelMotion( float newVal );
194 virtual void rightWheelMotion( float newVal );
195 virtual void mouseWheelMotion( float newVal );
196
197 // add viewer preference stuff
198 virtual void createPrefSheet();
199
200 // add some viewer buttons
201 virtual void createViewerButtons( SoWidget parent );
202
203 // Define this to bring the viewer help card
204 virtual void openViewerHelpCard();
205
206 // Redefine this to keep the same camera rotation when seeking
207 virtual void computeSeekFinalOrientation();
208
209 // It's a long story, but since we can't attach callbacks to a window
210 // quite like we can to an Xt widget, it makes more sense for the
211 // subclass viewer to handle the buttons it knows about then pass
212 // the rest back up to SoWinFullViewer.
213 //
214 // So WINxx this function must be virtual and protected, not private.
215 virtual void pushButtonCB( SoWidget w, int id, void* data );
216
217 virtual void updateCursor();
218
219 private:
220
221 SoGuiPlaneViewer* m_guiPlaneViewer; // Implementation class for SoXxPlaneViewer
222
223 // push button vars and callbacks
224 SoWinBitmapButton* buttonList[10];
225
226 void updateViewerMode( unsigned int state );
227 void switchMode( int newMode );
228
229 // this is called by both constructors
230 void constructorCommon( SbBool buildNow );
231
232 // Utility function called from processEvent
233 void processPopupItem( int item );
234};
235
236#include <Inventor/Win/SoWinEndStrict.h>
237
238#endif /* _SO_WIN_PLANE_VIEWER_ */
239
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
This specifies what should be build by default in the constructor.
@ BUILD_ALL
Build everything by default.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Viewer component...
SoWinPlaneViewer(SoWidget parent=NULL, const char *name=NULL, SbBool buildInsideParent=TRUE, SoWinFullViewer::BuildFlag flag=SoWinFullViewer::BUILD_ALL, SoWinViewer::Type type=SoWinViewer::BROWSER)
Constructor which specifies the viewer type.
void setPlane(const SbVec3f &newNormal, const SbVec3f &newRight)
Moves the camera to be aligned with the given plane.
virtual void setViewing(SbBool onOrOff)
Sets whether the viewer is turned on or off.
virtual void setSeekMode(SbBool onOrOff)
Externally set the viewer into/out off seek mode (default OFF).
virtual void setCursorEnabled(SbBool onOrOff)
Sets whether the viewer is allowed to change the cursor over the renderArea window.
~SoWinPlaneViewer()
Destructor.
virtual void setCamera(SoCamera *cam)
Sets the camera that will be controlled by the viewer.
Type
An EDITOR viewer will create a camera under the user supplied scene graph (specified in setSceneGraph...
@ BROWSER
Camera views scene, but is not added to scene.
int SbBool
Boolean type.
Definition SbBase.h:87