Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef QMITKABSTRACTVIEW_H_
18 #define QMITKABSTRACTVIEW_H_
19 
20 #ifdef __MINGW32__
21 // We need to inlclude winbase.h here in order to declare
22 // atomic intrinsics like InterlockedIncrement correctly.
23 // Otherwhise, they would be declared wrong within qatomic_windows.h .
24 #include <windows.h>
25 #endif
26 
27 //# blueberry stuff
28 #include <berryQtViewPart.h>
31 
32 #include <berryIPreferences.h>
33 
34 //# mitk stuff
36 
37 #include "mitkDataNodeSelection.h"
38 #include "mitkIRenderWindowPart.h"
39 
40 #include <mitkDataStorage.h>
41 #include <mitkRenderingManager.h>
43 
44 #include <QItemSelectionModel>
45 
46 namespace mitk {
47  class DataNode;
48 }
49 
50 namespace berry {
51  struct IBerryPreferences;
52 }
53 
54 class QmitkAbstractViewPrivate;
55 class QmitkAbstractViewSelectionProvider;
56 
105 {
106 
107 public:
108 
114 
116  NONE = 0x00000000,
118  BRING_TO_FRONT = 0x00000001,
120  ACTIVATE = 0x00000002,
122  OPEN = 0x00000004
123  };
124 
125  Q_DECLARE_FLAGS(IRenderWindowPartStrategies, IRenderWindowPartStrategy)
126 
127 
131 
136  QmitkAbstractView();
137 
141  virtual ~QmitkAbstractView();
142 
143 protected:
144 
151  void FireNodeSelected(mitk::DataNode::Pointer node);
152 
159  virtual void FireNodesSelected(const QList<mitk::DataNode::Pointer>& nodes);
160 
167  QList<mitk::DataNode::Pointer> GetCurrentSelection() const;
168 
175  bool IsCurrentSelectionValid() const;
176 
183  QList<mitk::DataNode::Pointer> GetDataManagerSelection() const;
184 
191  bool IsDataManagerSelectionValid() const;
192 
199  void SetDataManagerSelection(const berry::ISelection::ConstPointer& selection,
200  QItemSelectionModel::SelectionFlags flags = QItemSelectionModel::ClearAndSelect) const;
201 
206  void SynchronizeDataManagerSelection() const;
207 
213  berry::IPreferences::Pointer GetPreferences() const;
214 
218  mitk::IDataStorageReference::Pointer GetDataStorageReference() const;
219 
223  mitk::DataStorage::Pointer GetDataStorage() const;
224 
232  mitk::IRenderWindowPart* GetRenderWindowPart(IRenderWindowPartStrategies strategies = NONE) const;
233 
240  void RequestRenderWindowUpdate(mitk::RenderingManager::RequestType requestType = mitk::RenderingManager::REQUEST_UPDATE_ALL);
241 
249  void HandleException( std::exception& e, QWidget* parent = nullptr, bool showDialog = true ) const;
250 
255  void HandleException( const char* str, QWidget* parent = nullptr, bool showDialog = true ) const;
256 
260  void WaitCursorOn();
261 
265  void WaitCursorOff();
266 
270  void BusyCursorOn();
271 
275  void BusyCursorOff();
276 
280  void RestoreOverrideCursor();
281 
282 private:
283 
291  virtual void SetSelectionProvider();
292 
305  virtual QItemSelectionModel* GetDataNodeSelectionModel() const;
306 
316  virtual void OnSelectionChanged(berry::IWorkbenchPart::Pointer part, const QList<mitk::DataNode::Pointer> &nodes);
317 
323  virtual void OnNullSelection(berry::IWorkbenchPart::Pointer part);
324 
331  virtual void OnPreferencesChanged(const berry::IBerryPreferences*);
332 
337  virtual void NodeAdded(const mitk::DataNode* node);
338 
343  virtual void NodeChanged(const mitk::DataNode* node);
344 
349  virtual void NodeRemoved(const mitk::DataNode* node);
350 
357  virtual void DataStorageModified();
358 
365  virtual void DataStorageChanged(mitk::IDataStorageReference::Pointer dsRef);
366 
370  void CreatePartControl(QWidget* parent) override;
371 
376  void AfterCreateQtPartControl();
377 
378 private:
379 
380  friend class QmitkAbstractViewPrivate;
381  friend class QmitkViewCoordinator;
382 
383  Q_DISABLE_COPY(QmitkAbstractView)
384 
385  const QScopedPointer<QmitkAbstractViewPrivate> d;
386 
387 };
388 
389 Q_DECLARE_OPERATORS_FOR_FLAGS(QmitkAbstractView::IRenderWindowPartStrategies)
390 
391 #endif /*QMITKABSTRACTVIEW_H_*/
itk::SmartPointer< Self > Pointer
STL namespace.
DataCollection - Class to facilitate loading/accessing structured data.
static mitk::DataStorage::Pointer GetDataStorage()
itk::SmartPointer< const Self > ConstPointer
#define berryObjectMacro(...)
Definition: berryMacros.h:37
A convenient base class for MITK related BlueBerry Views.
#define MITK_QT_COMMON