Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkBandedPolyDataContourFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkBandedPolyDataContourFilter.h,v $
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 =========================================================================*/
00057 #ifndef __vtkBandedPolyDataContourFilter_h
00058 #define __vtkBandedPolyDataContourFilter_h
00059 
00060 #include "vtkPolyDataToPolyDataFilter.h"
00061 
00062 #include "vtkContourValues.h" // Needed for inline methods
00063 
00064 class vtkPoints;
00065 class vtkCellArray;
00066 class vtkPointData;
00067 class vtkDataArray;
00068 class vtkFloatArray;
00069 
00070 #define VTK_SCALAR_MODE_INDEX 0
00071 #define VTK_SCALAR_MODE_VALUE 1
00072 
00073 class VTK_GRAPHICS_EXPORT vtkBandedPolyDataContourFilter : public vtkPolyDataToPolyDataFilter
00074 {
00075 public:
00076   vtkTypeRevisionMacro(vtkBandedPolyDataContourFilter,vtkPolyDataToPolyDataFilter);
00077   void PrintSelf(ostream& os, vtkIndent indent);
00078 
00080   static vtkBandedPolyDataContourFilter *New();
00081 
00083 
00087   void SetValue(int i, double value);
00088   double GetValue(int i);
00089   double *GetValues();
00090   void GetValues(double *contourValues);
00091   void SetNumberOfContours(int number);
00092   int GetNumberOfContours();
00093   void GenerateValues(int numContours, double range[2]);
00094   void GenerateValues(int numContours, double rangeStart, double rangeEnd);
00096 
00098 
00102   vtkSetMacro(Clipping,int);
00103   vtkGetMacro(Clipping,int);
00104   vtkBooleanMacro(Clipping,int);
00106 
00108 
00112   vtkSetClampMacro(ScalarMode,int,VTK_SCALAR_MODE_INDEX,VTK_SCALAR_MODE_VALUE);
00113   vtkGetMacro(ScalarMode,int);
00114   void SetScalarModeToIndex()
00115     {this->SetScalarMode(VTK_SCALAR_MODE_INDEX);}
00116   void SetScalarModeToValue()
00117     {this->SetScalarMode(VTK_SCALAR_MODE_VALUE);}
00119   
00121 
00125   vtkSetMacro(GenerateContourEdges,int);
00126   vtkGetMacro(GenerateContourEdges,int);
00127   vtkBooleanMacro(GenerateContourEdges,int);
00129 
00132   vtkPolyData *GetContourEdgesOutput();
00133 
00135 
00138   vtkGetStringMacro(InputScalarsSelection);
00139   void SelectInputScalars(const char *fieldName) 
00140     {this->SetInputScalarsSelection(fieldName);}
00142 
00145   unsigned long GetMTime();
00146 
00147 protected:
00148   vtkBandedPolyDataContourFilter();
00149   ~vtkBandedPolyDataContourFilter();
00150 
00151   void Execute();
00152 
00153   int ComputeScalarIndex(double);
00154   int IsContourValue(double val);
00155   int ClipEdge(int v1, int v2, vtkPoints *pts, vtkDataArray *scalars,
00156                vtkPointData *inPD, vtkPointData *outPD);
00157   int InsertCell(vtkCellArray *cells, int npts, vtkIdType *pts,
00158                  int cellId, double s, vtkFloatArray *newS);
00159 
00160   // data members
00161   vtkContourValues *ContourValues;
00162 
00163   int Clipping;
00164   int ScalarMode;
00165 
00166   // sorted and cleaned contour values
00167   double *ClipValues;
00168   int   NumberOfClipValues;
00169   int ClipIndex[2]; //indices outside of this range (inclusive) are clipped
00170   double ClipTolerance; //used to clean up numerical problems
00171   
00172   //the second output
00173   int GenerateContourEdges;
00174 
00175   char *InputScalarsSelection;
00176   vtkSetStringMacro(InputScalarsSelection);
00177   
00178 private:
00179   vtkBandedPolyDataContourFilter(const vtkBandedPolyDataContourFilter&);  // Not implemented.
00180   void operator=(const vtkBandedPolyDataContourFilter&);  // Not implemented.
00181 };
00182 
00184 
00186 inline void vtkBandedPolyDataContourFilter::SetValue(int i, double value)
00187   {this->ContourValues->SetValue(i,value);}
00189 
00191 
00192 inline double vtkBandedPolyDataContourFilter::GetValue(int i)
00193   {return this->ContourValues->GetValue(i);}
00195 
00197 
00199 inline double *vtkBandedPolyDataContourFilter::GetValues()
00200   {return this->ContourValues->GetValues();}
00202 
00204 
00207 inline void vtkBandedPolyDataContourFilter::GetValues(double *contourValues)
00208   {this->ContourValues->GetValues(contourValues);}
00210 
00212 
00215 inline void vtkBandedPolyDataContourFilter::SetNumberOfContours(int number)
00216   {this->ContourValues->SetNumberOfContours(number);}
00218 
00220 
00221 inline int vtkBandedPolyDataContourFilter::GetNumberOfContours()
00222   {return this->ContourValues->GetNumberOfContours();}
00224 
00226 
00228 inline void vtkBandedPolyDataContourFilter::GenerateValues(int numContours, 
00229                                                            double range[2])
00230   {this->ContourValues->GenerateValues(numContours, range);}
00232 
00234 
00236 inline void vtkBandedPolyDataContourFilter::GenerateValues(int numContours, 
00237                                                            double rangeStart, 
00238                                                            double rangeEnd)
00239   {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
00241 
00242 
00243 #endif
00244 
00245