VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkBandedPolyDataContourFilter.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00046 #ifndef __vtkBandedPolyDataContourFilter_h 00047 #define __vtkBandedPolyDataContourFilter_h 00048 00049 #include "vtkFiltersModelingModule.h" // For export macro 00050 #include "vtkPolyDataAlgorithm.h" 00051 00052 #include "vtkContourValues.h" // Needed for inline methods 00053 00054 class vtkPoints; 00055 class vtkCellArray; 00056 class vtkPointData; 00057 class vtkDataArray; 00058 class vtkFloatArray; 00059 class vtkDoubleArray; 00060 00061 #define VTK_SCALAR_MODE_INDEX 0 00062 #define VTK_SCALAR_MODE_VALUE 1 00063 00064 class VTKFILTERSMODELING_EXPORT vtkBandedPolyDataContourFilter : public vtkPolyDataAlgorithm 00065 { 00066 public: 00067 vtkTypeMacro(vtkBandedPolyDataContourFilter,vtkPolyDataAlgorithm); 00068 void PrintSelf(ostream& os, vtkIndent indent); 00069 00071 static vtkBandedPolyDataContourFilter *New(); 00072 00074 00078 void SetValue(int i, double value); 00079 double GetValue(int i); 00080 double *GetValues(); 00081 void GetValues(double *contourValues); 00082 void SetNumberOfContours(int number); 00083 int GetNumberOfContours(); 00084 void GenerateValues(int numContours, double range[2]); 00085 void GenerateValues(int numContours, double rangeStart, double rangeEnd); 00087 00089 00093 vtkSetMacro(Clipping,int); 00094 vtkGetMacro(Clipping,int); 00095 vtkBooleanMacro(Clipping,int); 00097 00099 00103 vtkSetClampMacro(ScalarMode,int,VTK_SCALAR_MODE_INDEX,VTK_SCALAR_MODE_VALUE); 00104 vtkGetMacro(ScalarMode,int); 00105 void SetScalarModeToIndex() 00106 {this->SetScalarMode(VTK_SCALAR_MODE_INDEX);} 00107 void SetScalarModeToValue() 00108 {this->SetScalarMode(VTK_SCALAR_MODE_VALUE);} 00110 00112 00116 vtkSetMacro(GenerateContourEdges,int); 00117 vtkGetMacro(GenerateContourEdges,int); 00118 vtkBooleanMacro(GenerateContourEdges,int); 00120 00123 vtkPolyData *GetContourEdgesOutput(); 00124 00127 unsigned long GetMTime(); 00128 00129 protected: 00130 vtkBandedPolyDataContourFilter(); 00131 ~vtkBandedPolyDataContourFilter(); 00132 00133 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00134 00135 int ComputeScalarIndex(double); 00136 int IsContourValue(double val); 00137 int ClipEdge(int v1, int v2, vtkPoints *pts, vtkDataArray *inScalars, 00138 vtkDoubleArray *outScalars, 00139 vtkPointData *inPD, vtkPointData *outPD); 00140 int InsertCell(vtkCellArray *cells, int npts, vtkIdType *pts, 00141 int cellId, double s, vtkFloatArray *newS); 00142 00143 // data members 00144 vtkContourValues *ContourValues; 00145 00146 int Clipping; 00147 int ScalarMode; 00148 00149 // sorted and cleaned contour values 00150 double *ClipValues; 00151 int NumberOfClipValues; 00152 int ClipIndex[2]; //indices outside of this range (inclusive) are clipped 00153 double ClipTolerance; //used to clean up numerical problems 00154 00155 //the second output 00156 int GenerateContourEdges; 00157 00158 private: 00159 vtkBandedPolyDataContourFilter(const vtkBandedPolyDataContourFilter&); // Not implemented. 00160 void operator=(const vtkBandedPolyDataContourFilter&); // Not implemented. 00161 }; 00162 00164 00166 inline void vtkBandedPolyDataContourFilter::SetValue(int i, double value) 00167 {this->ContourValues->SetValue(i,value);} 00169 00171 00172 inline double vtkBandedPolyDataContourFilter::GetValue(int i) 00173 {return this->ContourValues->GetValue(i);} 00175 00177 00179 inline double *vtkBandedPolyDataContourFilter::GetValues() 00180 {return this->ContourValues->GetValues();} 00182 00184 00187 inline void vtkBandedPolyDataContourFilter::GetValues(double *contourValues) 00188 {this->ContourValues->GetValues(contourValues);} 00190 00192 00195 inline void vtkBandedPolyDataContourFilter::SetNumberOfContours(int number) 00196 {this->ContourValues->SetNumberOfContours(number);} 00198 00200 00201 inline int vtkBandedPolyDataContourFilter::GetNumberOfContours() 00202 {return this->ContourValues->GetNumberOfContours();} 00204 00206 00208 inline void vtkBandedPolyDataContourFilter::GenerateValues(int numContours, 00209 double range[2]) 00210 {this->ContourValues->GenerateValues(numContours, range);} 00212 00214 00216 inline void vtkBandedPolyDataContourFilter::GenerateValues(int numContours, 00217 double rangeStart, 00218 double rangeEnd) 00219 {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);} 00221 00222 00223 #endif