Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkDataStorageComboBox.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 QmitkDataStorageComboBox_h
18 #define QmitkDataStorageComboBox_h
19 
20 #include <MitkQtWidgetsExports.h>
21 
22 // Own Includes
23 #include "mitkDataNode.h"
24 #include "mitkDataStorage.h"
25 #include "mitkNodePredicateBase.h"
26 #include "mitkWeakPointer.h"
27 
28 // Toolkit Includes
29 #include <QComboBox>
30 #include <map>
31 
32 // Forward Declartions
33 
46 {
47  //#CLASS-MACROS,FRIENDS
48  Q_OBJECT
49 
50  //#CTORS/DTOR
51 public:
55  QmitkDataStorageComboBox(QWidget *parent = nullptr, bool _AutoSelectNewNodes = false);
56 
61  const mitk::NodePredicateBase *_Predicate,
62  QWidget *parent = nullptr,
63  bool _AutoSelectNewNodes = false);
64 
69 
73  virtual int Find(const mitk::DataNode *_DataNode) const;
74 
75  //#PUBLIC GETTER
76 public:
84  const mitk::NodePredicateBase::ConstPointer GetPredicate() const;
88  virtual mitk::DataNode::Pointer GetNode(int index) const;
92  virtual mitk::DataNode::Pointer GetSelectedNode() const;
101  virtual bool GetAutoSelectNewItems();
102 
103  //#PUBLIC SETTER
104 public:
109  void SetDataStorage(mitk::DataStorage *dataStorage);
114  void SetPredicate(const mitk::NodePredicateBase *_Predicate);
118  virtual void AddNode(const mitk::DataNode *_DataNode);
123  virtual void RemoveNode(int index);
127  virtual void RemoveNode(const mitk::DataNode *_DataNode);
132  virtual void SetNode(int index, const mitk::DataNode *_DataNode);
137  virtual void SetNode(const mitk::DataNode *_DataNode, const mitk::DataNode *_OtherDataNode);
141  virtual void SetAutoSelectNewItems(bool _AutoSelectNewItems);
146  virtual void OnDataNodeDeleteOrModified(const itk::Object *caller, const itk::EventObject &event);
147 
148 signals:
152  void OnSelectionChanged(const mitk::DataNode *);
153 
154  //#PROTECTED GETTER
155 protected:
159  bool HasIndex(unsigned int index) const;
160 
161  //#PROTECTED SETTER
162 protected slots:
166  void OnCurrentIndexChanged(int);
167 
168  //#PUBLIC SETTER
169 public slots:
173  void SetSelectedNode(mitk::DataNode::Pointer item);
174 
175 protected:
186  virtual void InsertNode(int index, const mitk::DataNode *_DataNode);
187 
191  void Init();
192 
196  virtual void Reset();
197 
198 protected:
199  //#PROTECTED MEMBER VARS
205 
211 
215  std::vector<mitk::DataNode *> m_Nodes;
216 
220  std::vector<long> m_NodesModifiedObserverTags;
221 
225  std::vector<long> m_NodesDeleteObserverTags;
226 
231  std::map<mitk::DataNode *, const mitk::BaseProperty *> m_PropertyToNode;
232 
237 
241 };
242 
243 #endif // QmitkDataStorageComboBox_h
std::map< mitk::DataNode *, const mitk::BaseProperty * > m_PropertyToNode
Maps a a specific node to (Name-)property. This is needed because we have to find the assiociated nod...
Data management class that handles 'was created by' relations.
std::vector< long > m_NodesModifiedObserverTags
Holds the tags of the node-modified observers. (must be updated everytime m_Nodes changes) ...
Displays all or a subset (defined by a predicate) of nodes of the Data Storage.
std::vector< mitk::DataNode * > m_Nodes
mitk::WeakPointer< mitk::DataStorage > m_DataStorage
static mitk::DataStorage::Pointer GetDataStorage()
#define MITKQTWIDGETS_EXPORT
itk::SmartPointer< const Self > ConstPointer
bool m_AutoSelectNewNodes
If set to "true" new Nodes will be automatically selected.
#define AddNode(name)
bool m_BlockEvents
Event function guard. Each function which is called by an event mechanism first checks if this is tru...
mitk::NodePredicateBase::ConstPointer m_Predicate
Holds the predicate that is responsible for the _DataNode selection of this ComboBox. If the predicate is 0, every _DataNode will be selected.
std::vector< long > m_NodesDeleteObserverTags
Holds the tags of the node-modified observers. (must be updated everytime m_Nodes changes) ...
Interface for evaluation conditions used in the DataStorage class GetSubset() method.
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66