VTK  9.3.0
vtkBandedPolyDataContourFilter.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
41 #ifndef vtkBandedPolyDataContourFilter_h
42 #define vtkBandedPolyDataContourFilter_h
43 
44 #include "vtkFiltersModelingModule.h" // For export macro
45 #include "vtkPolyDataAlgorithm.h"
46 
47 #include "vtkContourValues.h" // Needed for inline methods
48 
49 VTK_ABI_NAMESPACE_BEGIN
50 class vtkPoints;
51 class vtkCellArray;
52 class vtkPointData;
53 class vtkDataArray;
54 class vtkFloatArray;
55 class vtkDoubleArray;
56 struct vtkBandedPolyDataContourFilterInternals;
57 
58 #define VTK_SCALAR_MODE_INDEX 0
59 #define VTK_SCALAR_MODE_VALUE 1
60 
61 class VTKFILTERSMODELING_EXPORT vtkBandedPolyDataContourFilter : public vtkPolyDataAlgorithm
62 {
63 public:
65  void PrintSelf(ostream& os, vtkIndent indent) override;
66 
71 
73 
79  void SetValue(int i, double value);
80  double GetValue(int i);
81  double* GetValues();
82  void GetValues(double* contourValues);
83  void SetNumberOfContours(int number);
84  vtkIdType GetNumberOfContours();
85  void GenerateValues(int numContours, double range[2]);
86  void GenerateValues(int numContours, double rangeStart, double rangeEnd);
88 
90 
96  vtkSetMacro(Clipping, vtkTypeBool);
97  vtkGetMacro(Clipping, vtkTypeBool);
98  vtkBooleanMacro(Clipping, vtkTypeBool);
100 
102 
108  vtkSetClampMacro(ScalarMode, int, VTK_SCALAR_MODE_INDEX, VTK_SCALAR_MODE_VALUE);
109  vtkGetMacro(ScalarMode, int);
110  void SetScalarModeToIndex() { this->SetScalarMode(VTK_SCALAR_MODE_INDEX); }
111  void SetScalarModeToValue() { this->SetScalarMode(VTK_SCALAR_MODE_VALUE); }
113 
115 
121  vtkSetMacro(GenerateContourEdges, vtkTypeBool);
122  vtkGetMacro(GenerateContourEdges, vtkTypeBool);
123  vtkBooleanMacro(GenerateContourEdges, vtkTypeBool);
125 
127 
133  vtkSetMacro(ClipTolerance, double);
134  vtkGetMacro(ClipTolerance, double);
136 
138 
142  vtkSetMacro(Component, int);
143  vtkGetMacro(Component, int);
145 
151 
156  vtkMTimeType GetMTime() override;
157 
158 protected:
161 
163 
164  int ClipEdge(int v1, int v2, vtkPoints* pts, vtkDataArray* inScalars, vtkDoubleArray* outScalars,
165  vtkPointData* inPD, vtkPointData* outPD, vtkIdType edgePts[]);
167  vtkCellArray* cells, int npts, const vtkIdType* pts, int cellId, double s, vtkFloatArray* newS);
169  vtkCellArray* cells, vtkIdType pt1, vtkIdType pt2, int cellId, double s, vtkFloatArray* newS);
170  int ComputeClippedIndex(double s);
171  int InsertNextScalar(vtkFloatArray* scalars, int cellId, int idx);
172  // data members
174 
178  double ClipTolerance; // specify numerical accuracy during clipping
179  // the second output
181 
182  vtkBandedPolyDataContourFilterInternals* Internal;
183 
184 private:
186  void operator=(const vtkBandedPolyDataContourFilter&) = delete;
187 };
188 
194 {
195  this->ContourValues->SetValue(i, value);
196 }
197 
202 {
203  return this->ContourValues->GetValue(i);
204 }
205 
211 {
212  return this->ContourValues->GetValues();
213 }
214 
220 inline void vtkBandedPolyDataContourFilter::GetValues(double* contourValues)
221 {
222  this->ContourValues->GetValues(contourValues);
223 }
224 
231 {
232  this->ContourValues->SetNumberOfContours(number);
233 }
234 
239 {
240  return this->ContourValues->GetNumberOfContours();
241 }
242 
247 inline void vtkBandedPolyDataContourFilter::GenerateValues(int numContours, double range[2])
248 {
249  this->ContourValues->GenerateValues(numContours, range);
250 }
251 
257  int numContours, double rangeStart, double rangeEnd)
258 {
259  this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
260 }
261 
262 VTK_ABI_NAMESPACE_END
263 #endif
generate filled contours for vtkPolyData
vtkMTimeType GetMTime() override
Overload GetMTime because we delegate to vtkContourValues so its modified time must be taken into acc...
double * GetValues()
Get a pointer to an array of contour values.
double GetValue(int i)
Get the ith contour value.
int InsertLine(vtkCellArray *cells, vtkIdType pt1, vtkIdType pt2, int cellId, double s, vtkFloatArray *newS)
int InsertCell(vtkCellArray *cells, int npts, const vtkIdType *pts, int cellId, double s, vtkFloatArray *newS)
vtkPolyData * GetContourEdgesOutput()
Get the second output which contains the edges dividing the contour bands.
static vtkBandedPolyDataContourFilter * New()
Construct object with no contours defined.
vtkSmartPointer< vtkContourValues > ContourValues
void SetScalarModeToIndex()
Control whether the cell scalars are output as an integer index or a scalar value.
~vtkBandedPolyDataContourFilter() override
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
void SetScalarModeToValue()
Control whether the cell scalars are output as an integer index or a scalar value.
int InsertNextScalar(vtkFloatArray *scalars, int cellId, int idx)
int ClipEdge(int v1, int v2, vtkPoints *pts, vtkDataArray *inScalars, vtkDoubleArray *outScalars, vtkPointData *inPD, vtkPointData *outPD, vtkIdType edgePts[])
void SetValue(int i, double value)
Methods to set / get contour values.
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkBandedPolyDataContourFilterInternals * Internal
vtkIdType GetNumberOfContours()
Get the number of contours in the list of contour values.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
object to represent cell connectivity
Definition: vtkCellArray.h:185
int GetNumberOfContours()
Return the number of contours in the.
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
void SetValue(int i, double value)
Set the ith contour value.
double GetValue(int i)
Get the ith contour value.
double * GetValues()
Return a pointer to a list of contour values.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
dynamic, self-adjusting array of double
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:40
a simple class to control print indentation
Definition: vtkIndent.h:38
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate point attribute data
Definition: vtkPointData.h:39
represent and manipulate 3D points
Definition: vtkPoints.h:38
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:89
@ value
Definition: vtkX3D.h:220
@ range
Definition: vtkX3D.h:238
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_SCALAR_MODE_VALUE
#define VTK_SCALAR_MODE_INDEX
int vtkIdType
Definition: vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270