Medical Imaging Interaction Toolkit  2023.12.99-bb1d0334
Medical Imaging Interaction Toolkit
QmitkRenderWindowDataStorageTreeModel.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 QmitkRenderWindowDataStorageTreeModel_h
14 #define QmitkRenderWindowDataStorageTreeModel_h
15 
16 // render window manager UI model
17 #include "MitkQtWidgetsExports.h"
18 
19 // render window manager module
22 
23 //mitk core
24 #include <mitkBaseRenderer.h>
25 
26 // qt widgets module
29 
30 /*
31 * @brief The 'QmitkRenderWindowDataStorageTreeModel' is a tree model derived from the 'QmitkAbstractDataStorageModel'.
32 */
34 {
35  Q_OBJECT
36 
37 public:
38 
39  QmitkRenderWindowDataStorageTreeModel(QObject* parent = nullptr);
40 
41  // override from 'QmitkAbstractDataStorageModel'
45  void DataStorageChanged() override;
49  void NodePredicateChanged() override;
53  void NodeAdded(const mitk::DataNode* node) override;
57  void NodeChanged(const mitk::DataNode* node) override;
61  void NodeRemoved(const mitk::DataNode* node) override;
62 
63  // override from 'QAbstractItemModel'
64  QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
65  QModelIndex parent(const QModelIndex& parent) const override;
66 
67  int rowCount(const QModelIndex& parent = QModelIndex()) const override;
68  int columnCount(const QModelIndex& parent = QModelIndex()) const override;
69 
70  QVariant data(const QModelIndex& index, int role) const override;
71  bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
72 
73  Qt::ItemFlags flags(const QModelIndex& index) const override;
74 
75  Qt::DropActions supportedDropActions() const override;
76  Qt::DropActions supportedDragActions() const override;
77  QStringList mimeTypes() const override;
78  QMimeData* mimeData(const QModelIndexList& indexes) const override;
79 
80  bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override;
81 
82  void SetControlledRenderer(mitk::RenderWindowLayerUtilities::RendererVector controlledRenderer);
83 
84  void SetCurrentRenderer(mitk::BaseRenderer* baseRenderer);
85  mitk::BaseRenderer::Pointer GetCurrentRenderer() const;
86 
87 private:
88 
89  void ResetTree();
90  void UpdateModelData();
96  void AdjustLayerProperty();
100  void TreeToVector(QmitkDataStorageTreeModelInternalItem* parent, std::vector<QmitkDataStorageTreeModelInternalItem*>& treeAsVector) const;
110  void AddNodeInternal(const mitk::DataNode* dataNode, const mitk::BaseRenderer* renderer);
119  void RemoveNodeInternal(const mitk::DataNode* dataNode);
120 
121  mitk::DataNode* GetParentNode(const mitk::DataNode* node) const;
122  QmitkDataStorageTreeModelInternalItem* GetItemByIndex(const QModelIndex& index) const;
123  QModelIndex GetIndexByItem(QmitkDataStorageTreeModelInternalItem* item) const;
124 
125  std::unique_ptr<mitk::RenderWindowLayerController> m_RenderWindowLayerController;
128 
129 };
130 
131 #endif
QmitkDataStorageTreeModelInternalItem
Definition: QmitkDataStorageTreeModelInternalItem.h:26
QmitkAbstractDataStorageModel::DataStorageChanged
virtual void DataStorageChanged()=0
MITKQTWIDGETS_EXPORT
#define MITKQTWIDGETS_EXPORT
Definition: MitkQtWidgetsExports.h:15
QmitkRenderWindowDataStorageTreeModel
Definition: QmitkRenderWindowDataStorageTreeModel.h:33
itk::SmartPointer< Self >
mitk::RenderWindowLayerUtilities::RendererVector
std::vector< BaseRenderer * > RendererVector
Definition: mitkRenderWindowLayerUtilities.h:32
QmitkAbstractDataStorageModel::NodeRemoved
virtual void NodeRemoved(const mitk::DataNode *node)=0
QmitkAbstractDataStorageModel::NodeChanged
virtual void NodeChanged(const mitk::DataNode *node)=0
QmitkAbstractDataStorageModel.h
MitkQtWidgetsExports.h
QmitkAbstractDataStorageModel::NodeAdded
virtual void NodeAdded(const mitk::DataNode *node)=0
QmitkDataStorageTreeModelInternalItem.h
mitk::BaseRenderer
Definition: mitkBaseRenderer.h:56
mitkRenderWindowLayerController.h
mitkBaseRenderer.h
mitk::WeakPointer< mitk::BaseRenderer >
QmitkAbstractDataStorageModel
Definition: QmitkAbstractDataStorageModel.h:40
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63
mitkRenderWindowLayerUtilities.h
QmitkAbstractDataStorageModel::NodePredicateChanged
virtual void NodePredicateChanged()=0