VTK  9.4.20241121
vtkDataObjectTreeIterator.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
33#ifndef vtkDataObjectTreeIterator_h
34#define vtkDataObjectTreeIterator_h
35
36#include "vtkCommonDataModelModule.h" // For export macro
38#include "vtkSmartPointer.h" //to store data sets
39
40VTK_ABI_NAMESPACE_BEGIN
44class vtkDataObject;
45class vtkInformation;
46
47class VTKCOMMONDATAMODEL_EXPORT vtkDataObjectTreeIterator : public vtkCompositeDataIterator
48{
49public:
52 void PrintSelf(ostream& os, vtkIndent indent) override;
53
57 void GoToFirstItem() override;
58
62 void GoToNextItem() override;
63
70 int IsDoneWithTraversal() override;
71
76
84
90
96 unsigned int GetCurrentFlatIndex() override;
97
99
109 vtkSetMacro(VisitOnlyLeaves, vtkTypeBool);
110 vtkGetMacro(VisitOnlyLeaves, vtkTypeBool);
111 vtkBooleanMacro(VisitOnlyLeaves, vtkTypeBool);
113
115
120 vtkSetMacro(TraverseSubTree, vtkTypeBool);
121 vtkGetMacro(TraverseSubTree, vtkTypeBool);
122 vtkBooleanMacro(TraverseSubTree, vtkTypeBool);
124
125protected:
128
129 // Use the macro to ensure MTime is updated:
130 vtkSetMacro(CurrentFlatIndex, unsigned int);
131
132 // Takes the current location to the next dataset. This traverses the tree in
133 // preorder fashion.
134 // If the current location is a composite dataset, next is its 1st child dataset.
135 // If the current is not a composite dataset, then next is the next dataset.
136 // This method gives no guarantees whether the current dataset will be
137 // non-null or leaf.
139
144
145 // Needs access to GetCurrentIndex().
146 friend class vtkDataObjectTree;
147 friend class vtkMultiDataSetInternal;
148
149 unsigned int CurrentFlatIndex;
150
151private:
153 void operator=(const vtkDataObjectTreeIterator&) = delete;
154
155 class vtkInternals;
156 vtkInternals* Internals;
157 friend class vtkInternals;
161 static bool IsDataObjectTree(vtkDataObject* dataObject);
162
163 vtkTypeBool TraverseSubTree;
164 vtkTypeBool VisitOnlyLeaves;
165
171
172 // Cannot be called when this->IsDoneWithTraversal() return 1.
173 void UpdateLocation();
174};
175
176VTK_ABI_NAMESPACE_END
177#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.
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.
vtkTypeBool HasCurrentMetaData() override
Returns if the a meta-data information object is present for the current item.
static vtkDataObjectTreeIterator * New()
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:108
Store vtkAlgorithm input/output information.
int vtkTypeBool
Definition vtkABI.h:64