VTK  9.6.1
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
13
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
78 unsigned int GetCurrentFlatIndex() override;
79
81
91 vtkSetMacro(VisitOnlyLeaves, vtkTypeBool);
92 vtkGetMacro(VisitOnlyLeaves, vtkTypeBool);
93 vtkBooleanMacro(VisitOnlyLeaves, vtkTypeBool);
95
97
102 vtkSetMacro(TraverseSubTree, vtkTypeBool);
103 vtkGetMacro(TraverseSubTree, vtkTypeBool);
104 vtkBooleanMacro(TraverseSubTree, vtkTypeBool);
106
107protected:
110
114 vtkSetMacro(CurrentFlatIndex, unsigned int);
115
120
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.
128 */
130
135
136 // Needs access to GetCurrentIndex().
137 friend class vtkDataObjectTree;
139
140 unsigned int CurrentFlatIndex;
141
145 static bool IsDataObjectTree(vtkDataObject* dataObject);
146
147private:
149 void operator=(const vtkDataObjectTreeIterator&) = delete;
150
151 class vtkInternals;
152 vtkInternals* Internals;
153 friend class vtkInternals;
154
155 vtkTypeBool TraverseSubTree;
156 vtkTypeBool VisitOnlyLeaves;
157
163
164 // Cannot be called when this->IsDoneWithTraversal() return 1.
165 void UpdateLocation();
166};
167
168VTK_ABI_NAMESPACE_END
169#endif
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.
void InitializeInternal()
Set FlatIndex to zero and Initialize internal fields.
~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 bool IsDataObjectTree(vtkDataObject *dataObject)
Used to improve the speed of vtkDataObjectTree::SafeDownCast().
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