VTK  9.1.0
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=========================================================================*/
32#ifndef vtkDataObjectTreeIterator_h
33#define vtkDataObjectTreeIterator_h
34
35#include "vtkCommonDataModelModule.h" // For export macro
37#include "vtkSmartPointer.h" //to store data sets
38
42class vtkDataObject;
43class vtkInformation;
44
45class VTKCOMMONDATAMODEL_EXPORT vtkDataObjectTreeIterator : public vtkCompositeDataIterator
46{
47public:
50 void PrintSelf(ostream& os, vtkIndent indent) override;
51
55 void GoToFirstItem() override;
56
60 void GoToNextItem() override;
61
68 int IsDoneWithTraversal() override;
69
74
82
87 int HasCurrentMetaData() override;
88
94 unsigned int GetCurrentFlatIndex() override;
95
97
107 vtkSetMacro(VisitOnlyLeaves, vtkTypeBool);
108 vtkGetMacro(VisitOnlyLeaves, vtkTypeBool);
109 vtkBooleanMacro(VisitOnlyLeaves, vtkTypeBool);
111
113
118 vtkSetMacro(TraverseSubTree, vtkTypeBool);
119 vtkGetMacro(TraverseSubTree, vtkTypeBool);
120 vtkBooleanMacro(TraverseSubTree, vtkTypeBool);
122
123protected:
126
127 // Use the macro to ensure MTime is updated:
128 vtkSetMacro(CurrentFlatIndex, unsigned int);
129
130 // Takes the current location to the next dataset. This traverses the tree in
131 // preorder fashion.
132 // If the current location is a composite dataset, next is its 1st child dataset.
133 // If the current is not a composite dataset, then next is the next dataset.
134 // This method gives no guarantees whether the current dataset will be
135 // non-null or leaf.
137
142
143 // Needs access to GetCurrentIndex().
144 friend class vtkDataObjectTree;
145 friend class vtkMultiDataSetInternal;
146
147 unsigned int CurrentFlatIndex;
148
149private:
151 void operator=(const vtkDataObjectTreeIterator&) = delete;
152
153 class vtkInternals;
154 vtkInternals* Internals;
155 friend class vtkInternals;
156
157 vtkTypeBool TraverseSubTree;
158 vtkTypeBool VisitOnlyLeaves;
159
165
166 // Cannot be called when this->IsDoneWithTraversal() return 1.
167 void UpdateLocation();
168};
169
170#endif
superclass for composite data iterators
superclass for composite data iterators
vtkDataObject * GetCurrentDataObject() override
Returns the current item.
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.
~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.
static vtkDataObjectTreeIterator * New()
provides implementation for most abstract methods in the superclass vtkCompositeDataSet
general representation of visualization data
Definition: vtkDataObject.h:69
a simple class to control print indentation
Definition: vtkIndent.h:43
Store vtkAlgorithm input/output information.
int vtkTypeBool
Definition: vtkABI.h:69