00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkTree.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 /*------------------------------------------------------------------------- 00016 Copyright 2008 Sandia Corporation. 00017 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00018 the U.S. Government retains certain rights in this software. 00019 -------------------------------------------------------------------------*/ 00051 #ifndef __vtkTree_h 00052 #define __vtkTree_h 00053 00054 #include "vtkDirectedAcyclicGraph.h" 00055 00056 class vtkIdTypeArray; 00057 00058 class VTK_FILTERING_EXPORT vtkTree : public vtkDirectedAcyclicGraph 00059 { 00060 public: 00061 static vtkTree *New(); 00062 vtkTypeMacro(vtkTree, vtkDirectedAcyclicGraph); 00063 void PrintSelf(ostream& os, vtkIndent indent); 00064 00066 virtual int GetDataObjectType() {return VTK_TREE;} 00067 00069 00070 vtkGetMacro(Root, vtkIdType); 00072 00074 00075 vtkIdType GetNumberOfChildren(vtkIdType v) 00076 { return this->GetOutDegree(v); } 00078 00080 vtkIdType GetChild(vtkIdType v, vtkIdType i); 00081 00083 00085 void GetChildren(vtkIdType v, vtkAdjacentVertexIterator *it) 00086 { this->GetAdjacentVertices(v, it); } 00088 00090 vtkIdType GetParent(vtkIdType v); 00091 00093 vtkEdgeType GetParentEdge(vtkIdType v); 00094 //ETX 00095 00099 vtkIdType GetLevel(vtkIdType v); 00100 00102 bool IsLeaf(vtkIdType vertex); 00103 00104 //BTX 00106 00107 static vtkTree *GetData(vtkInformation *info); 00108 static vtkTree *GetData(vtkInformationVector *v, int i=0); 00109 //ETX 00111 00115 virtual void ReorderChildren(vtkIdType parent, vtkIdTypeArray *children); 00116 00117 protected: 00118 vtkTree(); 00119 ~vtkTree(); 00120 00122 virtual bool IsStructureValid(vtkGraph *g); 00123 00125 vtkIdType Root; 00126 00127 private: 00128 vtkTree(const vtkTree&); // Not implemented. 00129 void operator=(const vtkTree&); // Not implemented. 00130 }; 00131 00132 #endif