|
VTK
|
A rooted tree data structure. More...
#include <vtkTree.h>
Inherits vtkDirectedAcyclicGraph.
Public Types | |
| typedef vtkDirectedAcyclicGraph | Superclass |
Public Member Functions | |
| virtual int | IsA (const char *type) |
| vtkTree * | NewInstance () const |
| void | PrintSelf (ostream &os, vtkIndent indent) |
| virtual int | GetDataObjectType () |
| vtkIdType | GetChild (vtkIdType v, vtkIdType i) |
| vtkIdType | GetParent (vtkIdType v) |
| vtkIdType | GetLevel (vtkIdType v) |
| bool | IsLeaf (vtkIdType vertex) |
| virtual void | ReorderChildren (vtkIdType parent, vtkIdTypeArray *children) |
| virtual vtkIdType | GetRoot () |
| vtkIdType | GetNumberOfChildren (vtkIdType v) |
| void | GetChildren (vtkIdType v, vtkAdjacentVertexIterator *it) |
| vtkEdgeType | GetParentEdge (vtkIdType v) |
Static Public Member Functions | |
| static vtkTree * | New () |
| static int | IsTypeOf (const char *type) |
| static vtkTree * | SafeDownCast (vtkObjectBase *o) |
| static vtkTree * | GetData (vtkInformation *info) |
| static vtkTree * | GetData (vtkInformationVector *v, int i=0) |
Protected Member Functions | |
| virtual vtkObjectBase * | NewInstanceInternal () const |
| vtkTree () | |
| ~vtkTree () | |
| virtual bool | IsStructureValid (vtkGraph *g) |
Protected Attributes | |
| vtkIdType | Root |
A rooted tree data structure.
vtkTree is a connected directed graph with no cycles. A tree is a type of directed graph, so works with all graph algorithms.
vtkTree is a read-only data structure. To construct a tree, create an instance of vtkMutableDirectedGraph. Add vertices and edges with AddVertex() and AddEdge(). You may alternately start by adding a single vertex as the root then call graph->AddChild(parent) which adds a new vertex and connects the parent to the child. The tree MUST have all edges in the proper direction, from parent to child. After building the tree, call tree->CheckedShallowCopy(graph) to copy the structure into a vtkTree. This method will return false if the graph is an invalid tree.
vtkTree provides some convenience methods for obtaining the parent and children of a vertex, for finding the root, and determining if a vertex is a leaf (a vertex with no children).
| typedef vtkDirectedAcyclicGraph vtkTree::Superclass |
|
protected |
|
protected |
|
static |
|
static |
|
virtual |
|
static |
|
protectedvirtual |
| vtkTree* vtkTree::NewInstance | ( | ) | const |
| void vtkTree::PrintSelf | ( | ostream & | os, |
| vtkIndent | indent | ||
| ) |
|
inlinevirtual |
|
virtual |
Get the root vertex of the tree.
|
inline |
| vtkEdgeType vtkTree::GetParentEdge | ( | vtkIdType | v | ) |
Get the edge connecting the vertex to its parent.
Get the level of the vertex in the tree. The root vertex has level 0. Returns -1 if the vertex id is < 0 or greater than the number of vertices in the tree.
| bool vtkTree::IsLeaf | ( | vtkIdType | vertex | ) |
Return whether the vertex is a leaf (i.e. it has no children).
|
static |
Retrieve a graph from an information vector.
|
static |
Retrieve a graph from an information vector.
|
virtual |
Reorder the children of a parent vertex. The children array must contain all the children of parent, just in a different order. This does not change the topology of the tree.
|
protectedvirtual |
Check the storage, and accept it if it is a valid tree.
1.8.6