------------------------------------------------------------------------------
| 524 | |
| 525 | //------------------------------------------------------------------------------ |
| 526 | int vtkDataAssembly::AddSubtree(int parent, vtkDataAssembly* other, int otherParent) |
| 527 | { |
| 528 | if (!other) |
| 529 | { |
| 530 | vtkErrorMacro("'other' cannot be nullptr."); |
| 531 | return -1; |
| 532 | } |
| 533 | |
| 534 | auto& internals = (*this->Internals); |
| 535 | auto node = internals.FindNode(parent); |
| 536 | if (!node) |
| 537 | { |
| 538 | vtkErrorMacro("Parent node with id=" << parent << " not found."); |
| 539 | return -1; |
| 540 | } |
| 541 | |
| 542 | auto& ointernals = (*other->Internals); |
| 543 | auto onode = ointernals.FindNode(otherParent); |
| 544 | if (!onode) |
| 545 | { |
| 546 | vtkErrorMacro("Note node with id=" << parent << " not found on 'other'"); |
| 547 | return -1; |
| 548 | } |
| 549 | |
| 550 | auto subtree = node.append_copy(onode); |
| 551 | if (otherParent == 0) |
| 552 | { |
| 553 | // remove type and version attributes. |
| 554 | subtree.remove_attribute(subtree.attribute("type")); |
| 555 | subtree.remove_attribute(subtree.attribute("version")); |
| 556 | } |
| 557 | |
| 558 | // now update node ids on the copied subtree. |
| 559 | OffsetIdWalker walker(internals.MaxUniqueId + 1, internals.MaxUniqueDataSetId + 1); |
| 560 | subtree.traverse(walker); |
| 561 | |
| 562 | // reset internal datastructure (and also validate it) |
| 563 | return internals.ParseDocument(this); |
| 564 | } |
| 565 | |
| 566 | //------------------------------------------------------------------------------ |
| 567 | int vtkDataAssembly::AddNode(const char* name, int parent) |
no test coverage detected