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

Graphics/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 =========================================================================*/
00046 #ifndef __vtkBandedPolyDataContourFilter_h
00047 #define __vtkBandedPolyDataContourFilter_h
00048 
00049 #include "vtkPolyDataToPolyDataFilter.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 
00059 #define VTK_SCALAR_MODE_INDEX 0
00060 #define VTK_SCALAR_MODE_VALUE 1
00061 
00062 class VTK_GRAPHICS_EXPORT vtkBandedPolyDataContourFilter : public vtkPolyDataToPolyDataFilter
00063 {
00064 public:
00065   vtkTypeRevisionMacro(vtkBandedPolyDataContourFilter,vtkPolyDataToPolyDataFilter);
00066   void PrintSelf(ostream& os, vtkIndent indent);
00067 
00069   static vtkBandedPolyDataContourFilter *New();
00070 
00072 
00076   void SetValue(int i, double value);
00077   double GetValue(int i);
00078   double *GetValues();
00079   void GetValues(double *contourValues);
00080   void SetNumberOfContours(int number);
00081   int GetNumberOfContours();
00082   void GenerateValues(int numContours, double range[2]);
00083   void GenerateValues(int numContours, double rangeStart, double rangeEnd);
00085 
00087 
00091   vtkSetMacro(Clipping,int);
00092   vtkGetMacro(Clipping,int);
00093   vtkBooleanMacro(Clipping,int);
00095 
00097 
00101   vtkSetClampMacro(ScalarMode,int,VTK_SCALAR_MODE_INDEX,VTK_SCALAR_MODE_VALUE);
00102   vtkGetMacro(ScalarMode,int);
00103   void SetScalarModeToIndex()
00104     {this->SetScalarMode(VTK_SCALAR_MODE_INDEX);}
00105   void SetScalarModeToValue()
00106     {this->SetScalarMode(VTK_SCALAR_MODE_VALUE);}
00108   
00110 
00114   vtkSetMacro(GenerateContourEdges,int);
00115   vtkGetMacro(GenerateContourEdges,int);
00116   vtkBooleanMacro(GenerateContourEdges,int);
00118 
00121   vtkPolyData *GetContourEdgesOutput();
00122 
00124 
00127   vtkGetStringMacro(InputScalarsSelection);
00128   void SelectInputScalars(const char *fieldName) 
00129     {this->SetInputScalarsSelection(fieldName);}
00131 
00134   unsigned long GetMTime();
00135 
00136 protected:
00137   vtkBandedPolyDataContourFilter();
00138   ~vtkBandedPolyDataContourFilter();
00139 
00140   void Execute();
00141 
00142   int ComputeScalarIndex(double);
00143   int IsContourValue(double val);
00144   int ClipEdge(int v1, int v2, vtkPoints *pts, vtkDataArray *scalars,
00145                vtkPointData *inPD, vtkPointData *outPD);
00146   int InsertCell(vtkCellArray *cells, int npts, vtkIdType *pts,
00147                  int cellId, double s, vtkFloatArray *newS);
00148 
00149   // data members
00150   vtkContourValues *ContourValues;
00151 
00152   int Clipping;
00153   int ScalarMode;
00154 
00155   // sorted and cleaned contour values
00156   double *ClipValues;
00157   int   NumberOfClipValues;
00158   int ClipIndex[2]; //indices outside of this range (inclusive) are clipped
00159   double ClipTolerance; //used to clean up numerical problems
00160   
00161   //the second output
00162   int GenerateContourEdges;
00163 
00164   char *InputScalarsSelection;
00165   vtkSetStringMacro(InputScalarsSelection);
00166   
00167 private:
00168   vtkBandedPolyDataContourFilter(const vtkBandedPolyDataContourFilter&);  // Not implemented.
00169   void operator=(const vtkBandedPolyDataContourFilter&);  // Not implemented.
00170 };
00171 
00173 
00175 inline void vtkBandedPolyDataContourFilter::SetValue(int i, double value)
00176   {this->ContourValues->SetValue(i,value);}
00178 
00180 
00181 inline double vtkBandedPolyDataContourFilter::GetValue(int i)
00182   {return this->ContourValues->GetValue(i);}
00184 
00186 
00188 inline double *vtkBandedPolyDataContourFilter::GetValues()
00189   {return this->ContourValues->GetValues();}
00191 
00193 
00196 inline void vtkBandedPolyDataContourFilter::GetValues(double *contourValues)
00197   {this->ContourValues->GetValues(contourValues);}
00199 
00201 
00204 inline void vtkBandedPolyDataContourFilter::SetNumberOfContours(int number)
00205   {this->ContourValues->SetNumberOfContours(number);}
00207 
00209 
00210 inline int vtkBandedPolyDataContourFilter::GetNumberOfContours()
00211   {return this->ContourValues->GetNumberOfContours();}
00213 
00215 
00217 inline void vtkBandedPolyDataContourFilter::GenerateValues(int numContours, 
00218                                                            double range[2])
00219   {this->ContourValues->GenerateValues(numContours, range);}
00221 
00223 
00225 inline void vtkBandedPolyDataContourFilter::GenerateValues(int numContours, 
00226                                                            double rangeStart, 
00227                                                            double rangeEnd)
00228   {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
00230 
00231 
00232 #endif
00233 
00234