MeVisLab Toolbox Reference
SoRotateCamera.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2013, 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_ROTATE_CAMERA_H
14 #define SO_ROTATE_CAMERA_H
15 
16 
18 // Allows to rotate the camera around the focal point
19 
20 #include "SoUtilsSystem.h"
21 
22 #include <Inventor/nodes/SoSubNode.h>
23 #include <Inventor/nodes/SoNode.h>
24 #include <Inventor/nodes/SoSeparator.h>
25 
26 #include <Inventor/fields/SoSFNode.h>
27 #include <Inventor/fields/SoSFInt32.h>
28 #include <Inventor/fields/SoSFTrigger.h>
29 #include <Inventor/fields/SoSFVec3f.h>
30 #include <Inventor/fields/SoSFFloat.h>
31 #include <Inventor/fields/SoSFTrigger.h>
32 #include <Inventor/fields/SoSFBool.h>
33 
34 #include <Inventor/sensors/SoFieldSensor.h>
35 #include <Inventor/sensors/SoNodeSensor.h>
36 #include <Inventor/sensors/SoTimerSensor.h>
37 
38 class SoCamera;
39 class SoGetBoundingBoxAction;
40 
41 
43 class SOUTILS_EXPORT SoRotateCamera : public SoNode
44 {
45  SO_NODE_HEADER(SoRotateCamera);
46 
47 public:
49  static void initClass();
50 
52 
53  SoSFNode inCamera;
54  SoSFNode inScene;
55 
56  SoSFVec3f rotationAxis;
57  SoSFFloat rotationAngle;
58  SoSFInt32 rotationSteps;
60 
62 
63  SoSFTrigger rotate;
64  SoSFBool autoRotate;
65 
67 
68 
69 
70 protected:
72  ~SoRotateCamera() override;
73 
74 
75 private:
76 
77  SoGetBoundingBoxAction* _autoClipBoxAction;
78  SoNode* _inSceneNode;
79 
80  SoRef<SoSeparator> _root;
81 
82  bool _isAutoRotating;
83 
84  void rotateChanged(SoField*);
85  void inSceneChanged(SoField*);
86 
87  SoTimerSensor* _rotSensor;
88  void rotationChanged(SoSensor* sensor);
89  static void rotationChangedCB(void *data, SoSensor *sensor);
90 
91  void reorientCamera(const SbRotation& rot);
92  void autoAdjustCameraClippingPlanes(SoCamera* camera);
93 };
94 
95 #endif // __SoRotateCamera_H
#define SOUTILS_EXPORT
System dependent includes. Disables some compiler/linker warnings.
Definition: SoUtilsSystem.h:31
Allows to rotate the camera around the focal point.
SoSFFloat rotationAngle
~SoRotateCamera() override
Protected destructor.
static void initClass()
SoSFBool autoRotate
SoSFNode inCamera
! Fields
SoSFInt32 rotationCurrentStep
SoSFBool autoAdjustClippingPlanes
SoSFTrigger rotate
SoSFNode inScene
SoSFInt32 rotationSteps
SoSFVec3f rotationAxis