VTK
vtkPhyloXMLTreeWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPhyloXMLTreeWriter.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 =========================================================================*/
26 #ifndef vtkPhyloXMLTreeWriter_h
27 #define vtkPhyloXMLTreeWriter_h
28 
29 #include "vtkIOInfovisModule.h" // For export macro
30 #include "vtkXMLWriter.h"
31 #include "vtkSmartPointer.h" // For SP ivars
32 #include "vtkStdString.h" // For get/set ivars
33 
34 class vtkStringArray;
35 class vtkTree;
36 class vtkXMLDataElement;
37 
38 class VTKIOINFOVIS_EXPORT vtkPhyloXMLTreeWriter : public vtkXMLWriter
39 {
40 public:
41  static vtkPhyloXMLTreeWriter *New();
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
46 
49  vtkTree* GetInput();
50  vtkTree* GetInput(int port);
52 
56  const char* GetDefaultFileExtension() override;
57 
59 
66  vtkGetMacro(EdgeWeightArrayName, vtkStdString);
67  vtkSetMacro(EdgeWeightArrayName, vtkStdString);
69 
71 
78  vtkGetMacro(NodeNameArrayName, vtkStdString);
79  vtkSetMacro(NodeNameArrayName, vtkStdString);
81 
87  void IgnoreArray(const char * arrayName);
88 
89 protected:
91  ~vtkPhyloXMLTreeWriter() override {}
92 
93  int WriteData() override;
94 
95  const char* GetDataSetName() override;
96  int StartFile() override;
97  int EndFile() override;
98 
103  void WriteTreeLevelElement(vtkTree *input,
104  vtkXMLDataElement *rootElement,
105  const char *elementName,
106  const char *attributeName);
107 
111  void WriteTreeLevelProperties(vtkTree *input, vtkXMLDataElement *rootElement);
112 
117  void WriteCladeElement(vtkTree* const input, vtkIdType vertex,
118  vtkXMLDataElement *parentElement);
119 
123  void WriteBranchLengthAttribute(vtkTree* const input, vtkIdType vertex,
124  vtkXMLDataElement *element);
125 
129  void WriteNameElement(vtkIdType vertex, vtkXMLDataElement *element);
130 
134  void WriteConfidenceElement(vtkTree* const input, vtkIdType vertex,
135  vtkXMLDataElement *element);
136 
141  void WriteColorElement(vtkTree* const input, vtkIdType vertex,
142  vtkXMLDataElement *element);
143 
147  void WritePropertyElement(vtkAbstractArray *array, vtkIdType vertex,
148  vtkXMLDataElement *element);
149 
154  const char* GetArrayAttribute(vtkAbstractArray *array,
155  const char *attributeName);
156 
157  int FillInputPortInformation(int port, vtkInformation *info) override;
158 
160 
163 
167 
168 private:
170  void operator=(const vtkPhyloXMLTreeWriter&) = delete;
171 };
172 
173 #endif
virtual const char * GetDataSetName()=0
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:40
Represents an XML element and those nested inside.
vtkDataObject * GetInput()
Assign a data object as input.
Definition: vtkXMLWriter.h:235
Store vtkAlgorithm input/output information.
Abstract superclass for all arrays.
virtual int EndFile()
vtkInformation * InputInformation
a vtkAbstractArray subclass for strings
vtkAbstractArray * NodeNameArray
int vtkIdType
Definition: vtkType.h:347
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int WriteData()
Definition: vtkXMLWriter.h:360
Superclass for VTK's XML file writers.
Definition: vtkXMLWriter.h:62
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual const char * GetDefaultFileExtension()=0
Get the default file extension for files written by this writer.
write vtkTree data to PhyloXML format.
vtkAbstractArray * EdgeWeightArray
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
vtkSmartPointer< vtkStringArray > Blacklist
static vtkAlgorithm * New()
virtual int StartFile()
A rooted tree data structure.
Definition: vtkTree.h:60