MeVisLab Resolution Independence API
SoFullViewer.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef SO_FULL_VIEWER_H
14#define SO_FULL_VIEWER_H
15
16
20
21#include "SoViewers.h"
22#include "SoRenderArea.h"
24
25//=============================================================
31
32//=============================================================
34
35 SO_NODE_HEADER(SoFullViewer);
36
37public:
39 typedef enum {
45 CAMERA_USER_SETTING
46 } CameraOrientation;
47
49 typedef enum {
51 CAMERA_ORTHOGRAPHIC
52 } CameraType;
53
55 typedef enum {
59 TO_SCENE_OR_VIEWER
60 } EventDestinationType;
61
63
64 SoSFEnum drawStyle;
66 SoSFBool headlight;
67 SoSFBool decoration;
69 SoSFBool viewing;
70 SoSFBool cursor;
71 SoSFBool autoClipping;
72
74 SoSFBool stereoViewing;
75 SoSFFloat stereoOffset;
76
78
80
84
85 SoSFTrigger viewAll;
86 SoSFBool viewAllFlag;
87 SoSFTrigger saveHomePosition;
89
91
93
94 SoSFTrigger rescanScene;
95
98 SoSFBool saveCamera;
100
102 SoSFBool perspective;
103
105 SoSFFloat height;
106 SoSFEnum cameraType;
107 SoSFVec3f position;
108 SoSFRotation orientation;
109 SoSFFloat nearDistance;
110 SoSFFloat farDistance;
111 SoSFFloat focalDistance;
112
115
117
119
120
125 SoSFEnum keyEvents;
127
129 static void initClass();
130
133 void* createViewer(void* hwnd, SoNode* scene) override;
134
136 void setupViewer() override;
137
139 void deleteViewer(void* viewer) override;
140
142 void stopTimer();
143
144 static void timerSensorCB(void *data, SoSensor *sensor);
145 virtual void timerChanged();
146
148 virtual void storeViewerState();
149
151 SbBool shouldChangeCursor() override;
152
154 SbBool handleEvent(QEvent* anyevent) override;
155
160
162 static void cameraFieldsChangedCB(void* data, SoSensor* s);
163
165 void cameraFieldsChanged(SoFieldSensor* s);
166
168 void enableKeyCommandsChanged(SoField*) override;
169
170 // reimp
171 void getSyncFieldNames(SbStringList& list) override;
172
173 protected:
174 ~SoFullViewer() override;
175
177 virtual void viewAllChanged(SoField*);
179 void rescanSceneChanged(SoField*);
181 void cursorChanged(SoField*);
182 void headlightChanged(SoField*);
183 void viewingChanged(SoField*);
184 void stereoViewingChanged(SoField*);
185 void stereoOffsetChanged(SoField*);
188 void drawStyleChanged(SoField*);
190 void autoClippingChanged(SoField*);
191 void decorationChanged(SoField*);
192 void cameraTypeChanged(SoField*);
195 void saveCameraChanged(SoField*);
196
198 void setCameraOrientation(int mode);
199
202 SoTimerSensor* _timer;
203
205 SoRef<SoCamera> _camera;
208
210 SoNode* _scene;
211
213 SoFieldSensor* _camOrientationSensor;
215 SoFieldSensor* _camPositionSensor;
216 SoFieldSensor* _viewerPositionSensor;
217
218 SoFieldSensor* _camNearSensor;
219 SoFieldSensor* _camFarSensor;
220 SoFieldSensor* _camFocalSensor;
221 SoFieldSensor* _camHeightSensor;
222 SoFieldSensor* _viewerNearSensor;
223 SoFieldSensor* _viewerFarSensor;
224 SoFieldSensor* _viewerFocalSensor;
225 SoFieldSensor* _viewerHeightSensor;
227
229 bool sendEventToScene(int mode, const SoEvent* e);
230
233};
234
235#endif
#define SO_VIEWERS_CLASS_SPEC
Definition SoViewers.h:43
SoFullViewer encapsulates SoQtFullViewer from Open Inventor in an Inventor Node.
void startTimer()
SoFieldSensor * _camFarSensor
SoSFFloat height
heightAngle/height depending on perspective/orthographic
SoFieldSensor * _camPositionSensor
void drawStyleChanged(SoField *)
void stereoOffsetChanged(SoField *)
void setCameraOrientation(int mode)
set the camera orientation depend on mode
SoSFEnum keyEvents
SoSFBool viewAllFlag
SoSFEnum drawStyle
Settings fields.
void setupViewer() override
sets all values from fields
SoSFEnum cameraType
SoSFTrigger resetToHomePosition
void cameraTypeChanged(SoField *)
SoSFTrigger rescanScene
General camera fields.
void viewingChanged(SoField *)
SoSFBool headlight
SoSFBool autoApplyUserSettingOrientation
void headlightChanged(SoField *)
void updateCamera()
update camera from viewer
virtual void viewAllChanged(SoField *)
field change callbacks:
void applyCameraOrientationChanged(SoField *)
void resetToHomePositionChanged(SoField *)
SoSFBool decoration
SoFieldSensor * _camHeightSensor
SoSFRotation orientation
SoSFBool autoClipping
SoFieldSensor * _viewerFarSensor
void interactiveDrawStyleChanged(SoField *)
SoSFFloat focalDistance
SoSFFloat stereoOffset
SoRef< SoCamera > _camera
current camera
SoSFVec3f position
void saveCameraChanged(SoField *)
~SoFullViewer() override
void cameraFieldsChanged(SoFieldSensor *s)
triggered by above callback
SoNode * _scene
pointer to the scene that is rendered
void getSyncFieldNames(SbStringList &list) override
collect the fields that should be synced on cloned viewers if you derive this method,...
SoSFRotation userSettingOrientation
SoSFTrigger viewAll
SoSFBool isCameraStored
SbTime _lastEventTime
void deleteViewer(void *viewer) override
delete the viewer in the given window
SoFieldSensor * _viewerNearSensor
void saveHomePositionChanged(SoField *)
static void cameraFieldsChangedCB(void *data, SoSensor *s)
static callback used by various fields
SoSFBool saveCamera
static void initClass()
void decorationChanged(SoField *)
void userSettingOrientationChanged(SoField *)
void popupMenuEnabledChanged(SoField *)
SoSFFloat nearDistance
virtual void timerChanged()
SoSFBool storeCurrentState
SoSFEnum applyCameraOrientation
SoSFEnum interactiveDrawStyle
SoSFBool viewing
void enableKeyCommandsChanged(SoField *) override
overridden to disable cursor keys
SoFieldSensor * _camNearSensor
SoSFBool forceRedrawOnInteraction
void cursorChanged(SoField *)
SoSFBool popupMenuEnabled
void stereoViewingChanged(SoField *)
SoSFBool automaticViewAll
void autoClippingChanged(SoField *)
bool sendEventToScene(int mode, const SoEvent *e)
returns if the event should still be send to viewer, given the mode
SoTimerSensor * _timer
timer that is used to notice API changes in the viewer and apply these changes to this node
bool _restoreCameraNextTime
internal flag if camera needs to be restored
SoSFBool stereoViewing
stereo viewing settings
SoSFFloat farDistance
SoSFEnum button2events
SoSFEnum initialCameraOrientation
Viewing.
SoSFTrigger saveHomePosition
SoFieldSensor * _viewerPositionSensor
void setStoredCamera()
set stored camera type and value to viewer
SoSFTrigger storeAsUserSetting
SoFieldSensor * _viewerHeightSensor
SbBool handleEvent(QEvent *anyevent) override
handle event before viewer, returns true if event was handled
void rescanSceneChanged(SoField *)
void * createViewer(void *hwnd, SoNode *scene) override
create a viewer in the given window void pointer is used to be compatible to any windows system
SoFieldSensor * _camOrientationSensor
Sensors.
void stopTimer()
virtual void storeViewerState()
called automatically by timer sensor if storeCurrentState is on
static void timerSensorCB(void *data, SoSensor *sensor)
SbBool shouldChangeCursor() override
tells the renderarea about our state
SoSFEnum button3events
SoSFEnum button1events
Event target in "viewing" mode.
SoFieldSensor * _viewerOrientationSensor
void storeAsUserSettingChanged(SoField *)
SoSFBool cursor
SoFieldSensor * _camFocalSensor
SoSFBool perspective
is perspective camera?
SoFieldSensor * _viewerFocalSensor
SoRenderArea encapsulates the features of SoQtRenderArea in an Inventor Node.