CustusX  15.8
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxCameraStyleForView.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 #ifndef CXCameraStyleForViewFORVIEW_H
33 #define CXCameraStyleForViewFORVIEW_H
34 
35 #include "org_custusx_core_view_Export.h"
36 
37 #include "cxTransform3D.h"
38 #include "cxForwardDeclarations.h"
39 #include "cxEnumConverter.h"
40 class QIcon;
41 class QWidget;
42 class QMenu;
43 class QActionGroup;
44 
45 namespace cx
46 {
47 typedef boost::shared_ptr<class ViewportPreRenderListener> ViewportPreRenderListenerPtr;
48 typedef boost::shared_ptr<class CoreServices> CoreServicesPtr;
49 
50 typedef boost::shared_ptr<class CameraStyleForView> CameraStyleForViewPtr;
51 using cx::Transform3D;
52 
60 enum org_custusx_core_view_EXPORT CAMERA_STYLE_TYPE
61 {
63 };
64 
65 
77 class org_custusx_core_view_EXPORT CameraStyleForView: public QObject
78 {
79 Q_OBJECT
80 public:
81  explicit CameraStyleForView(CoreServicesPtr backend);
82  void setView(ViewPtr widget);
83 
86  void setCameraStyle(CAMERA_STYLE_TYPE style);
87 
88 private slots:
89  void setModified();
90  void activeToolChangedSlot();
91 
92 private:
93  ViewPtr getView() const;
94  vtkRendererPtr getRenderer() const;
95  vtkCameraPtr getCamera() const;
96  ToolRep3DPtr getToolRep() const;
97  bool isToolFollowingStyle(CAMERA_STYLE_TYPE style) const;
98  void onPreRender();
99  void moveCameraToolStyleSlot(Transform3D prMt, double timestamp);
100 
101  void connectTool();
102  void disconnectTool();
103  void viewportChangedSlot();
104  void updateCamera();
105 
106  CAMERA_STYLE_TYPE mCameraStyleForView;
107  ToolPtr mFollowingTool;
108  ViewportListenerPtr mViewportListener;
109  ViewportPreRenderListenerPtr mPreRenderListener;
110  bool mBlockCameraUpdate;
111 
112  ViewPtr mView;
113  CoreServicesPtr mBackend;
114 };
115 
119 } //namespace cx
120 
121 SNW_DECLARE_ENUM_STRING_CONVERTERS(cx, CAMERA_STYLE_TYPE);
122 
123 #endif // CXCameraStyleForViewFORVIEW_H
boost::shared_ptr< class ViewportListener > ViewportListenerPtr
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< class ViewportPreRenderListener > ViewportPreRenderListenerPtr
boost::shared_ptr< class View > ViewPtr
cstUNICAM_STYLE
vtkSmartPointer< class vtkRenderer > vtkRendererPtr
boost::shared_ptr< class CameraStyleForView > CameraStyleForViewPtr
cstDEFAULT_STYLE
boost::shared_ptr< class CoreServices > CoreServicesPtr
Definition: cxCameraStyle.h:59
cstANGLED_TOOL_STYLE
boost::shared_ptr< class ToolRep3D > ToolRep3DPtr
SNW_DECLARE_ENUM_STRING_CONVERTERS(cx, CAMERA_STYLE_TYPE)
vtkSmartPointer< class vtkCamera > vtkCameraPtr
boost::shared_ptr< class Tool > ToolPtr