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
14#ifndef vtkDataObjectTreeIterator_h
15#define vtkDataObjectTreeIterator_h
16
17#include "vtkCommonDataModelModule.h" // For export macro
19#include "vtkSmartPointer.h" //to store data sets
20
21VTK_ABI_NAMESPACE_BEGIN
25class vtkDataObject;
26class vtkInformation;
27
28class VTKCOMMONDATAMODEL_EXPORT vtkDataObjectTreeIterator : public vtkCompositeDataIterator
29{
30public:
33 void PrintSelf(ostream& os, vtkIndent indent) override;
34
38 void GoToFirstItem() override;
39
43 void GoToNextItem() override;
44
51 int IsDoneWithTraversal() override;
52
57
65
71
77 unsigned int GetCurrentFlatIndex() override;
78
80
90 vtkSetMacro(VisitOnlyLeaves, vtkTypeBool);
91 vtkGetMacro(VisitOnlyLeaves, vtkTypeBool);
92 vtkBooleanMacro(VisitOnlyLeaves, vtkTypeBool);
94
96
101 vtkSetMacro(TraverseSubTree, vtkTypeBool);
102 vtkGetMacro(TraverseSubTree, vtkTypeBool);
103 vtkBooleanMacro(TraverseSubTree, vtkTypeBool);
105
106protected:
109
110 // Use the macro to ensure MTime is updated:
111 vtkSetMacro(CurrentFlatIndex, unsigned int);
112
113 // Takes the current location to the next dataset. This traverses the tree in
114 // preorder fashion.
115 // If the current location is a composite dataset, next is its 1st child dataset.
116 // If the current is not a composite dataset, then next is the next dataset.
117 // This method gives no guarantees whether the current dataset will be
118 // non-null or leaf.
120
125
126 // Needs access to GetCurrentIndex().
127 friend class vtkDataObjectTree;
128 friend class vtkMultiDataSetInternal;
129
130 unsigned int CurrentFlatIndex;
131
132private:
134 void operator=(const vtkDataObjectTreeIterator&) = delete;
135
136 class vtkInternals;
137 vtkInternals* Internals;
138 friend class vtkInternals;
142 static bool IsDataObjectTree(vtkDataObject* dataObject);
143
144 vtkTypeBool TraverseSubTree;
145 vtkTypeBool VisitOnlyLeaves;
146
152
153 // Cannot be called when this->IsDoneWithTraversal() return 1.
154 void UpdateLocation();
155};
156
157VTK_ABI_NAMESPACE_END
158#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:29
Store vtkAlgorithm input/output information.
int vtkTypeBool
Definition vtkABI.h:64