NorMIT-nav  22.09
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 
128 
129 private:
130  DisplayTextRepPtr mPlaneTypeText;
131  DisplayTextRepPtr mDataNameText;
132 };
133 
137 } //namespace cx
138 
139 #endif /* CXVIEWWRAPPER_H_ */
cxImageAlgorithms.h
cx::ViewWrapper::~ViewWrapper
virtual ~ViewWrapper()
Definition: cxViewWrapper.h:93
cxSyncedValue.h
cx::ViewWrapper::mDataViewPropertiesInteractor
DataViewPropertiesInteractorPtr mDataViewPropertiesInteractor
Definition: cxViewWrapper.h:125
cx::ViewGroupDataPtr
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
Definition: cxViewGroup.h:29
cx::CameraDataPtr
boost::shared_ptr< class CameraData > CameraDataPtr
Definition: cxViewWrapper.h:36
cx::ViewWrapper::activeToolChangedSlot
virtual void activeToolChangedSlot()
Definition: cxViewWrapper.h:111
cx::DataViewPropertiesInteractor
Definition: cxViewWrapper.h:49
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::DataViewPropertiesInteractorPtr
boost::shared_ptr< class DataViewPropertiesInteractor > DataViewPropertiesInteractorPtr
Definition: cxViewWrapper.h:45
cxForwardDeclarations.h
cxDefinitions.h
cx::VisServicesPtr
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
cxViewGroupData.h
cx::SlicePlanesProxyPtr
boost::shared_ptr< class SlicePlanesProxy > SlicePlanesProxyPtr
Definition: cxForwardDeclarations.h:95
cx::ViewWrapper::mGroupData
ViewGroupDataPtr mGroupData
Definition: cxViewWrapper.h:123
cx::DisplayTextRepPtr
boost::shared_ptr< class DisplayTextRep > DisplayTextRepPtr
Definition: cxForwardDeclarations.h:66
cx::sortOnGroupsAndAcquisitionTime
std::vector< T > sortOnGroupsAndAcquisitionTime(std::map< QString, T > input)
Definition: cxImageAlgorithms.h:98
cx::ViewWrapper::mSharedOpenGLContext
SharedOpenGLContextPtr mSharedOpenGLContext
Definition: cxViewWrapper.h:127
cx::DataViewProperties
Definition: cxViewGroupData.h:79
vtkForwardDeclarations.h
cx::ViewWrapper::mShow3DSlicesInteractor
DataViewPropertiesInteractorPtr mShow3DSlicesInteractor
Definition: cxViewWrapper.h:126
cxPatientModelService.h
cx::ViewPtr
boost::shared_ptr< class View > ViewPtr
Definition: cxForwardDeclarations.h:110
vtkPolyDataAlgorithmPtr
vtkSmartPointer< class vtkPolyDataAlgorithm > vtkPolyDataAlgorithmPtr
Definition: cxViewWrapper.h:29
cx::ToolPtr
boost::shared_ptr< class Tool > ToolPtr
Definition: cxVideoConnectionWidget.h:43
cx::ViewWrapper::videoSourceChangedSlot
virtual void videoSourceChangedSlot(QString uid)
Definition: cxViewWrapper.h:110
cx::ViewWrapper::mServices
VisServicesPtr mServices
Definition: cxViewWrapper.h:124
cx::ViewWrapper::initializePlane
virtual void initializePlane(PLANE_TYPE plane)
Definition: cxViewWrapper.h:94
cx::DataViewPropertiesInteractor::addDataActionsOfType
void addDataActionsOfType(QWidget *parent)
Definition: cxViewWrapper.h:71
cx::ViewWrapper
Superclass for ViewWrappers.
Definition: cxViewWrapper.h:89
cxVisServices.h
cx::SharedOpenGLContextPtr
boost::shared_ptr< class SharedOpenGLContext > SharedOpenGLContextPtr
Definition: cxForwardDeclarations.h:164