| 32 | } |
| 33 | |
| 34 | void QmitkDataStorageHistoryModel::UpdateModelData() |
| 35 | { |
| 36 | std::vector<mitk::DataNode::Pointer> dataNodes; |
| 37 | auto dataStorage = m_DataStorage.Lock(); |
| 38 | if (dataStorage.IsNotNull()) |
| 39 | { |
| 40 | auto nodesCandidats = m_NodePredicate.IsNotNull() |
| 41 | ? dataStorage->GetSubset(m_NodePredicate) |
| 42 | : dataStorage->GetAll(); |
| 43 | |
| 44 | const std::lock_guard<std::mutex> lock(_historyMutex); |
| 45 | |
| 46 | for (auto historyNode : _nodeHistory) |
| 47 | { |
| 48 | auto finding = std::find(nodesCandidats->begin(), nodesCandidats->end(), historyNode); |
| 49 | if (finding != nodesCandidats->end()) |
| 50 | { |
| 51 | dataNodes.push_back(*finding); |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // update the model, so that it will be filled with the nodes of the new data storage |
| 57 | beginResetModel(); |
| 58 | m_DataNodes = dataNodes; |
| 59 | endResetModel(); |
| 60 | } |
| 61 | |
| 62 | void QmitkDataStorageHistoryModel::AddNodeToHistory(mitk::DataNode* node) |
| 63 | { |