VTK  9.0.1
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 =========================================================================*/
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 
30 class vtkDataObjectTree;
33 class vtkDataObject;
34 class vtkInformation;
35 
36 class VTKCOMMONDATAMODEL_EXPORT vtkDataObjectTreeIterator : public vtkCompositeDataIterator
37 {
38 public:
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
46  void GoToFirstItem() override;
47 
51  void GoToNextItem() override;
52 
59  int IsDoneWithTraversal() override;
60 
65 
73 
78  int HasCurrentMetaData() override;
79 
85  unsigned int GetCurrentFlatIndex() override;
86 
88 
98  vtkSetMacro(VisitOnlyLeaves, vtkTypeBool);
99  vtkGetMacro(VisitOnlyLeaves, vtkTypeBool);
100  vtkBooleanMacro(VisitOnlyLeaves, vtkTypeBool);
102 
104 
109  vtkSetMacro(TraverseSubTree, vtkTypeBool);
110  vtkGetMacro(TraverseSubTree, vtkTypeBool);
111  vtkBooleanMacro(TraverseSubTree, vtkTypeBool);
113 
114 protected:
117 
118  // Use the macro to ensure MTime is updated:
119  vtkSetMacro(CurrentFlatIndex, unsigned int);
120 
121  // Takes the current location to the next dataset. This traverses the tree in
122  // preorder fashion.
123  // If the current location is a composite dataset, next is its 1st child dataset.
124  // If the current is not a composite dataset, then next is the next dataset.
125  // This method gives no guarantees whether the current dataset will be
126  // non-null or leaf.
127  void NextInternal();
128 
133 
134  // Needs access to GetCurrentIndex().
135  friend class vtkDataObjectTree;
136  friend class vtkMultiDataSetInternal;
137 
138  unsigned int CurrentFlatIndex;
139 
140 private:
142  void operator=(const vtkDataObjectTreeIterator&) = delete;
143 
144  class vtkInternals;
145  vtkInternals* Internals;
146  friend class vtkInternals;
147 
148  vtkTypeBool TraverseSubTree;
149  vtkTypeBool VisitOnlyLeaves;
150 
156 
157  // Cannot be called when this->IsDoneWithTraversal() return 1.
158  void UpdateLocation();
159 };
160 
161 #endif
superclass for composite data iterators
superclass for composite data iterators
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.
static vtkDataObjectTreeIterator * New()
~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.
vtkDataObject * GetCurrentDataObject() override
Returns the current item.
provides implementation for most abstract methods in the superclass vtkCompositeDataSet
general representation of visualization data
Definition: vtkDataObject.h:60
a simple class to control print indentation
Definition: vtkIndent.h:34
Store vtkAlgorithm input/output information.
int vtkTypeBool
Definition: vtkABI.h:69