Fraxinus  17.12-rc4
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) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 /*
34  * cxCameraControl.h
35  *
36  * \date Oct 15, 2010
37  * \author christiana
38  */
39 
40 #ifndef CXCAMERACONTROL_H_
41 #define CXCAMERACONTROL_H_
42 
43 #include "cxResourceVisualizationExport.h"
44 
45 #include <vector>
46 #include "cxVector3D.h"
47 //#include "cxDoubleWidgets.h"
48 #include "cxForwardDeclarations.h"
49 #include "vtkForwardDeclarations.h"
50 #include "cxForwardDeclarations.h"
51 
52 class QActionGroup;
53 class QAction;
54 class QDomNode;
55 
56 namespace cx
57 {
64 typedef boost::shared_ptr<class CameraData> CameraDataPtr;
65 
68 class cxResourceVisualization_EXPORT CameraData
69 {
70 public:
71  CameraData();
72  static CameraDataPtr create()
73  {
74  return CameraDataPtr(new CameraData());
75  }
76  void setCamera(vtkCameraPtr camera);
77  vtkCameraPtr getCamera() const;
78 
79  void addXml(QDomNode dataNode) const;
80  void parseXml(QDomNode dataNode);
81 
82 private:
83  mutable vtkCameraPtr mCamera;
84  void addTextElement(QDomNode parentNode, QString name, QString value) const;
85 };
86 
90 class cxResourceVisualization_EXPORT CameraControl: public QObject
91 {
92 Q_OBJECT
93 
94 public:
95  CameraControl(QObject* parent = NULL);
96  virtual ~CameraControl();
97 
98  void refreshView(ViewPtr view);
99  void setView(ViewPtr view);
100  ViewPtr getView() const;
101  QActionGroup* createStandard3DViewActions();
102  void translateByFocusTo(Vector3D p_r);
103  void setSuperiorView() const;
104  void setAnteriorView() const;
105 
106 signals:
107 
108 protected slots:
109  void setStandard3DViewActionSlot();
110 
111 private:
112  vtkRendererPtr getRenderer() const;
113  vtkCameraPtr getCamera() const;
114  void defineRotateLayout();
115  void definePanLayout();
116  ViewPtr mView;
117  QAction* mSuperiorViewAction;
118  QAction* mAnteriorViewAction;
119 
120  QAction* addStandard3DViewAction(QString caption, QString help, Vector3D viewDirection, QActionGroup* group);
121 };
122 
126 }//end namespace cx
127 
128 #endif /* CXCAMERACONTROL_H_ */
boost::shared_ptr< class CameraData > CameraDataPtr
Definition: cxViewWrapper.h:57
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:63
vtkSmartPointer< class vtkCamera > vtkCameraPtr
Namespace for all CustusX production code.