VTK  9.7.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
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 
21 VTK_ABI_NAMESPACE_BEGIN
22 class vtkDataObjectTree;
25 class vtkDataObject;
26 class vtkInformation;
27 
28 class VTKCOMMONDATAMODEL_EXPORT vtkDataObjectTreeIterator : public vtkCompositeDataIterator
29 {
30 public:
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 
107 protected:
109  ~vtkDataObjectTreeIterator() override;
110 
114  vtkSetMacro(CurrentFlatIndex, unsigned int);
115 
119  void InitializeInternal();
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  */
129  void NextInternal();
130 
134  vtkDataObjectTreeIndex GetCurrentIndex();
135 
136  // Needs access to GetCurrentIndex().
137  friend class vtkDataObjectTree;
138  friend class vtkMultiDataSetInternal;
139 
140  unsigned int CurrentFlatIndex;
141 
145  static bool IsDataObjectTree(vtkDataObject* dataObject);
146 
147 private:
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 
168 VTK_ABI_NAMESPACE_END
169 #endif
virtual int IsDoneWithTraversal()=0
Test whether the iterator is finished with the traversal.
provides implementation for most abstract methods in the superclass vtkCompositeDataSet ...
Store vtkAlgorithm input/output information.
virtual vtkInformation * GetCurrentMetaData()=0
Returns the meta-data associated with the current item.
virtual void GoToNextItem()=0
Move the iterator to the next item in the collection.
superclass for composite data iterators
int vtkTypeBool
Definition: vtkABI.h:64
virtual void GoToFirstItem()=0
Move the iterator to the beginning of the collection.
a simple class to control print indentation
Definition: vtkIndent.h:28
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual vtkDataObject * GetCurrentDataObject()=0
Returns the current item.
superclass for composite data iterators
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
general representation of visualization data
Definition: vtkDataObject.h:55
virtual unsigned int GetCurrentFlatIndex()=0
Flat index is an index to identify the data in a composite data structure.
virtual vtkTypeBool HasCurrentMetaData()=0
Returns if the a meta-data information object is present for the current item.