Fraxinus  18.10
An IGT application
cxViewWrapper.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 #ifndef CXVIEWWRAPPER_H_
13 #define CXVIEWWRAPPER_H_
14 
15 #include "org_custusx_core_view_Export.h"
16 
17 #include <vector>
18 #include <QVariant>
19 #include <QObject>
20 #include "cxDefinitions.h"
21 #include "vtkForwardDeclarations.h"
22 #include "cxForwardDeclarations.h"
23 #include "cxViewGroupData.h"
24 #include "cxSyncedValue.h"
25 #include "cxVisServices.h"
26 #include "cxPatientModelService.h"
27 #include "cxImageAlgorithms.h"
28 
29 typedef vtkSmartPointer<class vtkPolyDataAlgorithm> vtkPolyDataAlgorithmPtr;
30 class QMenu;
31 class QActionGroup;
32 
33 namespace cx
34 {
35 
36 typedef boost::shared_ptr<class CameraData> CameraDataPtr;
37 
45 typedef boost::shared_ptr<class DataViewPropertiesInteractor> DataViewPropertiesInteractorPtr;
49 class org_custusx_core_view_EXPORT DataViewPropertiesInteractor : public QObject
50 {
51  Q_OBJECT
52 public:
54  void setDataViewProperties(DataViewProperties properties);
55 
56  template <class DATA>
57  void addDataActionsOfType(QWidget* parent);
58 
59 private slots:
60  void dataActionSlot();
61 private:
62  void addDataAction(QString uid, QWidget* parent);
63  VisServicesPtr mServices;
64  ViewGroupDataPtr mGroupData;
65  DataViewProperties mProperties;
66 
67  QString mLastDataActionUid;
68 };
69 
70 template <class DATA>
72 {
73  //add actions to the actiongroups and the contextmenu
74  std::vector< boost::shared_ptr<DATA> > sorted = sortOnGroupsAndAcquisitionTime(mServices->patient()->getDataOfType<DATA>());
75  mLastDataActionUid = "________________________";
76  for (typename std::vector< boost::shared_ptr<DATA> >::iterator iter=sorted.begin(); iter!=sorted.end(); ++iter)
77  {
78  this->addDataAction((*iter)->getUid(), parent);
79  }
80 }
81 
89 class org_custusx_core_view_EXPORT ViewWrapper: public QObject
90 {
91 Q_OBJECT
92 public:
93  virtual ~ViewWrapper() {}
94  virtual void initializePlane(PLANE_TYPE plane) {}
95  virtual ViewPtr getView() = 0;
96  virtual void setSlicePlanesProxy(SlicePlanesProxyPtr proxy) = 0;
97  virtual void setViewGroup(ViewGroupDataPtr group);
98  virtual void updateView();
99  virtual void setSharedOpenGLContext(SharedOpenGLContextPtr sharedOpenGLContext);
100 
101 signals:
102  void orientationChanged(ORIENTATION_TYPE type);
103 
104 protected slots:
105  void contextMenuSlot(const QPoint& point);
106  void settingsChangedSlot(QString key);
107 
108  virtual void dataViewPropertiesChangedSlot(QString uid) = 0;
109  virtual void videoSourceChangedSlot(QString uid) {}
110 
111 protected:
112  ViewWrapper(VisServicesPtr backend);
113 
114  void connectContextMenu(ViewPtr view);
115  virtual QString getDataDescription() = 0;
116  virtual QString getViewDescription() = 0;
117  virtual void appendToContextMenu(QMenu& contextMenu) = 0;
118  QStringList getAllDataNames(DataViewProperties properties) const;
119  virtual void addReps();
120 
123  DataViewPropertiesInteractorPtr mDataViewPropertiesInteractor;
124  DataViewPropertiesInteractorPtr mShow3DSlicesInteractor;
126 
127 private:
128  DisplayTextRepPtr mPlaneTypeText;
129  DisplayTextRepPtr mDataNameText;
130 };
131 
135 } //namespace cx
136 
137 #endif /* CXVIEWWRAPPER_H_ */
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
Definition: cxViewGroup.h:29
boost::shared_ptr< class SlicePlanesProxy > SlicePlanesProxyPtr
boost::shared_ptr< class CameraData > CameraDataPtr
Definition: cxViewWrapper.h:36
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
Superclass for ViewWrappers.
Definition: cxViewWrapper.h:89
SharedOpenGLContextPtr mSharedOpenGLContext
DataViewPropertiesInteractorPtr mDataViewPropertiesInteractor
boost::shared_ptr< class View > ViewPtr
boost::shared_ptr< class DataViewPropertiesInteractor > DataViewPropertiesInteractorPtr
Definition: cxViewWrapper.h:45
virtual void videoSourceChangedSlot(QString uid)
boost::shared_ptr< class SharedOpenGLContext > SharedOpenGLContextPtr
std::vector< T > sortOnGroupsAndAcquisitionTime(std::map< QString, T > input)
ViewGroupDataPtr mGroupData
void addDataActionsOfType(QWidget *parent)
Definition: cxViewWrapper.h:71
virtual void initializePlane(PLANE_TYPE plane)
Definition: cxViewWrapper.h:94
VisServicesPtr mServices
vtkSmartPointer< class vtkPolyDataAlgorithm > vtkPolyDataAlgorithmPtr
Definition: cxViewWrapper.h:29
boost::shared_ptr< class DisplayTextRep > DisplayTextRepPtr
DataViewPropertiesInteractorPtr mShow3DSlicesInteractor
virtual ~ViewWrapper()
Definition: cxViewWrapper.h:93
Namespace for all CustusX production code.