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 00092 //BTX 00094 00095 vtkEdgeType GetParentEdge(vtkIdType v); 00096 //ETX 00098 00102 vtkIdType GetLevel(vtkIdType v); 00103 00105 bool IsLeaf(vtkIdType vertex); 00106 00107 //BTX 00109 00110 static vtkTree *GetData(vtkInformation *info); 00111 static vtkTree *GetData(vtkInformationVector *v, int i=0); 00112 //ETX 00114 00118 virtual void ReorderChildren(vtkIdType parent, vtkIdTypeArray *children); 00119 00120 protected: 00121 vtkTree(); 00122 ~vtkTree(); 00123 00125 virtual bool IsStructureValid(vtkGraph *g); 00126 00128 vtkIdType Root; 00129 00130 private: 00131 vtkTree(const vtkTree&); // Not implemented. 00132 void operator=(const vtkTree&); // Not implemented. 00133 }; 00134 00135 #endif