VTK  9.2.5
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 -------------------------------------------------------------------------*/
161 #ifndef vtkTree_h
162 #define vtkTree_h
163 
164 #include "vtkCommonDataModelModule.h" // For export macro
165 #include "vtkDirectedAcyclicGraph.h"
166 
167 class vtkIdTypeArray;
168 
169 class VTKCOMMONDATAMODEL_EXPORT vtkTree : public vtkDirectedAcyclicGraph
170 {
171 public:
172  static vtkTree* New();
174  void PrintSelf(ostream& os, vtkIndent indent) override;
175 
179  int GetDataObjectType() override { return VTK_TREE; }
180 
182 
185  vtkGetMacro(Root, vtkIdType);
187 
192 
197 
204 
209 
214 
221 
225  bool IsLeaf(vtkIdType vertex);
226 
228 
232  static vtkTree* GetData(vtkInformationVector* v, int i = 0);
234 
241  virtual void ReorderChildren(vtkIdType parent, vtkIdTypeArray* children);
242 
243 protected:
245  ~vtkTree() override;
246 
251  bool IsStructureValid(vtkGraph* g) override;
252 
257 
258 private:
259  vtkTree(const vtkTree&) = delete;
260  void operator=(const vtkTree&) = delete;
261 };
262 
263 #endif
Iterates through adjacent vertices in a graph.
A rooted tree data structure.
Base class for graph data types.
Definition: vtkGraph.h:345
virtual vtkIdType GetOutDegree(vtkIdType v)
The number of outgoing edges from vertex v.
virtual void GetAdjacentVertices(vtkIdType v, vtkAdjacentVertexIterator *it)
Initializes the adjacent vertex iterator to iterate over all outgoing vertices from vertex v.
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
A rooted tree data structure.
Definition: vtkTree.h:170
vtkIdType GetChild(vtkIdType v, vtkIdType i)
Get the i-th child of a parent vertex.
bool IsStructureValid(vtkGraph *g) override
Check the storage, and accept it if it is a valid tree.
static vtkTree * GetData(vtkInformation *info)
Retrieve a graph from an information vector.
vtkIdType GetNumberOfChildren(vtkIdType v)
Get the number of children of a vertex.
Definition: vtkTree.h:191
virtual void ReorderChildren(vtkIdType parent, vtkIdTypeArray *children)
Reorder the children of a parent vertex.
vtkEdgeType GetParentEdge(vtkIdType v)
Get the edge connecting the vertex to its parent.
static vtkTree * New()
void GetChildren(vtkIdType v, vtkAdjacentVertexIterator *it)
Get the child vertices of a vertex.
Definition: vtkTree.h:203
static vtkTree * GetData(vtkInformationVector *v, int i=0)
Retrieve a graph from an information vector.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdType Root
The root of the tree.
Definition: vtkTree.h:256
vtkIdType GetParent(vtkIdType v)
Get the parent of a vertex.
int GetDataObjectType() override
Return what type of dataset this is.
Definition: vtkTree.h:179
vtkIdType GetLevel(vtkIdType v)
Get the level of the vertex in the tree.
bool IsLeaf(vtkIdType vertex)
Return whether the vertex is a leaf (i.e.
~vtkTree() override
@ info
Definition: vtkX3D.h:382
int vtkIdType
Definition: vtkType.h:332
#define VTK_TREE
Definition: vtkType.h:98