------------------------------------------------------------------------------
| 371 | |
| 372 | //------------------------------------------------------------------------------ |
| 373 | vtkInformation* vtkDataObjectTree::GetMetaData(vtkCompositeDataIterator* compositeIter) |
| 374 | { |
| 375 | auto dObjTreeIter = vtkDataObjectTreeIterator::SafeDownCast(compositeIter); |
| 376 | if (!dObjTreeIter || dObjTreeIter->IsDoneWithTraversal()) |
| 377 | { |
| 378 | vtkErrorMacro("Invalid iterator location."); |
| 379 | return nullptr; |
| 380 | } |
| 381 | |
| 382 | vtkDataObjectTreeIndex index = dObjTreeIter->GetCurrentIndex(); |
| 383 | |
| 384 | if (index.empty()) |
| 385 | { |
| 386 | // Sanity check. |
| 387 | vtkErrorMacro("Invalid index returned by iterator."); |
| 388 | return nullptr; |
| 389 | } |
| 390 | |
| 391 | vtkDataObjectTree* parent = this; |
| 392 | int numIndices = static_cast<int>(index.size()); |
| 393 | for (int cc = 0; cc < numIndices - 1; cc++) |
| 394 | { |
| 395 | if (!parent || parent->GetNumberOfChildren() <= index[cc]) |
| 396 | { |
| 397 | vtkErrorMacro("Structure is not expected. Did you forget to use copy structure?"); |
| 398 | return nullptr; |
| 399 | } |
| 400 | parent = vtkDataObjectTree::SafeDownCast(parent->GetChild(index[cc])); |
| 401 | } |
| 402 | |
| 403 | if (!parent || parent->GetNumberOfChildren() <= index.back()) |
| 404 | { |
| 405 | vtkErrorMacro("Structure is not expected. Did you forget to use copy structure?"); |
| 406 | return nullptr; |
| 407 | } |
| 408 | |
| 409 | return parent->GetChildMetaData(index.back()); |
| 410 | } |
| 411 | |
| 412 | //------------------------------------------------------------------------------ |
| 413 | vtkTypeBool vtkDataObjectTree::HasMetaData(vtkCompositeDataIterator* compositeIter) |