VTK
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 -------------------------------------------------------------------------*/
52 #ifndef vtkTree_h
53 #define vtkTree_h
54 
55 #include "vtkCommonDataModelModule.h" // For export macro
57 
58 class vtkIdTypeArray;
59 
60 class VTKCOMMONDATAMODEL_EXPORT vtkTree : public vtkDirectedAcyclicGraph
61 {
62 public:
63  static vtkTree *New();
65  void PrintSelf(ostream& os, vtkIndent indent) override;
66 
70  int GetDataObjectType() override {return VTK_TREE;}
71 
73 
76  vtkGetMacro(Root, vtkIdType);
78 
83  { return this->GetOutDegree(v); }
84 
88  vtkIdType GetChild(vtkIdType v, vtkIdType i);
89 
96  { this->GetAdjacentVertices(v, it); }
97 
101  vtkIdType GetParent(vtkIdType v);
102 
106  vtkEdgeType GetParentEdge(vtkIdType v);
107 
113  vtkIdType GetLevel(vtkIdType v);
114 
118  bool IsLeaf(vtkIdType vertex);
119 
121 
125  static vtkTree *GetData(vtkInformationVector *v, int i=0);
127 
134  virtual void ReorderChildren(vtkIdType parent, vtkIdTypeArray *children);
135 
136 protected:
137  vtkTree();
138  ~vtkTree() override;
139 
144  bool IsStructureValid(vtkGraph *g) override;
145 
150 
151 private:
152  vtkTree(const vtkTree&) = delete;
153  void operator=(const vtkTree&) = delete;
154 };
155 
156 #endif
vtkTree::GetDataObjectType
int GetDataObjectType() override
Return what type of dataset this is.
Definition: vtkTree.h:70
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkDirectedAcyclicGraph
A rooted tree data structure.
Definition: vtkDirectedAcyclicGraph.h:57
vtkDirectedAcyclicGraph::New
static vtkDirectedAcyclicGraph * New()
vtkTree::GetChildren
void GetChildren(vtkIdType v, vtkAdjacentVertexIterator *it)
Get the child vertices of a vertex.
Definition: vtkTree.h:95
vtkTree
A rooted tree data structure.
Definition: vtkTree.h:60
vtkEdgeType
Definition: vtkGraph.h:276
vtkGraph::GetOutDegree
virtual vtkIdType GetOutDegree(vtkIdType v)
The number of outgoing edges from vertex v.
vtkTree::Root
vtkIdType Root
The root of the tree.
Definition: vtkTree.h:149
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkDirectedAcyclicGraph::GetData
static vtkDirectedAcyclicGraph * GetData(vtkInformation *info)
Retrieve a graph from an information vector.
vtkTree::GetNumberOfChildren
vtkIdType GetNumberOfChildren(vtkIdType v)
Get the number of children of a vertex.
Definition: vtkTree.h:82
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:47
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkX3D::info
Definition: vtkX3D.h:376
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:41
vtkDirectedAcyclicGraph::IsStructureValid
bool IsStructureValid(vtkGraph *g) override
Check the storage, and accept it if it is a valid tree.
VTK_TREE
#define VTK_TREE
Definition: vtkType.h:112
vtkGraph
Base class for graph data types.
Definition: vtkGraph.h:287
vtkDirectedAcyclicGraph.h
vtkDirectedAcyclicGraph::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.