1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: vtkGenericPointIterator.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 =========================================================================*/ 15 /** 16 * @class vtkGenericPointIterator 17 * @brief iterator used to traverse points 18 * 19 * This class (and subclasses) are used to iterate over points. Use it 20 * only in conjunction with vtkGenericDataSet (i.e., the adaptor framework). 21 * 22 * Typical use is: 23 * <pre> 24 * vtkGenericDataSet *dataset; 25 * vtkGenericPointIterator *it = dataset->NewPointIterator(); 26 * for (it->Begin(); !it->IsAtEnd(); it->Next()); 27 * { 28 * x=it->GetPosition(); 29 * } 30 * </pre> 31 */ 32 33 #ifndef vtkGenericPointIterator_h 34 #define vtkGenericPointIterator_h 35 36 #include "vtkCommonDataModelModule.h" // For export macro 37 #include "vtkObject.h" 38 39 class VTKCOMMONDATAMODEL_EXPORT vtkGenericPointIterator : public vtkObject 40 { 41 public: 42 ///@{ 43 /** 44 * Standard VTK construction and type macros. 45 */ 46 vtkTypeMacro(vtkGenericPointIterator, vtkObject); 47 void PrintSelf(ostream& os, vtkIndent indent) override; 48 ///@} 49 50 /** 51 * Move iterator to first position if any (loop initialization). 52 */ 53 virtual void Begin() = 0; 54 55 /** 56 * Is the iterator at the end of traversal? 57 */ 58 virtual vtkTypeBool IsAtEnd() = 0; 59 60 /** 61 * Move the iterator to the next position in the list. 62 * \pre not_off: !IsAtEnd() 63 */ 64 virtual void Next() = 0; 65 66 /** 67 * Get the coordinates of the point at the current iterator position. 68 * \pre not_off: !IsAtEnd() 69 * \post result_exists: result!=0 70 */ 71 virtual double* GetPosition() = 0; 72 73 /** 74 * Get the coordinates of the point at the current iterator position. 75 * \pre not_off: !IsAtEnd() 76 * \pre x_exists: x!=0 77 */ 78 virtual void GetPosition(double x[3]) = 0; 79 80 /** 81 * Return the unique identifier for the point, could be non-contiguous. 82 * \pre not_off: !IsAtEnd() 83 */ 84 virtual vtkIdType GetId() = 0; 85 86 protected: 87 ///@{ 88 /** 89 * Destructor. 90 */ 91 vtkGenericPointIterator(); 92 ~vtkGenericPointIterator() override; 93 ///@} 94 95 private: 96 vtkGenericPointIterator(const vtkGenericPointIterator&) = delete; 97 void operator=(const vtkGenericPointIterator&) = delete; 98 }; 99 100 #endif 101