VTK
dox/Common/DataModel/vtkTree.h
Go to the documentation of this file.
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 "vtkCommonDataModelModule.h" // For export macro
00055 #include "vtkDirectedAcyclicGraph.h"
00056 
00057 class vtkIdTypeArray;
00058 
00059 class VTKCOMMONDATAMODEL_EXPORT vtkTree : public vtkDirectedAcyclicGraph
00060 {
00061 public:
00062   static vtkTree *New();
00063   vtkTypeMacro(vtkTree, vtkDirectedAcyclicGraph);
00064   void PrintSelf(ostream& os, vtkIndent indent);
00065 
00067   virtual int GetDataObjectType() {return VTK_TREE;}
00068 
00070 
00071   vtkGetMacro(Root, vtkIdType);
00073 
00075 
00076   vtkIdType GetNumberOfChildren(vtkIdType v)
00077     { return this->GetOutDegree(v); }
00079 
00081   vtkIdType GetChild(vtkIdType v, vtkIdType i);
00082 
00084 
00086   void GetChildren(vtkIdType v, vtkAdjacentVertexIterator *it)
00087     { this->GetAdjacentVertices(v, it); }
00089 
00091   vtkIdType GetParent(vtkIdType v);
00092 
00093 //BTX
00095 
00096   vtkEdgeType GetParentEdge(vtkIdType v);
00097 //ETX
00099 
00103   vtkIdType GetLevel(vtkIdType v);
00104 
00106   bool IsLeaf(vtkIdType vertex);
00107 
00108   //BTX
00110 
00111   static vtkTree *GetData(vtkInformation *info);
00112   static vtkTree *GetData(vtkInformationVector *v, int i=0);
00113   //ETX
00115 
00119   virtual void ReorderChildren(vtkIdType parent, vtkIdTypeArray *children);
00120 
00121 protected:
00122   vtkTree();
00123   ~vtkTree();
00124 
00126   virtual bool IsStructureValid(vtkGraph *g);
00127 
00129   vtkIdType Root;
00130 
00131 private:
00132   vtkTree(const vtkTree&);  // Not implemented.
00133   void operator=(const vtkTree&);  // Not implemented.
00134 };
00135 
00136 #endif