Fraxinus  18.10
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();
51  static CameraDataPtr create()
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  void refreshView(ViewPtr view);
78  void setView(ViewPtr view);
79  ViewPtr getView() const;
80  QActionGroup* createStandard3DViewActions();
81  void translateByFocusTo(Vector3D p_r);
82  void setSuperiorView() const;
83  void setAnteriorView() const;
84 
85 signals:
86 
87 protected slots:
88  void setStandard3DViewActionSlot();
89 
90 private:
91  vtkRendererPtr getRenderer() const;
92  vtkCameraPtr getCamera() const;
93  void defineRotateLayout();
94  void definePanLayout();
95  ViewPtr mView;
96  QAction* mSuperiorViewAction;
97  QAction* mAnteriorViewAction;
98 
99  QAction* addStandard3DViewAction(QString caption, QString help, Vector3D viewDirection, QActionGroup* group);
100 };
101 
105 }//end namespace cx
106 
107 #endif /* CXCAMERACONTROL_H_ */
boost::shared_ptr< class CameraData > CameraDataPtr
Definition: cxViewWrapper.h:36
static CameraDataPtr create()
boost::shared_ptr< class View > ViewPtr
vtkSmartPointer< class vtkRenderer > vtkRendererPtr
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
vtkSmartPointer< class vtkCamera > vtkCameraPtr
Namespace for all CustusX production code.