VTK  9.3.0
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
23#ifndef vtkDataObjectTreeIterator_h
24#define vtkDataObjectTreeIterator_h
25
26#include "vtkCommonDataModelModule.h" // For export macro
28#include "vtkSmartPointer.h" //to store data sets
29
30VTK_ABI_NAMESPACE_BEGIN
34class vtkDataObject;
35class vtkInformation;
36
37class VTKCOMMONDATAMODEL_EXPORT vtkDataObjectTreeIterator : public vtkCompositeDataIterator
38{
39public:
42 void PrintSelf(ostream& os, vtkIndent indent) override;
43
47 void GoToFirstItem() override;
48
52 void GoToNextItem() override;
53
60 int IsDoneWithTraversal() override;
61
66
74
80
86 unsigned int GetCurrentFlatIndex() override;
87
89
99 vtkSetMacro(VisitOnlyLeaves, vtkTypeBool);
100 vtkGetMacro(VisitOnlyLeaves, vtkTypeBool);
101 vtkBooleanMacro(VisitOnlyLeaves, vtkTypeBool);
103
105
110 vtkSetMacro(TraverseSubTree, vtkTypeBool);
111 vtkGetMacro(TraverseSubTree, vtkTypeBool);
112 vtkBooleanMacro(TraverseSubTree, vtkTypeBool);
114
115protected:
118
119 // Use the macro to ensure MTime is updated:
120 vtkSetMacro(CurrentFlatIndex, unsigned int);
121
122 // Takes the current location to the next dataset. This traverses the tree in
123 // preorder fashion.
124 // If the current location is a composite dataset, next is its 1st child dataset.
125 // If the current is not a composite dataset, then next is the next dataset.
126 // This method gives no guarantees whether the current dataset will be
127 // non-null or leaf.
129
134
135 // Needs access to GetCurrentIndex().
136 friend class vtkDataObjectTree;
137 friend class vtkMultiDataSetInternal;
138
139 unsigned int CurrentFlatIndex;
140
141private:
143 void operator=(const vtkDataObjectTreeIterator&) = delete;
144
145 class vtkInternals;
146 vtkInternals* Internals;
147 friend class vtkInternals;
151 static bool IsDataObjectTree(vtkDataObject* dataObject);
152
153 vtkTypeBool TraverseSubTree;
154 vtkTypeBool VisitOnlyLeaves;
155
161
162 // Cannot be called when this->IsDoneWithTraversal() return 1.
163 void UpdateLocation();
164};
165
166VTK_ABI_NAMESPACE_END
167#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:38
Store vtkAlgorithm input/output information.
int vtkTypeBool
Definition vtkABI.h:64