NorMIT-nav  2023.01.05-dev+develop.0da12
An IGT application
cxCameraControl.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 /*
13  * cxCameraControl.h
14  *
15  * \date Oct 15, 2010
16  * \author christiana
17  */
18 
19 #ifndef CXCAMERACONTROL_H_
20 #define CXCAMERACONTROL_H_
21 
22 #include "cxResourceVisualizationExport.h"
23 
24 #include <vector>
25 #include "cxVector3D.h"
26 //#include "cxDoubleWidgets.h"
27 #include "cxForwardDeclarations.h"
28 #include "vtkForwardDeclarations.h"
29 #include "cxForwardDeclarations.h"
30 
31 class QActionGroup;
32 class QAction;
33 class QDomNode;
34 
35 namespace cx
36 {
43 typedef boost::shared_ptr<class CameraData> CameraDataPtr;
44 
47 class cxResourceVisualization_EXPORT CameraData
48 {
49 public:
50  CameraData();
52  {
53  return CameraDataPtr(new CameraData());
54  }
55  void setCamera(vtkCameraPtr camera);
56  vtkCameraPtr getCamera() const;
57 
58  void addXml(QDomNode dataNode) const;
59  void parseXml(QDomNode dataNode);
60 
61 private:
62  mutable vtkCameraPtr mCamera;
63  void addTextElement(QDomNode parentNode, QString name, QString value) const;
64 };
65 
69 class cxResourceVisualization_EXPORT CameraControl: public QObject
70 {
71 Q_OBJECT
72 
73 public:
74  CameraControl(QObject* parent = NULL);
75  virtual ~CameraControl();
76 
77  static Vector3D AnteriorDirection();
78  static Vector3D PosteriorDirection();
79  static Vector3D SuperiorDirection();
80  static Vector3D InferiorDirection();
81  static Vector3D LeftDirection();
82  static Vector3D RightDirection();
83  static Vector3D OrthogonalDirection();
84 
85  void refreshView(ViewPtr view);
86  void setView(ViewPtr view);
87  ViewPtr getView() const;
88  QActionGroup* createStandard3DViewActions();
89  void translateByFocusTo(Vector3D p_r);
90  void setSuperiorView() const;
91  void setAnteriorView() const;
92 
93  void setStandard3DView(Vector3D viewDirection);
94 
95 signals:
96 
97 protected slots:
98  void setStandard3DViewActionSlot();
99 
100 private:
101  vtkRendererPtr getRenderer() const;
102  vtkCameraPtr getCamera() const;
103  void defineRotateLayout();
104  void definePanLayout();
105  ViewPtr mView;
106  QAction* mSuperiorViewAction;
107  QAction* mAnteriorViewAction;
108 
109  QAction* addStandard3DViewAction(QString caption, QString help, Vector3D viewDirection, QActionGroup* group);
110 };
111 
115 }//end namespace cx
116 
117 #endif /* CXCAMERACONTROL_H_ */
cx::CameraDataPtr
boost::shared_ptr< class CameraData > CameraDataPtr
Definition: cxViewWrapper.h:36
cx::CameraData::create
static CameraDataPtr create()
Definition: cxCameraControl.h:51
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxForwardDeclarations.h
cx::CameraControl
Definition: cxCameraControl.h:69
cxVector3D.h
vtkForwardDeclarations.h
vtkCameraPtr
vtkSmartPointer< class vtkCamera > vtkCameraPtr
Definition: vtkForwardDeclarations.h:39
cx::ViewPtr
boost::shared_ptr< class View > ViewPtr
Definition: cxForwardDeclarations.h:110
cx::CameraData
Definition: cxCameraControl.h:47
cx::Vector3D
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
vtkRendererPtr
vtkSmartPointer< class vtkRenderer > vtkRendererPtr
Definition: vtkForwardDeclarations.h:122