1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: vtkContourValues.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 vtkContourValues 17 * @brief helper object to manage setting and generating contour values 18 * 19 * vtkContourValues is a general class to manage the creation, generation, 20 * and retrieval of contour values. This class serves as a helper class for 21 * contouring classes, or those classes operating on lists of contour values. 22 * 23 * @sa 24 * vtkContourFilter 25 */ 26 27 #ifndef vtkContourValues_h 28 #define vtkContourValues_h 29 30 #include "vtkCommonMiscModule.h" // For export macro 31 #include "vtkObject.h" 32 33 class vtkDoubleArray; 34 35 class VTKCOMMONMISC_EXPORT vtkContourValues : public vtkObject 36 { 37 public: 38 /** 39 * Construct object with a single contour value at 0.0. 40 */ 41 static vtkContourValues *New(); 42 43 vtkTypeMacro(vtkContourValues,vtkObject); 44 void PrintSelf(ostream& os, vtkIndent indent) override; 45 46 /** 47 * Set the ith contour value. 48 */ 49 void SetValue(int i, double value); 50 51 /** 52 * Get the ith contour value. The return value will be clamped if the 53 * index i is out of range. 54 */ 55 double GetValue(int i); 56 57 /** 58 * Return a pointer to a list of contour values. The contents of the 59 * list will be garbage if the number of contours <= 0. 60 */ 61 double *GetValues(); 62 63 /** 64 * Fill a supplied list with contour values. Make sure you've 65 * allocated memory of size GetNumberOfContours(). 66 */ 67 void GetValues(double *contourValues); 68 69 /** 70 * Set the number of contours to place into the list. You only really 71 * need to use this method to reduce list size. The method SetValue() 72 * will automatically increase list size as needed. 73 */ 74 void SetNumberOfContours(const int number); 75 76 /** 77 * Return the number of contours in the 78 */ 79 int GetNumberOfContours(); 80 81 /** 82 * Generate numContours equally spaced contour values between specified 83 * range. Contour values will include min/max range values. 84 */ 85 void GenerateValues(int numContours, double range[2]); 86 87 /** 88 * Generate numContours equally spaced contour values between specified 89 * range. Contour values will include min/max range values. 90 */ 91 void GenerateValues(int numContours, double rangeStart, double rangeEnd); 92 93 /** 94 * Copy contours. 95 */ 96 void DeepCopy(vtkContourValues* other); 97 98 99 protected: 100 vtkContourValues(); 101 ~vtkContourValues() override; 102 103 vtkDoubleArray *Contours; 104 105 private: 106 vtkContourValues(const vtkContourValues&) = delete; 107 void operator=(const vtkContourValues&) = delete; 108 }; 109 110 #endif 111