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 //ETX 00092 00096 vtkIdType GetLevel(vtkIdType v); 00097 00099 bool IsLeaf(vtkIdType vertex); 00100 00101 //BTX 00103 00104 static vtkTree *GetData(vtkInformation *info); 00105 static vtkTree *GetData(vtkInformationVector *v, int i=0); 00106 //ETX 00108 00112 virtual void ReorderChildren(vtkIdType parent, vtkIdTypeArray *children); 00113 00114 protected: 00115 vtkTree(); 00116 ~vtkTree(); 00117 00119 virtual bool IsStructureValid(vtkGraph *g); 00120 00122 vtkIdType Root; 00123 00124 private: 00125 vtkTree(const vtkTree&); // Not implemented. 00126 void operator=(const vtkTree&); // Not implemented. 00127 }; 00128 00129 #endif