Fraxinus  16.5.0-fx-rc9
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 #include "cxViewService.h"
41 class QIcon;
42 class QWidget;
43 class QMenu;
44 class QActionGroup;
45 
46 namespace cx
47 {
48 typedef boost::shared_ptr<class ViewportPreRenderListener> ViewportPreRenderListenerPtr;
49 typedef boost::shared_ptr<class CoreServices> CoreServicesPtr;
50 
51 typedef boost::shared_ptr<class CameraStyleForView> CameraStyleForViewPtr;
52 using cx::Transform3D;
53 
72 class org_custusx_core_view_EXPORT CameraStyleForView: public QObject
73 {
74 Q_OBJECT
75 public:
76  explicit CameraStyleForView(CoreServicesPtr backend);
77  void setView(ViewPtr widget);
78 
81  void setCameraStyle(CAMERA_STYLE_TYPE style);
82  CAMERA_STYLE_TYPE getCameraStyle();
83 
84 private slots:
85  void setModified();
86  void activeToolChangedSlot();
87 
88 private:
89  ViewPtr getView() const;
90  vtkRendererPtr getRenderer() const;
91  vtkCameraPtr getCamera() const;
92  ToolRep3DPtr getToolRep() const;
93  bool isToolFollowingStyle(CAMERA_STYLE_TYPE style) const;
94  void onPreRender();
95  void moveCameraToolStyleSlot(Transform3D prMt, double timestamp);
96 
97  void connectTool();
98  void disconnectTool();
99  void viewportChangedSlot();
100  void updateCamera();
101 
102  CAMERA_STYLE_TYPE mCameraStyleForView;
103  ToolPtr mFollowingTool;
104  ViewportListenerPtr mViewportListener;
105  ViewportPreRenderListenerPtr mPreRenderListener;
106  bool mBlockCameraUpdate;
107 
108  ViewPtr mView;
109  CoreServicesPtr mBackend;
110 };
111 
115 } //namespace cx
116 
117 SNW_DECLARE_ENUM_STRING_CONVERTERS(cx, CAMERA_STYLE_TYPE);
118 
119 #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
vtkSmartPointer< class vtkRenderer > vtkRendererPtr
boost::shared_ptr< class CameraStyleForView > CameraStyleForViewPtr
boost::shared_ptr< class CoreServices > CoreServicesPtr
Definition: cxCameraStyle.h:59
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