------------------------------------------------------------------------------
| 102 | |
| 103 | //------------------------------------------------------------------------------ |
| 104 | void 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 | //------------------------------------------------------------------------------ |
| 135 | void vtkPhyloXMLTreeWriter::WriteTreeLevelProperties(vtkTree* input, vtkXMLDataElement* element) |
no test coverage detected