VTK  9.3.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 
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:
108  ~vtkDataObjectTreeIterator() override;
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 
124  vtkDataObjectTreeIndex GetCurrentIndex();
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
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:54
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.