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

Method WriteTreeLevelElement

IO/Infovis/vtkPhyloXMLTreeWriter.cxx:104–132  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

102
103//------------------------------------------------------------------------------
104void vtkPhyloXMLTreeWriter::WriteTreeLevelElement(vtkTree* input, vtkXMLDataElement* rootElement,
105 const char* elementName, const char* attributeName)
106{
107 std::string arrayName = "phylogeny.";
108 arrayName += elementName;
109 vtkAbstractArray* array = input->GetVertexData()->GetAbstractArray(arrayName.c_str());
110 if (array)
111 {
112 vtkNew<vtkXMLDataElement> element;
113 element->SetName(elementName);
114 vtkStdString val = array->GetVariantValue(0).ToString();
115 element->SetCharacterData(val.c_str(), static_cast<int>(val.length()));
116
117 // set the attribute for this element if one was requested.
118 if (strcmp(attributeName, "") != 0)
119 {
120 const char* attributeValue = this->GetArrayAttribute(array, attributeName);
121 if (strcmp(attributeValue, "") != 0)
122 {
123 element->SetAttribute(attributeName, attributeValue);
124 }
125 }
126
127 rootElement->AddNestedElement(element);
128
129 // add this array to the blacklist so we don't try to write it again later
130 this->Blacklist->InsertNextValue(arrayName.c_str());
131 }
132}
133
134//------------------------------------------------------------------------------
135void vtkPhyloXMLTreeWriter::WriteTreeLevelProperties(vtkTree* input, vtkXMLDataElement* element)

Callers 1

WriteDataMethod · 0.95

Calls 12

GetArrayAttributeMethod · 0.95
GetAbstractArrayMethod · 0.80
GetVertexDataMethod · 0.80
SetCharacterDataMethod · 0.80
AddNestedElementMethod · 0.80
c_strMethod · 0.45
SetNameMethod · 0.45
ToStringMethod · 0.45
GetVariantValueMethod · 0.45
lengthMethod · 0.45
SetAttributeMethod · 0.45
InsertNextValueMethod · 0.45

Tested by

no test coverage detected