------------------------------------------------------------------------------
| 762 | |
| 763 | //------------------------------------------------------------------------------ |
| 764 | bool vtkDataAssembly::AddDataSetIndex(int id, unsigned int dataset_index) |
| 765 | { |
| 766 | auto& internals = (*this->Internals); |
| 767 | auto node = internals.FindNode(id); |
| 768 | if (!node) |
| 769 | { |
| 770 | return false; |
| 771 | } |
| 772 | auto current_datasets = this->GetDataSetIndices(id, /*traverse_subtree=*/false); |
| 773 | if (std::find(current_datasets.begin(), current_datasets.end(), dataset_index) != |
| 774 | current_datasets.end()) |
| 775 | { |
| 776 | // already present, no need to add again. |
| 777 | return true; |
| 778 | } |
| 779 | |
| 780 | auto dsnode = node.append_child(DATASET_NODE_NAME); |
| 781 | dsnode.append_attribute("id") = dataset_index; |
| 782 | this->Modified(); |
| 783 | return true; |
| 784 | } |
| 785 | |
| 786 | //------------------------------------------------------------------------------ |
| 787 | bool vtkDataAssembly::AddDataSetIndices(int id, const std::vector<unsigned int>& dataset_indices) |