Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
QmitkAbstractView.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QMITKABSTRACTVIEW_H_
14 #define QMITKABSTRACTVIEW_H_
15 
16 //# blueberry stuff
17 #include <berryQtViewPart.h>
20 
21 #include <berryIPreferences.h>
22 
23 //# mitk stuff
25 
26 #include "mitkDataNodeSelection.h"
27 #include "mitkIRenderWindowPart.h"
28 
29 #include <mitkWorkbenchUtil.h>
30 
31 #include <mitkDataStorage.h>
32 #include <mitkRenderingManager.h>
34 
35 #include <QItemSelectionModel>
36 
37 namespace mitk {
38  class DataNode;
39 }
40 
41 namespace berry {
42  struct IBerryPreferences;
43 }
44 
45 class QmitkAbstractViewPrivate;
46 class QmitkAbstractViewSelectionProvider;
47 
96 {
97 
98 public:
99 
104 
110 
114  ~QmitkAbstractView() override;
115 
116 protected:
117 
124  void FireNodeSelected(mitk::DataNode::Pointer node);
125 
132  virtual void FireNodesSelected(const QList<mitk::DataNode::Pointer>& nodes);
133 
140  QList<mitk::DataNode::Pointer> GetCurrentSelection() const;
141 
148  bool IsCurrentSelectionValid() const;
149 
156  QList<mitk::DataNode::Pointer> GetDataManagerSelection() const;
157 
164  bool IsDataManagerSelectionValid() const;
165 
172  void SetDataManagerSelection(const berry::ISelection::ConstPointer& selection,
173  QItemSelectionModel::SelectionFlags flags = QItemSelectionModel::ClearAndSelect) const;
174 
179  void SynchronizeDataManagerSelection() const;
180 
186  berry::IPreferences::Pointer GetPreferences() const;
187 
191  mitk::IDataStorageReference::Pointer GetDataStorageReference() const;
192 
196  mitk::DataStorage::Pointer GetDataStorage() const;
197 
205  mitk::IRenderWindowPart* GetRenderWindowPart(mitk::WorkbenchUtil::IRenderWindowPartStrategies strategies = mitk::WorkbenchUtil::NONE) const;
206 
213  void RequestRenderWindowUpdate(mitk::RenderingManager::RequestType requestType = mitk::RenderingManager::REQUEST_UPDATE_ALL);
214 
222  void HandleException( std::exception& e, QWidget* parent = nullptr, bool showDialog = true ) const;
223 
228  void HandleException( const char* str, QWidget* parent = nullptr, bool showDialog = true ) const;
229 
233  void WaitCursorOn();
234 
238  void WaitCursorOff();
239 
243  void BusyCursorOn();
244 
248  void BusyCursorOff();
249 
253  void RestoreOverrideCursor();
254 
255 private:
256 
264  virtual void SetSelectionProvider();
265 
278  virtual QItemSelectionModel* GetDataNodeSelectionModel() const;
279 
289  virtual void OnSelectionChanged(berry::IWorkbenchPart::Pointer part, const QList<mitk::DataNode::Pointer> &nodes);
290 
296  virtual void OnNullSelection(berry::IWorkbenchPart::Pointer part);
297 
304  virtual void OnPreferencesChanged(const berry::IBerryPreferences*);
305 
310  virtual void NodeAdded(const mitk::DataNode* node);
311 
316  virtual void NodeChanged(const mitk::DataNode* node);
317 
322  virtual void NodeRemoved(const mitk::DataNode* node);
323 
330  virtual void DataStorageModified();
331 
338  virtual void DataStorageChanged(mitk::IDataStorageReference::Pointer dsRef);
339 
343  void CreatePartControl(QWidget* parent) override;
344 
349  void AfterCreateQtPartControl();
350 
351 private:
352 
353  friend class QmitkAbstractViewPrivate;
354  friend class QmitkViewCoordinator;
355 
356  Q_DISABLE_COPY(QmitkAbstractView)
357 
358  const QScopedPointer<QmitkAbstractViewPrivate> d;
359 
360 };
361 
362 #endif /*QMITKABSTRACTVIEW_H_*/
Interface for a MITK Workbench Part providing a render window.
DataCollection - Class to facilitate loading/accessing structured data.
#define berryObjectMacro(...)
Definition: berryMacros.h:33
A convenient base class for MITK related BlueBerry Views.
#define MITK_QT_COMMON
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57