Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
QmitkFunctionality.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 QMITKFUNCTIONALITY_H_
14 #define QMITKFUNCTIONALITY_H_
15 
16 //# blueberry stuff
17 #include <berryQtViewPart.h>
20 
21 #include <berryIPreferences.h>
22 
23 //# mitk stuff
24 #include <org_mitk_gui_qt_common_legacy_Export.h>
25 #include "mitkDataNodeSelection.h"
26 #include <mitkDataStorage.h>
30 
31 // CTK Includes
32 #include <ctkServiceTracker.h>
33 
34 
35 //# forward declarations
36 
37 namespace mitk {
38  class DataNode;
39  struct IDataStorageService;
40 }
41 
42 namespace berry {
43  struct IBerryPreferences;
44 }
45 
46 class QmitkFunctionalitySelectionProvider;
47 
70 class MITK_QT_COMMON_LEGACY QmitkFunctionality : public berry::QtViewPart
71 {
72 
73 //# public virtual methods which can be overwritten
74 public:
87  ~QmitkFunctionality() override;
93  virtual void ClosePart();
97  virtual void OnSelectionChanged(std::vector<mitk::DataNode*> /*nodes*/);
102  virtual void OnPreferencesChanged(const berry::IBerryPreferences*);
108  void SetHandleMultipleDataStorages(bool multiple);
112  bool HandlesMultipleDataStorages() const;
117  virtual void MultiWidgetAvailable(QmitkAbstractMultiWidget& multiWidget);
122  virtual void MultiWidgetClosed(QmitkAbstractMultiWidget& multiWidget);
127  virtual void MultiWidgetNotAvailable();
132  virtual void Activated();
136  bool IsActivated() const;
141  virtual void Deactivated();
169  virtual bool IsExclusiveFunctionality() const;
173  void FireNodeSelected(mitk::DataNode* node);
177  void FireNodesSelected(std::vector<mitk::DataNode*> nodes);
181  virtual void Visible();
185  bool IsVisible() const;
189  virtual void Hidden();
190 //# protected virtual methods which can be overwritten
191 protected:
196  virtual void NodeAdded(const mitk::DataNode* node);
201  virtual void NodeChanged(const mitk::DataNode* /*node*/);
206  virtual void NodeRemoved(const mitk::DataNode* node);
211  virtual void DataStorageChanged();
216  std::vector<mitk::DataNode*> GetCurrentSelection() const;
221  std::vector<mitk::DataNode*> GetDataManagerSelection() const;
227  berry::IPreferences::Pointer GetPreferences() const;
234  mitk::DataStorage::Pointer GetDataStorage() const;
238  mitk::DataStorage::Pointer GetDefaultDataStorage() const;
239 
240  mitk::IDataStorageReference::Pointer GetDataStorageReference() const;
241 
248  QmitkAbstractMultiWidget* GetActiveMultiWidget( bool reCreateWidget = true);
256  void HandleException( std::exception& e, QWidget* parent = nullptr, bool showDialog = true ) const;
261  void HandleException( const char* str, QWidget* parent = nullptr, bool showDialog = true ) const;
265  void WaitCursorOn();
269  void WaitCursorOff();
273  void BusyCursorOn();
277  void BusyCursorOff();
281  void RestoreOverrideCursor();
282 
283 //# other public methods which should not be overwritten
284 public:
288  void CreatePartControl(QWidget* parent) override;
293  void SetFocus() override;
299  void NodeAddedProxy(const mitk::DataNode* node);
305  void NodeRemovedProxy(const mitk::DataNode* node);
311  void NodeChangedProxy(const mitk::DataNode* node);
315  void SetVisible(bool visible);
319  void SetActivated(bool activated);
326  void ClosePartProxy();
327 
328 //# other protected methods which should not be overwritten (or which are deprecated)
329 protected:
334  void AfterCreateQtPartControl();
338  void ActivateLastVisibleFunctionality();
342  void BlueBerrySelectionChanged(const berry::IWorkbenchPart::Pointer& sourcepart, const berry::ISelection::ConstPointer& selection);
346  std::vector<mitk::DataNode*> DataNodeSelectionToVector(mitk::DataNodeSelection::ConstPointer currentSelection) const;
347  //# protected fields
348 protected:
357  QWidget* m_Parent;
361  bool m_Active;
365  bool m_Visible;
366 
367  //# private fields:
368 
369 private:
373  QmitkFunctionalitySelectionProvider* m_SelectionProvider;
377  QScopedPointer<berry::ISelectionListener> m_BlueBerrySelectionListener;
378 
379  ctkServiceTracker<mitk::IDataStorageService*> m_DataStorageServiceTracker;
380 
381 
385  bool m_HandlesMultipleDataStorages;
389  bool m_InDataStorageChanged;
393  std::set<std::string> m_VisibleFunctionalities;
394 };
395 
396 #endif /*QMITKFUNCTIONALITY_H_*/
DataCollection - Class to facilitate loading/accessing structured data.
#define berryObjectMacro(...)
Definition: berryMacros.h:33
The base class of all MITK related blueberry views (~ in the old version of MITK, this was called "Fu...
The &#39;QmitkAbstractMultiWidget&#39; is a &#39;QWidget&#39; that can be subclassed to display multiple render windo...
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57