VTK
vtkDataObjectTreeIterator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDataObjectTreeIterator.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
26 #ifndef vtkDataObjectTreeIterator_h
27 #define vtkDataObjectTreeIterator_h
28 
29 #include "vtkCommonDataModelModule.h" // For export macro
31 #include "vtkSmartPointer.h" //to store data sets
32 
33 class vtkDataObjectTree;
36 class vtkDataObject;
37 class vtkInformation;
38 
39 class VTKCOMMONDATAMODEL_EXPORT vtkDataObjectTreeIterator : public vtkCompositeDataIterator
40 {
41 public:
44  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
49  void GoToFirstItem() override;
50 
54  void GoToNextItem() override;
55 
62  int IsDoneWithTraversal() override;
63 
68 
76 
81  int HasCurrentMetaData() override;
82 
88  unsigned int GetCurrentFlatIndex() override;
89 
91 
101  vtkSetMacro(VisitOnlyLeaves, vtkTypeBool);
102  vtkGetMacro(VisitOnlyLeaves, vtkTypeBool);
103  vtkBooleanMacro(VisitOnlyLeaves, vtkTypeBool);
105 
107 
112  vtkSetMacro(TraverseSubTree, vtkTypeBool);
113  vtkGetMacro(TraverseSubTree, vtkTypeBool);
114  vtkBooleanMacro(TraverseSubTree, vtkTypeBool);
116 
117 protected:
119  ~vtkDataObjectTreeIterator() override;
120 
121  // Takes the current location to the next dataset. This traverses the tree in
122  // preorder fashion.
123  // If the current location is a composite dataset, next is its 1st child dataset.
124  // If the current is not a composite dataset, then next is the next dataset.
125  // This method gives no guarantees whether the current dataset will be
126  // non-null or leaf.
127  void NextInternal();
128 
132  vtkDataObjectTreeIndex GetCurrentIndex();
133 
134  // Needs access to GetCurrentIndex().
135  friend class vtkDataObjectTree;
136  friend class vtkMultiDataSetInternal;
137 
138  unsigned int CurrentFlatIndex;
139 
140 private:
142  void operator=(const vtkDataObjectTreeIterator&) = delete;
143 
144  class vtkInternals;
145  vtkInternals* Internals;
146  friend class vtkInternals;
147 
148  vtkTypeBool TraverseSubTree;
149  vtkTypeBool VisitOnlyLeaves;
150 
156 
157  // Cannot be called when this->IsDoneWithTraversal() return 1.
158  void UpdateLocation();
159 
160 };
161 
162 #endif
virtual int IsDoneWithTraversal()=0
Test whether the iterator is finished with the traversal.
provides implementation for most abstract methods in the superclass vtkCompositeDataSet ...
Store vtkAlgorithm input/output information.
virtual vtkInformation * GetCurrentMetaData()=0
Returns the meta-data associated with the current item.
virtual int HasCurrentMetaData()=0
Returns if the a meta-data information object is present for the current item.
virtual void GoToNextItem()=0
Move the iterator to the next item in the collection.
superclass for composite data iterators
int vtkTypeBool
Definition: vtkABI.h:69
virtual void GoToFirstItem()=0
Move the iterator to the beginning of the collection.
a simple class to control print indentation
Definition: vtkIndent.h:39
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual vtkDataObject * GetCurrentDataObject()=0
Returns the current item.
superclass for composite data iterators
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
general representation of visualization data
Definition: vtkDataObject.h:64
virtual unsigned int GetCurrentFlatIndex()=0
Flat index is an index to identify the data in a composite data structure.