VTK  9.1.0
vtkPhyloXMLTreeReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPhyloXMLTreeReader.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
35 #ifndef vtkPhyloXMLTreeReader_h
36 #define vtkPhyloXMLTreeReader_h
37 
38 #include "vtkIOInfovisModule.h" // For export macro
39 #include "vtkSmartPointer.h" // For SP ivar
40 #include "vtkXMLReader.h"
41 
42 class vtkBitArray;
44 class vtkTree;
45 class vtkXMLDataElement;
46 
47 class VTKIOINFOVIS_EXPORT vtkPhyloXMLTreeReader : public vtkXMLReader
48 {
49 public:
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
55 
59  vtkTree* GetOutput(int idx);
61 
62 protected:
65 
69  void ReadXMLData() override;
70 
77 
86 
92 
97 
105 
113 
120 
126 
132 
137 
142  std::string GetTrimmedString(const char* input);
143 
148  std::string GetStringBeforeColon(const char* input);
149 
154  std::string GetStringAfterColon(const char* input);
155 
157  const char* GetDataSetName() override;
158  void SetOutput(vtkTree* output);
159  void SetupEmptyOutput() override;
160 
161 private:
162  vtkIdType NumberOfNodes;
163  bool HasBranchColor;
164  vtkSmartPointer<vtkBitArray> ColoredVertices;
166  void operator=(const vtkPhyloXMLTreeReader&) = delete;
167 };
168 
169 #endif
dynamic, self-adjusting array of bits
Definition: vtkBitArray.h:34
a simple class to control print indentation
Definition: vtkIndent.h:34
Store vtkAlgorithm input/output information.
An editable directed graph.
read vtkTree from PhyloXML formatted file
~vtkPhyloXMLTreeReader() override
static vtkPhyloXMLTreeReader * New()
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
const char * GetDataSetName() override
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 (:).
vtkTree * GetOutput(int idx)
Get the output of this reader.
void ReadXMLData() override
Read the input PhyloXML and populate our output vtkTree.
void SetOutput(vtkTree *output)
vtkTree * GetOutput()
Get the output of this reader.
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.
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.
A rooted tree data structure.
Definition: vtkTree.h:55
Represents an XML element and those nested inside.
Superclass for VTK's XML format readers.
Definition: vtkXMLReader.h:47
@ string
Definition: vtkX3D.h:496
int vtkIdType
Definition: vtkType.h:332