VTK  9.0.1
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 =========================================================================*/
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 class vtkPoints;
50 class vtkCellArray;
51 class vtkPointData;
52 class vtkDataArray;
53 class vtkFloatArray;
54 class vtkDoubleArray;
55 struct vtkBandedPolyDataContourFilterInternals;
56 
57 #define VTK_SCALAR_MODE_INDEX 0
58 #define VTK_SCALAR_MODE_VALUE 1
59 
60 class VTKFILTERSMODELING_EXPORT vtkBandedPolyDataContourFilter : public vtkPolyDataAlgorithm
61 {
62 public:
64  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
70 
72 
78  void SetValue(int i, double value);
79  double GetValue(int i);
80  double* GetValues();
81  void GetValues(double* contourValues);
82  void SetNumberOfContours(int number);
83  vtkIdType GetNumberOfContours();
84  void GenerateValues(int numContours, double range[2]);
85  void GenerateValues(int numContours, double rangeStart, double rangeEnd);
87 
89 
95  vtkSetMacro(Clipping, vtkTypeBool);
96  vtkGetMacro(Clipping, vtkTypeBool);
97  vtkBooleanMacro(Clipping, vtkTypeBool);
99 
101 
107  vtkSetClampMacro(ScalarMode, int, VTK_SCALAR_MODE_INDEX, VTK_SCALAR_MODE_VALUE);
108  vtkGetMacro(ScalarMode, int);
109  void SetScalarModeToIndex() { this->SetScalarMode(VTK_SCALAR_MODE_INDEX); }
110  void SetScalarModeToValue() { this->SetScalarMode(VTK_SCALAR_MODE_VALUE); }
112 
114 
120  vtkSetMacro(GenerateContourEdges, vtkTypeBool);
121  vtkGetMacro(GenerateContourEdges, vtkTypeBool);
122  vtkBooleanMacro(GenerateContourEdges, vtkTypeBool);
124 
126 
132  vtkSetMacro(ClipTolerance, double);
133  vtkGetMacro(ClipTolerance, double);
135 
137 
141  vtkSetMacro(Component, int);
142  vtkGetMacro(Component, int);
144 
150 
155  vtkMTimeType GetMTime() override;
156 
157 protected:
160 
162 
163  int ClipEdge(int v1, int v2, vtkPoints* pts, vtkDataArray* inScalars, vtkDoubleArray* outScalars,
164  vtkPointData* inPD, vtkPointData* outPD, vtkIdType edgePts[]);
166  vtkCellArray* cells, int npts, const vtkIdType* pts, int cellId, double s, vtkFloatArray* newS);
168  vtkCellArray* cells, vtkIdType pt1, vtkIdType pt2, int cellId, double s, vtkFloatArray* newS);
169  int ComputeClippedIndex(double s);
170  int InsertNextScalar(vtkFloatArray* scalars, int cellId, int idx);
171  // data members
173 
177  double ClipTolerance; // specify numerical accuracy during clipping
178  // the second output
180 
181  vtkBandedPolyDataContourFilterInternals* Internal;
182 
183 private:
185  void operator=(const vtkBandedPolyDataContourFilter&) = delete;
186 };
187 
193 {
194  this->ContourValues->SetValue(i, value);
195 }
196 
201 {
202  return this->ContourValues->GetValue(i);
203 }
204 
210 {
211  return this->ContourValues->GetValues();
212 }
213 
219 inline void vtkBandedPolyDataContourFilter::GetValues(double* contourValues)
220 {
221  this->ContourValues->GetValues(contourValues);
222 }
223 
230 {
231  this->ContourValues->SetNumberOfContours(number);
232 }
233 
238 {
239  return this->ContourValues->GetNumberOfContours();
240 }
241 
246 inline void vtkBandedPolyDataContourFilter::GenerateValues(int numContours, double range[2])
247 {
248  this->ContourValues->GenerateValues(numContours, range);
249 }
250 
256  int numContours, double rangeStart, double rangeEnd)
257 {
258  this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
259 }
260 
261 #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.
~vtkBandedPolyDataContourFilter() override
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
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:180
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:50
dynamic, self-adjusting array of double
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:36
a simple class to control print indentation
Definition: vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate point attribute data
Definition: vtkPointData.h:32
represent and manipulate 3D points
Definition: vtkPoints.h:34
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
@ 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:338
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293