00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkTree.h,v $ 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 -------------------------------------------------------------------------*/ 00048 #ifndef __vtkTree_h 00049 #define __vtkTree_h 00050 00051 #include "vtkDirectedAcyclicGraph.h" 00052 00053 class vtkIdTypeArray; 00054 00055 class VTK_FILTERING_EXPORT vtkTree : public vtkDirectedAcyclicGraph 00056 { 00057 public: 00058 static vtkTree *New(); 00059 vtkTypeRevisionMacro(vtkTree, vtkDirectedAcyclicGraph); 00060 void PrintSelf(ostream& os, vtkIndent indent); 00061 00063 virtual int GetDataObjectType() {return VTK_TREE;} 00064 00066 00067 vtkGetMacro(Root, vtkIdType); 00069 00071 00072 vtkIdType GetNumberOfChildren(vtkIdType v) 00073 { return this->GetOutDegree(v); } 00075 00077 vtkIdType GetChild(vtkIdType v, vtkIdType i); 00078 00080 00082 void GetChildren(vtkIdType v, vtkAdjacentVertexIterator *it) 00083 { this->GetAdjacentVertices(v, it); } 00085 00087 vtkIdType GetParent(vtkIdType v); 00088 00090 vtkEdgeType GetParentEdge(vtkIdType v); 00091 00095 vtkIdType GetLevel(vtkIdType v); 00096 00098 bool IsLeaf(vtkIdType vertex); 00099 00100 //BTX 00102 00103 static vtkTree *GetData(vtkInformation *info); 00104 static vtkTree *GetData(vtkInformationVector *v, int i=0); 00105 //ETX 00107 00111 virtual void ReorderChildren(vtkIdType parent, vtkIdTypeArray *children); 00112 00113 protected: 00114 vtkTree(); 00115 ~vtkTree(); 00116 00118 virtual bool IsStructureValid(vtkGraph *g); 00119 00121 vtkIdType Root; 00122 00123 private: 00124 vtkTree(const vtkTree&); // Not implemented. 00125 void operator=(const vtkTree&); // Not implemented. 00126 }; 00127 00128 #endif