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 
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 
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 
106 protected:
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.
119  void NextInternal();
120 
125 
126  // Needs access to GetCurrentIndex().
127  friend class vtkDataObjectTree;
128  friend class vtkMultiDataSetInternal;
129 
130  unsigned int CurrentFlatIndex;
131 
132 private:
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 
157 VTK_ABI_NAMESPACE_END
158 #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.
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.
vtkTypeBool HasCurrentMetaData() override
Returns if the a meta-data information object is present for the current item.
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:55
a simple class to control print indentation
Definition: vtkIndent.h:29
Store vtkAlgorithm input/output information.
int vtkTypeBool
Definition: vtkABI.h:64