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 "vtkPolyDataAlgorithm.h" 00050 00051 #include "vtkContourValues.h" // Needed for inline methods 00052 00053 class vtkPoints; 00054 class vtkCellArray; 00055 class vtkPointData; 00056 class vtkDataArray; 00057 class vtkFloatArray; 00058 class vtkDoubleArray; 00059 00060 #define VTK_SCALAR_MODE_INDEX 0 00061 #define VTK_SCALAR_MODE_VALUE 1 00062 00063 class VTK_GRAPHICS_EXPORT vtkBandedPolyDataContourFilter : public vtkPolyDataAlgorithm 00064 { 00065 public: 00066 vtkTypeMacro(vtkBandedPolyDataContourFilter,vtkPolyDataAlgorithm); 00067 void PrintSelf(ostream& os, vtkIndent indent); 00068 00070 static vtkBandedPolyDataContourFilter *New(); 00071 00073 00077 void SetValue(int i, double value); 00078 double GetValue(int i); 00079 double *GetValues(); 00080 void GetValues(double *contourValues); 00081 void SetNumberOfContours(int number); 00082 int GetNumberOfContours(); 00083 void GenerateValues(int numContours, double range[2]); 00084 void GenerateValues(int numContours, double rangeStart, double rangeEnd); 00086 00088 00092 vtkSetMacro(Clipping,int); 00093 vtkGetMacro(Clipping,int); 00094 vtkBooleanMacro(Clipping,int); 00096 00098 00102 vtkSetClampMacro(ScalarMode,int,VTK_SCALAR_MODE_INDEX,VTK_SCALAR_MODE_VALUE); 00103 vtkGetMacro(ScalarMode,int); 00104 void SetScalarModeToIndex() 00105 {this->SetScalarMode(VTK_SCALAR_MODE_INDEX);} 00106 void SetScalarModeToValue() 00107 {this->SetScalarMode(VTK_SCALAR_MODE_VALUE);} 00109 00111 00115 vtkSetMacro(GenerateContourEdges,int); 00116 vtkGetMacro(GenerateContourEdges,int); 00117 vtkBooleanMacro(GenerateContourEdges,int); 00119 00122 vtkPolyData *GetContourEdgesOutput(); 00123 00126 unsigned long GetMTime(); 00127 00128 protected: 00129 vtkBandedPolyDataContourFilter(); 00130 ~vtkBandedPolyDataContourFilter(); 00131 00132 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00133 00134 int ComputeScalarIndex(double); 00135 int IsContourValue(double val); 00136 int ClipEdge(int v1, int v2, vtkPoints *pts, vtkDataArray *inScalars, 00137 vtkDoubleArray *outScalars, 00138 vtkPointData *inPD, vtkPointData *outPD); 00139 int InsertCell(vtkCellArray *cells, int npts, vtkIdType *pts, 00140 int cellId, double s, vtkFloatArray *newS); 00141 00142 // data members 00143 vtkContourValues *ContourValues; 00144 00145 int Clipping; 00146 int ScalarMode; 00147 00148 // sorted and cleaned contour values 00149 double *ClipValues; 00150 int NumberOfClipValues; 00151 int ClipIndex[2]; //indices outside of this range (inclusive) are clipped 00152 double ClipTolerance; //used to clean up numerical problems 00153 00154 //the second output 00155 int GenerateContourEdges; 00156 00157 private: 00158 vtkBandedPolyDataContourFilter(const vtkBandedPolyDataContourFilter&); // Not implemented. 00159 void operator=(const vtkBandedPolyDataContourFilter&); // Not implemented. 00160 }; 00161 00163 00165 inline void vtkBandedPolyDataContourFilter::SetValue(int i, double value) 00166 {this->ContourValues->SetValue(i,value);} 00168 00170 00171 inline double vtkBandedPolyDataContourFilter::GetValue(int i) 00172 {return this->ContourValues->GetValue(i);} 00174 00176 00178 inline double *vtkBandedPolyDataContourFilter::GetValues() 00179 {return this->ContourValues->GetValues();} 00181 00183 00186 inline void vtkBandedPolyDataContourFilter::GetValues(double *contourValues) 00187 {this->ContourValues->GetValues(contourValues);} 00189 00191 00194 inline void vtkBandedPolyDataContourFilter::SetNumberOfContours(int number) 00195 {this->ContourValues->SetNumberOfContours(number);} 00197 00199 00200 inline int vtkBandedPolyDataContourFilter::GetNumberOfContours() 00201 {return this->ContourValues->GetNumberOfContours();} 00203 00205 00207 inline void vtkBandedPolyDataContourFilter::GenerateValues(int numContours, 00208 double range[2]) 00209 {this->ContourValues->GenerateValues(numContours, range);} 00211 00213 00215 inline void vtkBandedPolyDataContourFilter::GenerateValues(int numContours, 00216 double rangeStart, 00217 double rangeEnd) 00218 {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);} 00220 00221 00222 #endif