VTK  9.3.20240423
vtkPhyloXMLTreeReader.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
26#ifndef vtkPhyloXMLTreeReader_h
27#define vtkPhyloXMLTreeReader_h
28
29#include "vtkIOInfovisModule.h" // For export macro
30#include "vtkSmartPointer.h" // For SP ivar
31#include "vtkXMLReader.h"
32
33VTK_ABI_NAMESPACE_BEGIN
34class vtkBitArray;
36class vtkTree;
38
39class VTKIOINFOVIS_EXPORT vtkPhyloXMLTreeReader : public vtkXMLReader
40{
41public:
44 void PrintSelf(ostream& os, vtkIndent indent) override;
45
47
51 vtkTree* GetOutput(int idx);
53
54protected:
57
61 void ReadXMLData() override;
62
69
78
84
89
97
105
112
118
124
129
134 std::string GetTrimmedString(const char* input);
135
140 std::string GetStringBeforeColon(const char* input);
141
146 std::string GetStringAfterColon(const char* input);
147
149 const char* GetDataSetName() override;
150 void SetOutput(vtkTree* output);
151 void SetupEmptyOutput() override;
152
153private:
154 vtkIdType NumberOfNodes;
155 bool HasBranchColor;
156 vtkSmartPointer<vtkBitArray> ColoredVertices;
158 void operator=(const vtkPhyloXMLTreeReader&) = delete;
159};
160
161VTK_ABI_NAMESPACE_END
162#endif
dynamic, self-adjusting array of bits
Definition vtkBitArray.h:29
a simple class to control print indentation
Definition vtkIndent.h:108
Store vtkAlgorithm input/output information.
An editable directed graph.
read vtkTree from PhyloXML formatted file
~vtkPhyloXMLTreeReader() override
void ReadBranchLengthElement(vtkXMLDataElement *element, vtkMutableDirectedGraph *g, vtkIdType vertex)
Read & store the branch length for this clade.
void ReadConfidenceElement(vtkXMLDataElement *element, vtkMutableDirectedGraph *g, vtkIdType vertex)
Read confidence value and store it for the specified vertex, or the whole tree is vertex is -1.
void ReadNameElement(vtkXMLDataElement *element, vtkMutableDirectedGraph *g, vtkIdType vertex)
Read a name and assign it to the specified vertex, or the whole tree if vertex is -1.
vtkIdType ReadCladeElement(vtkXMLDataElement *element, vtkMutableDirectedGraph *g, vtkIdType parent)
Read a clade element.
void ReadColorElement(vtkXMLDataElement *element, vtkMutableDirectedGraph *g, vtkIdType vertex)
Read RGB color value for this vertex.
void SetupEmptyOutput() override
Setup the output with no data available.
void PropagateBranchColor(vtkTree *tree)
Assign the parent's branch color to child vertices where none is otherwise specified.
void ReadXMLElement(vtkXMLDataElement *element, vtkMutableDirectedGraph *g, vtkIdType vertex)
Read one particular XML element.
std::string GetTrimmedString(const char *input)
Return a copy of the input string with all leading & trailing whitespace removed.
std::string GetStringBeforeColon(const char *input)
Return the portion of the input string that occurs before the first colon (:).
static vtkPhyloXMLTreeReader * New()
vtkTree * GetOutput()
Get the output of this reader.
const char * GetDataSetName() override
Get the name of the data set being read.
void ReadXMLData() override
Read the input PhyloXML and populate our output vtkTree.
void SetOutput(vtkTree *output)
void ReadDescriptionElement(vtkXMLDataElement *element, vtkMutableDirectedGraph *g)
Read the description for the tree.
int FillOutputPortInformation(int, vtkInformation *) override
Fill the output port information objects for this algorithm.
void ReadPropertyElement(vtkXMLDataElement *element, vtkMutableDirectedGraph *g, vtkIdType vertex)
Read a property and assign it to our output vtkTree's VertexData for the specified vertex.
vtkTree * GetOutput(int idx)
Get the output of this reader.
std::string GetStringAfterColon(const char *input)
Return the portion of the input string that occurs after the first colon (:).
void CountNodes(vtkXMLDataElement *element)
Count the number of vertices in the tree.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Hold a reference to a vtkObjectBase instance.
A rooted tree data structure.
Definition vtkTree.h:145
Represents an XML element and those nested inside.
Superclass for VTK's XML format readers.
int vtkIdType
Definition vtkType.h:315