Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoXtFlyViewer.h
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : Alain Dumesny (MMM yyyy)
25**=======================================================================*/
26/*=======================================================================
27 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
28 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
29 *** ***
30 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
31 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
32 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
33 *** ***
34 *** RESTRICTED RIGHTS LEGEND ***
35 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
36 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
37 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
38 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
39 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
40 *** ***
41 *** COPYRIGHT (C) 1996-2023 BY FEI S.A.S, ***
42 *** BORDEAUX, FRANCE ***
43 *** ALL RIGHTS RESERVED ***
44**=======================================================================*/
45/*=======================================================================
46** Modified by : VSG (MMM YYYY)
47**=======================================================================*/
48
49
50#ifdef SOQT
51# include <Inventor/Qt/viewers/SoQtFlyViewer.h>
52#elif defined _WIN32
53# include <Inventor/Win/viewers/SoWinFlyViewer.h>
54#else // _WIN32
55
56#ifndef _SO_XT_FLY_VIEWER_
57#define _SO_XT_FLY_VIEWER_
58
59#include <Inventor/Xt/viewers/SoXtConstrainedViewer.h>
60#include <Inventor/SbLinear.h>
61#include <Inventor/SbTime.h>
62#include <Inventor/Gui/viewers/SoGuiFlyViewer.h>
63
64class SoFieldSensor;
65
67//
68// Class: SoXtFlyViewer
69//
70//
71// Keys used by this viewer:
72// -------------------------
73//
74// Left Mouse: Click to increase speed.
75//
76// <s> + Left Mouse: Alternative to the Seek button. Press (but do not
77// hold down) the <s> key, then click on a target object.
78//
79// <U> + Left Mouse: Press (but do not hold down) the <U> key, then
80// click on a target object to set the "up" direction to the surface normal.
81// By default +y is the "up" direction.
82//
83// Middle Mouse: Click to decrease speed.
84//
85// Left and Middle Mouse: Click boths simultaneously to stop.
86//
87// Ctrl: Hold the key down to temporary stop and rotate the viewpoint.
88//
89// Right Mouse: Open the popup menu.
90//
92
169{
170 public:
171
176 SoXtFlyViewer( SoWidget parent = NULL,
177 const char* name = NULL,
178 SbBool buildInsideParent = TRUE,
179 SoXtFullViewer::BuildFlag flag = SoXtFullViewer::BUILD_ALL,
180 SoXtViewer::Type type = SoXtViewer::BROWSER );
181
186
187 // redefine these to add fly viewer functionality
188 virtual void setViewing( SbBool onOrOff );
189 virtual void resetToHomePosition();
190 virtual void setCamera( SoCamera* cam );
191 virtual void setCursorEnabled( SbBool onOrOff );
192 virtual void setSeekMode( SbBool onOrOff );
193
194 // This is redefined to prevent the camera type from being changed
195 virtual void setCameraType( SoType type );
196
197 // set/get minimum speed in word coodinate / second
198 // default value is 0, meaning the minimum speed is computed according to scene graph extent
199 void setMinSpeed( float speed );
200 float getMinSpeed();
201
202 // set/get speed multiplier. default value is 1.5
203 void setSpeedMultiplier( float speedInc );
205
206 private:
207
208 SoGuiFlyViewer* getGuiFlyViewer() const;
209
210 // This constructor takes a boolean whether to build the widget now.
211 // Subclasses can pass FALSE, then call SoXtFlyViewer::buildWidget()
212 // when they are ready for it to be built.
213 private:
214 SoXtFlyViewer( SoWidget parent,
215 const char* name,
216 SbBool buildInsideParent,
217 SoXtFullViewer::BuildFlag flag,
218 SoXtViewer::Type type,
219 SbBool buildNow,
220 SbBool sync = TRUE );
221
222 private:
223 // redefine these
224 virtual SbString getDefaultWidgetName() const;
225 virtual SbString getDefaultTitle() const;
226 virtual SbString getDefaultIconTitle() const;
227
228 // redefine those routines to do viewer specific stuff
229 virtual void processEvent( XAnyEvent* anyevent );
230 virtual void actualRedraw();
231 virtual void rightWheelMotion( float newVal );
232
233 // add viewer preference stuff
234 virtual void createPrefSheet();
235
236 // Define this to bring the viewer help card
237 virtual void openViewerHelpCard();
238
239 private:
240 // viewer state variables
241 Cursor viewerCursor, seekCursor, upCursor;
242 SbRotation camStartOrientation;
243
244 // preference sheet stuff
245 SoWidget createFlyPrefSheetGuts( SoWidget parent );
246 static void incPrefSheetButtonCB( SoWidget w, SoXtFlyViewer* v, void* data);
247 static void decPrefSheetButtonCB( SoWidget w, SoXtFlyViewer* v, void* data );
248
249 void defineCursors();
250 void switchMode( int newMode );
251 void changeMaxStraightSpeed( SbBool increase );
252
253 // this is called by both constructors
254 void constructorCommon( SbBool buildNow );
255
256 SoGuiFlyViewer* m_guiFlyViewer;
257};
258
259#endif /* _SO_XT_FLY_VIEWER_ */
260
261#endif // _WIN32
262
263
Class for representing a rotation.
Definition SbRotation.h:126
Class for smart character strings.
Definition SbString.h:202
Abstract base class for camera nodes.
Definition SoCamera.h:188
Sensor class that can be attached to Open Inventor fields.
Stores runtime type information.
Definition SoType.h:98
Base viewer class which adds camera constraints given a world up direction.
Viewer component for flying through space, with a constant world up.
SoXtFlyViewer(SoWidget parent=NULL, const char *name=NULL, SbBool buildInsideParent=TRUE, SoXtFullViewer::BuildFlag flag=SoXtFullViewer::BUILD_ALL, SoXtViewer::Type type=SoXtViewer::BROWSER)
Constructor which specifies the viewer type.
virtual void setViewing(SbBool onOrOff)
Sets whether the viewer is turned on or off.
virtual void resetToHomePosition()
Restores the camera values.
virtual void setCameraType(SoType type)
Sets the camera type that will be created by the viewer if no cameras are found in the scene graph (s...
float getMinSpeed()
void setSpeedMultiplier(float speedInc)
virtual void setCursorEnabled(SbBool onOrOff)
Sets whether the viewer is allowed to change the cursor over the renderArea window.
virtual void setSeekMode(SbBool onOrOff)
Externally set the viewer into/out off seek mode (default OFF).
virtual void setCamera(SoCamera *cam)
Sets the edited camera.
float getSpeedMultiplier()
void setMinSpeed(float speed)
~SoXtFlyViewer()
Destructor.
int SbBool
Boolean type.
Definition SbBase.h:87