VTK  9.0.1
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:
50  static vtkPhyloXMLTreeReader* New();
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
55 
58  vtkTree* GetOutput();
59  vtkTree* GetOutput(int idx);
61 
62 protected:
64  ~vtkPhyloXMLTreeReader() override;
65 
69  void ReadXMLData() override;
70 
76  void ReadXMLElement(vtkXMLDataElement* element, vtkMutableDirectedGraph* g, vtkIdType vertex);
77 
84  vtkIdType ReadCladeElement(
86 
91  void ReadNameElement(vtkXMLDataElement* element, vtkMutableDirectedGraph* g, vtkIdType vertex);
92 
96  void ReadDescriptionElement(vtkXMLDataElement* element, vtkMutableDirectedGraph* g);
97 
103  void ReadPropertyElement(
105 
111  void ReadBranchLengthElement(
113 
118  void ReadConfidenceElement(
120 
125  void ReadColorElement(vtkXMLDataElement* element, vtkMutableDirectedGraph* g, vtkIdType vertex);
126 
131  void PropagateBranchColor(vtkTree* tree);
132 
136  void CountNodes(vtkXMLDataElement* element);
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 
156  int FillOutputPortInformation(int, vtkInformation*) override;
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
vtkXMLReader.h
vtkMutableDirectedGraph
An editable directed graph.
Definition: vtkMutableDirectedGraph.h:45
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkSmartPointer< vtkBitArray >
vtkTree
A rooted tree data structure.
Definition: vtkTree.h:54
vtkXMLReader::ReadXMLData
virtual void ReadXMLData()
vtkXMLReader::SetupEmptyOutput
virtual void SetupEmptyOutput()=0
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkXMLReader::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSmartPointer.h
vtkXMLReader::GetDataSetName
virtual const char * GetDataSetName()=0
vtkXMLDataElement
Represents an XML element and those nested inside.
Definition: vtkXMLDataElement.h:36
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkX3D::string
@ string
Definition: vtkX3D.h:496
vtkPhyloXMLTreeReader
read vtkTree from PhyloXML formatted file
Definition: vtkPhyloXMLTreeReader.h:47
vtkBitArray
dynamic, self-adjusting array of bits
Definition: vtkBitArray.h:33
vtkXMLReader
Superclass for VTK's XML format readers.
Definition: vtkXMLReader.h:43
vtkAlgorithm::FillOutputPortInformation
virtual int FillOutputPortInformation(int port, vtkInformation *info)
Fill the output port information objects for this algorithm.