VTK  9.1.0
vtkTree.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTree.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 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
155 #ifndef vtkTree_h
156 #define vtkTree_h
157 
158 #include "vtkCommonDataModelModule.h" // For export macro
159 #include "vtkDirectedAcyclicGraph.h"
160 
161 class vtkIdTypeArray;
162 
163 class VTKCOMMONDATAMODEL_EXPORT vtkTree : public vtkDirectedAcyclicGraph
164 {
165 public:
166  static vtkTree* New();
168  void PrintSelf(ostream& os, vtkIndent indent) override;
169 
173  int GetDataObjectType() override { return VTK_TREE; }
174 
176 
179  vtkGetMacro(Root, vtkIdType);
181 
186 
191 
198 
203 
208 
215 
219  bool IsLeaf(vtkIdType vertex);
220 
222 
226  static vtkTree* GetData(vtkInformationVector* v, int i = 0);
228 
235  virtual void ReorderChildren(vtkIdType parent, vtkIdTypeArray* children);
236 
237 protected:
239  ~vtkTree() override;
240 
245  bool IsStructureValid(vtkGraph* g) override;
246 
251 
252 private:
253  vtkTree(const vtkTree&) = delete;
254  void operator=(const vtkTree&) = delete;
255 };
256 
257 #endif
vtkTree::IsStructureValid
bool IsStructureValid(vtkGraph *g) override
Check the storage, and accept it if it is a valid tree.
vtkTree::GetData
static vtkTree * GetData(vtkInformationVector *v, int i=0)
Retrieve a graph from an information vector.
vtkTree::GetData
static vtkTree * GetData(vtkInformation *info)
Retrieve a graph from an information vector.
vtkTree::GetParent
vtkIdType GetParent(vtkIdType v)
Get the parent of a vertex.
vtkTree::GetDataObjectType
int GetDataObjectType() override
Return what type of dataset this is.
Definition: vtkTree.h:173
vtkTree::IsLeaf
bool IsLeaf(vtkIdType vertex)
Return whether the vertex is a leaf (i.e.
vtkIdType
int vtkIdType
Definition: vtkType.h:332
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:145
vtkDirectedAcyclicGraph
A rooted tree data structure.
Definition: vtkDirectedAcyclicGraph.h:55
vtkTree::GetChildren
void GetChildren(vtkIdType v, vtkAdjacentVertexIterator *it)
Get the child vertices of a vertex.
Definition: vtkTree.h:197
vtkTree
A rooted tree data structure.
Definition: vtkTree.h:164
vtkEdgeType
Definition: vtkGraph.h:326
vtkTree::GetChild
vtkIdType GetChild(vtkIdType v, vtkIdType i)
Get the i-th child of a parent vertex.
vtkGraph::GetOutDegree
virtual vtkIdType GetOutDegree(vtkIdType v)
The number of outgoing edges from vertex v.
vtkTree::New
static vtkTree * New()
vtkTree::Root
vtkIdType Root
The root of the tree.
Definition: vtkTree.h:250
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkTree::GetLevel
vtkIdType GetLevel(vtkIdType v)
Get the level of the vertex in the tree.
vtkTree::GetParentEdge
vtkEdgeType GetParentEdge(vtkIdType v)
Get the edge connecting the vertex to its parent.
vtkTree::GetNumberOfChildren
vtkIdType GetNumberOfChildren(vtkIdType v)
Get the number of children of a vertex.
Definition: vtkTree.h:185
vtkGraph::GetAdjacentVertices
virtual void GetAdjacentVertices(vtkIdType v, vtkAdjacentVertexIterator *it)
Initializes the adjacent vertex iterator to iterate over all outgoing vertices from vertex v.
vtkAdjacentVertexIterator
Iterates through adjacent vertices in a graph.
Definition: vtkAdjacentVertexIterator.h:64
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:183
vtkX3D::info
@ info
Definition: vtkX3D.h:382
vtkTree::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:145
VTK_TREE
#define VTK_TREE
Definition: vtkType.h:98
vtkTree::ReorderChildren
virtual void ReorderChildren(vtkIdType parent, vtkIdTypeArray *children)
Reorder the children of a parent vertex.
vtkTree::vtkTree
vtkTree()
vtkGraph
Base class for graph data types.
Definition: vtkGraph.h:339
vtkTree::~vtkTree
~vtkTree() override
vtkDirectedAcyclicGraph.h