VTK  9.2.5
vtkBandedPolyDataContourFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBandedPolyDataContourFilter.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 =========================================================================*/
113 #ifndef vtkBandedPolyDataContourFilter_h
114 #define vtkBandedPolyDataContourFilter_h
115 
116 #include "vtkFiltersModelingModule.h" // For export macro
117 #include "vtkPolyDataAlgorithm.h"
118 
119 #include "vtkContourValues.h" // Needed for inline methods
120 
121 class vtkPoints;
122 class vtkCellArray;
123 class vtkPointData;
124 class vtkDataArray;
125 class vtkFloatArray;
126 class vtkDoubleArray;
127 struct vtkBandedPolyDataContourFilterInternals;
128 
129 #define VTK_SCALAR_MODE_INDEX 0
130 #define VTK_SCALAR_MODE_VALUE 1
131 
132 class VTKFILTERSMODELING_EXPORT vtkBandedPolyDataContourFilter : public vtkPolyDataAlgorithm
133 {
134 public:
136  void PrintSelf(ostream& os, vtkIndent indent) override;
137 
142 
144 
150  void SetValue(int i, double value);
151  double GetValue(int i);
152  double* GetValues();
153  void GetValues(double* contourValues);
154  void SetNumberOfContours(int number);
155  vtkIdType GetNumberOfContours();
156  void GenerateValues(int numContours, double range[2]);
157  void GenerateValues(int numContours, double rangeStart, double rangeEnd);
159 
161 
167  vtkSetMacro(Clipping, vtkTypeBool);
168  vtkGetMacro(Clipping, vtkTypeBool);
169  vtkBooleanMacro(Clipping, vtkTypeBool);
171 
173 
179  vtkSetClampMacro(ScalarMode, int, VTK_SCALAR_MODE_INDEX, VTK_SCALAR_MODE_VALUE);
180  vtkGetMacro(ScalarMode, int);
181  void SetScalarModeToIndex() { this->SetScalarMode(VTK_SCALAR_MODE_INDEX); }
182  void SetScalarModeToValue() { this->SetScalarMode(VTK_SCALAR_MODE_VALUE); }
184 
186 
192  vtkSetMacro(GenerateContourEdges, vtkTypeBool);
193  vtkGetMacro(GenerateContourEdges, vtkTypeBool);
194  vtkBooleanMacro(GenerateContourEdges, vtkTypeBool);
196 
198 
204  vtkSetMacro(ClipTolerance, double);
205  vtkGetMacro(ClipTolerance, double);
207 
209 
213  vtkSetMacro(Component, int);
214  vtkGetMacro(Component, int);
216 
222 
227  vtkMTimeType GetMTime() override;
228 
229 protected:
232 
234 
235  int ClipEdge(int v1, int v2, vtkPoints* pts, vtkDataArray* inScalars, vtkDoubleArray* outScalars,
236  vtkPointData* inPD, vtkPointData* outPD, vtkIdType edgePts[]);
238  vtkCellArray* cells, int npts, const vtkIdType* pts, int cellId, double s, vtkFloatArray* newS);
240  vtkCellArray* cells, vtkIdType pt1, vtkIdType pt2, int cellId, double s, vtkFloatArray* newS);
241  int ComputeClippedIndex(double s);
242  int InsertNextScalar(vtkFloatArray* scalars, int cellId, int idx);
243  // data members
245 
249  double ClipTolerance; // specify numerical accuracy during clipping
250  // the second output
252 
253  vtkBandedPolyDataContourFilterInternals* Internal;
254 
255 private:
257  void operator=(const vtkBandedPolyDataContourFilter&) = delete;
258 };
259 
265 {
266  this->ContourValues->SetValue(i, value);
267 }
268 
273 {
274  return this->ContourValues->GetValue(i);
275 }
276 
282 {
283  return this->ContourValues->GetValues();
284 }
285 
291 inline void vtkBandedPolyDataContourFilter::GetValues(double* contourValues)
292 {
293  this->ContourValues->GetValues(contourValues);
294 }
295 
302 {
303  this->ContourValues->SetNumberOfContours(number);
304 }
305 
310 {
311  return this->ContourValues->GetNumberOfContours();
312 }
313 
318 inline void vtkBandedPolyDataContourFilter::GenerateValues(int numContours, double range[2])
319 {
320  this->ContourValues->GenerateValues(numContours, range);
321 }
322 
328  int numContours, double rangeStart, double rangeEnd)
329 {
330  this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
331 }
332 
333 #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.
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:296
helper object to manage setting and generating contour values
int GetNumberOfContours()
Return the number of contours in the.
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
void SetNumberOfContours(const int number)
Set the number of contours to place into the list.
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:165
dynamic, self-adjusting array of double
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate point attribute data
Definition: vtkPointData.h:151
represent and manipulate 3D points
Definition: vtkPoints.h:149
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
@ value
Definition: vtkX3D.h:226
@ range
Definition: vtkX3D.h:244
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_SCALAR_MODE_VALUE
#define VTK_SCALAR_MODE_INDEX
int vtkIdType
Definition: vtkType.h:332
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287