VTK  9.2.6
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 =========================================================================*/
45 #ifndef vtkDataObjectTreeIterator_h
46 #define vtkDataObjectTreeIterator_h
47 
48 #include "vtkCommonDataModelModule.h" // For export macro
50 #include "vtkSmartPointer.h" //to store data sets
51 
52 class vtkDataObjectTree;
55 class vtkDataObject;
56 class vtkInformation;
57 
58 class VTKCOMMONDATAMODEL_EXPORT vtkDataObjectTreeIterator : public vtkCompositeDataIterator
59 {
60 public:
63  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
68  void GoToFirstItem() override;
69 
73  void GoToNextItem() override;
74 
81  int IsDoneWithTraversal() override;
82 
87 
95 
100  int HasCurrentMetaData() override;
101 
107  unsigned int GetCurrentFlatIndex() override;
108 
110 
120  vtkSetMacro(VisitOnlyLeaves, vtkTypeBool);
121  vtkGetMacro(VisitOnlyLeaves, vtkTypeBool);
122  vtkBooleanMacro(VisitOnlyLeaves, vtkTypeBool);
124 
126 
131  vtkSetMacro(TraverseSubTree, vtkTypeBool);
132  vtkGetMacro(TraverseSubTree, vtkTypeBool);
133  vtkBooleanMacro(TraverseSubTree, vtkTypeBool);
135 
136 protected:
139 
140  // Use the macro to ensure MTime is updated:
141  vtkSetMacro(CurrentFlatIndex, unsigned int);
142 
143  // Takes the current location to the next dataset. This traverses the tree in
144  // preorder fashion.
145  // If the current location is a composite dataset, next is its 1st child dataset.
146  // If the current is not a composite dataset, then next is the next dataset.
147  // This method gives no guarantees whether the current dataset will be
148  // non-null or leaf.
149  void NextInternal();
150 
155 
156  // Needs access to GetCurrentIndex().
157  friend class vtkDataObjectTree;
158  friend class vtkMultiDataSetInternal;
159 
160  unsigned int CurrentFlatIndex;
161 
162 private:
164  void operator=(const vtkDataObjectTreeIterator&) = delete;
165 
166  class vtkInternals;
167  vtkInternals* Internals;
168  friend class vtkInternals;
169 
170  vtkTypeBool TraverseSubTree;
171  vtkTypeBool VisitOnlyLeaves;
172 
178 
179  // Cannot be called when this->IsDoneWithTraversal() return 1.
180  void UpdateLocation();
181 };
182 
183 #endif
superclass for composite data iterators
superclass for composite data iterators
int IsDoneWithTraversal() override
Test whether the iterator is finished with the traversal.
vtkInformation * GetCurrentMetaData() override
Returns the meta-data associated with the current item.
int HasCurrentMetaData() override
Returns if the a meta-data information object is present for the current item.
void GoToFirstItem() override
Move the iterator to the beginning of the collection.
static vtkDataObjectTreeIterator * New()
~vtkDataObjectTreeIterator() override
void GoToNextItem() override
Move the iterator to the next item in the collection.
vtkDataObjectTreeIndex GetCurrentIndex()
Returns the index for the current data object.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
unsigned int GetCurrentFlatIndex() override
Flat index is an index obtained by traversing the tree in preorder.
vtkDataObject * GetCurrentDataObject() override
Returns the current item.
provides implementation for most abstract methods in the superclass vtkCompositeDataSet
general representation of visualization data
a simple class to control print indentation
Definition: vtkIndent.h:119
Store vtkAlgorithm input/output information.
int vtkTypeBool
Definition: vtkABI.h:69