MCPcopy Create free account
hub / github.com/Kitware/VTK / AddNode

Method AddNode

Common/DataModel/vtkDataAssembly.cxx:567–589  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

565
566//------------------------------------------------------------------------------
567int vtkDataAssembly::AddNode(const char* name, int parent)
568{
569 if (!vtkDataAssembly::IsNodeNameValid(name))
570 {
571 vtkErrorMacro("Invalid name specified '" << (name ? name : "(nullptr)"));
572 return -1;
573 }
574
575 auto& internals = (*this->Internals);
576 auto pnode = internals.FindNode(parent);
577 if (!pnode)
578 {
579 vtkErrorMacro("Parent node with id=" << parent << " not found.");
580 return -1;
581 }
582
583 auto child = ++internals.MaxUniqueId;
584 auto cnode = pnode.append_child(name);
585 cnode.append_attribute("id") = child;
586 internals.NodeMap[child] = cnode;
587 this->Modified();
588 return child;
589}
590
591//------------------------------------------------------------------------------
592std::vector<int> vtkDataAssembly::AddNodes(const std::vector<std::string>& names, int parent)

Callers 1

Calls 4

FindNodeMethod · 0.80
append_childMethod · 0.80
append_attributeMethod · 0.80
ModifiedMethod · 0.45

Tested by

no test coverage detected