NorMIT-nav  18.04
An IGT application
cxViewportListener.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 #ifndef CXVIEWPORTLISTENER_H_
12 #define CXVIEWPORTLISTENER_H_
13 
14 #include "cxResourceExport.h"
15 
16 #include <boost/function.hpp>
17 #include "vtkForwardDeclarations.h"
18 #include "cxVector3D.h"
19 
20 namespace cx
21 {
22 
23 
31 class cxResource_EXPORT ViewportListenerBase
32 {
33 public:
35  virtual ~ViewportListenerBase();
36 
37  void startListen(vtkRendererPtr renderer);
38  void stopListen();
39  bool isListening() const;
40 
41  void setCallback(boost::function<void ()> func);
42 
43  virtual void callback();
44  double getVpnZoom();
45  double getVpnZoom(Vector3D focalPoint);
46 protected:
47  virtual void addObservers() = 0;
48  virtual void removeObservers() = 0;
49 
50  typedef vtkSmartPointer<class ViewportObserverPrivate> ViewportObserverPrivatePtr;
51  ViewportObserverPrivatePtr mObserver;
53 private:
54  boost::function<void ()> mCallback;
55 };
56 
67 class cxResource_EXPORT ViewportListener : public ViewportListenerBase
68 {
69 public:
71  virtual ~ViewportListener();
72  void setModified();
73 
74 protected:
75  virtual void addObservers();
76  virtual void removeObservers();
77 };
78 
79 typedef boost::shared_ptr<class ViewportListener> ViewportListenerPtr;
80 
91 class cxResource_EXPORT ViewportPreRenderListener : public ViewportListenerBase
92 {
93 public:
95  virtual ~ViewportPreRenderListener();
96  virtual void callback();
97  void setModified();
98 
99 protected:
100  virtual void addObservers();
101  virtual void removeObservers();
102 private:
103  bool mModified;
104 };
105 
106 typedef boost::shared_ptr<class ViewportPreRenderListener> ViewportPreRenderListenerPtr;
107 
108 }
109 
110 #endif /* CXVIEWPORTLISTENER_H_ */
boost::shared_ptr< class ViewportListener > ViewportListenerPtr
ViewportObserverPrivatePtr mObserver
boost::shared_ptr< class ViewportPreRenderListener > ViewportPreRenderListenerPtr
Listens to changes in viewport and camera matrix.
vtkSmartPointer< class vtkRenderer > vtkRendererPtr
Base class for listening to a vtkRenderer.
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
Listens to the start render event in a vtkRenderer.
vtkSmartPointer< class ViewportObserverPrivate > ViewportObserverPrivatePtr
Namespace for all CustusX production code.