Fraxinus  22.04-rc5
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  ToolPtr getControllingTool();
101 
102 signals:
103  void orientationChanged(ORIENTATION_TYPE type);
104 
105 protected slots:
106  void contextMenuSlot(const QPoint& point);
107  void settingsChangedSlot(QString key);
108 
109  virtual void dataViewPropertiesChangedSlot(QString uid) = 0;
110  virtual void videoSourceChangedSlot(QString uid) {}
111  virtual void activeToolChangedSlot() {};
112 
113 protected:
114  ViewWrapper(VisServicesPtr backend);
115 
116  void connectContextMenu(ViewPtr view);
117  virtual QString getDataDescription() = 0;
118  virtual QString getViewDescription() = 0;
119  virtual void appendToContextMenu(QMenu& contextMenu) = 0;
120  QStringList getAllDataNames(DataViewProperties properties) const;
121  virtual void addReps();
122 
125  DataViewPropertiesInteractorPtr mDataViewPropertiesInteractor;
126  DataViewPropertiesInteractorPtr mShow3DSlicesInteractor;
128 
129 private:
130  DisplayTextRepPtr mPlaneTypeText;
131  DisplayTextRepPtr mDataNameText;
132 };
133 
137 } //namespace cx
138 
139 #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
virtual void activeToolChangedSlot()
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr