VTK  9.2.6
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=========================================================================*/
26#ifndef vtkDataObjectTreeIterator_h
27#define vtkDataObjectTreeIterator_h
28
29#include "vtkCommonDataModelModule.h" // For export macro
31#include "vtkSmartPointer.h" //to store data sets
32
36class vtkDataObject;
37class vtkInformation;
38
39class VTKCOMMONDATAMODEL_EXPORT vtkDataObjectTreeIterator : public vtkCompositeDataIterator
40{
41public:
44 void PrintSelf(ostream& os, vtkIndent indent) override;
45
49 void GoToFirstItem() override;
50
54 void GoToNextItem() override;
55
62 int IsDoneWithTraversal() override;
63
68
76
81 int HasCurrentMetaData() override;
82
88 unsigned int GetCurrentFlatIndex() override;
89
91
101 vtkSetMacro(VisitOnlyLeaves, vtkTypeBool);
102 vtkGetMacro(VisitOnlyLeaves, vtkTypeBool);
103 vtkBooleanMacro(VisitOnlyLeaves, vtkTypeBool);
105
107
112 vtkSetMacro(TraverseSubTree, vtkTypeBool);
113 vtkGetMacro(TraverseSubTree, vtkTypeBool);
114 vtkBooleanMacro(TraverseSubTree, vtkTypeBool);
116
117protected:
120
121 // Use the macro to ensure MTime is updated:
122 vtkSetMacro(CurrentFlatIndex, unsigned int);
123
124 // Takes the current location to the next dataset. This traverses the tree in
125 // preorder fashion.
126 // If the current location is a composite dataset, next is its 1st child dataset.
127 // If the current is not a composite dataset, then next is the next dataset.
128 // This method gives no guarantees whether the current dataset will be
129 // non-null or leaf.
131
136
137 // Needs access to GetCurrentIndex().
138 friend class vtkDataObjectTree;
139 friend class vtkMultiDataSetInternal;
140
141 unsigned int CurrentFlatIndex;
142
143private:
145 void operator=(const vtkDataObjectTreeIterator&) = delete;
146
147 class vtkInternals;
148 vtkInternals* Internals;
149 friend class vtkInternals;
150
151 vtkTypeBool TraverseSubTree;
152 vtkTypeBool VisitOnlyLeaves;
153
159
160 // Cannot be called when this->IsDoneWithTraversal() return 1.
161 void UpdateLocation();
162};
163
164#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
a simple class to control print indentation
Definition vtkIndent.h:40
Store vtkAlgorithm input/output information.
int vtkTypeBool
Definition vtkABI.h:69