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   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00050 #ifndef __vtkBandedPolyDataContourFilter_h
00051 #define __vtkBandedPolyDataContourFilter_h
00052 
00053 #include "vtkPolyDataToPolyDataFilter.h"
00054 
00055 #include "vtkContourValues.h" // Needed for inline methods
00056 
00057 class vtkPoints;
00058 class vtkCellArray;
00059 class vtkPointData;
00060 class vtkDataArray;
00061 class vtkFloatArray;
00062 
00063 #define VTK_SCALAR_MODE_INDEX 0
00064 #define VTK_SCALAR_MODE_VALUE 1
00065 
00066 class VTK_GRAPHICS_EXPORT vtkBandedPolyDataContourFilter : public vtkPolyDataToPolyDataFilter
00067 {
00068 public:
00069   vtkTypeRevisionMacro(vtkBandedPolyDataContourFilter,vtkPolyDataToPolyDataFilter);
00070   void PrintSelf(ostream& os, vtkIndent indent);
00071 
00073   static vtkBandedPolyDataContourFilter *New();
00074 
00076 
00080   void SetValue(int i, float value);
00081   float GetValue(int i);
00082   float *GetValues();
00083   void GetValues(float *contourValues);
00084   void SetNumberOfContours(int number);
00085   int GetNumberOfContours();
00086   void GenerateValues(int numContours, float range[2]);
00087   void GenerateValues(int numContours, float rangeStart, float rangeEnd);
00089 
00091 
00095   vtkSetMacro(Clipping,int);
00096   vtkGetMacro(Clipping,int);
00097   vtkBooleanMacro(Clipping,int);
00099 
00101 
00105   vtkSetClampMacro(ScalarMode,int,VTK_SCALAR_MODE_INDEX,VTK_SCALAR_MODE_VALUE);
00106   vtkGetMacro(ScalarMode,int);
00107   void SetScalarModeToIndex()
00108     {this->SetScalarMode(VTK_SCALAR_MODE_INDEX);}
00109   void SetScalarModeToValue()
00110     {this->SetScalarMode(VTK_SCALAR_MODE_VALUE);}
00112   
00114 
00118   vtkSetMacro(GenerateContourEdges,int);
00119   vtkGetMacro(GenerateContourEdges,int);
00120   vtkBooleanMacro(GenerateContourEdges,int);
00122 
00125   vtkPolyData *GetContourEdgesOutput();
00126 
00129   unsigned long GetMTime();
00130 
00131 protected:
00132   vtkBandedPolyDataContourFilter();
00133   ~vtkBandedPolyDataContourFilter();
00134 
00135   void Execute();
00136 
00137   int ComputeScalarIndex(float);
00138   int IsContourValue(float val);
00139   int ClipEdge(int v1, int v2, vtkPoints *pts, vtkDataArray *scalars,
00140                vtkPointData *inPD, vtkPointData *outPD);
00141   int InsertCell(vtkCellArray *cells, int npts, vtkIdType *pts,
00142                  int cellId, float s, vtkFloatArray *newS);
00143 
00144   // data members
00145   vtkContourValues *ContourValues;
00146 
00147   int Clipping;
00148   int ScalarMode;
00149 
00150   // sorted and cleaned contour values
00151   float *ClipValues;
00152   int   NumberOfClipValues;
00153   int ClipIndex[2]; //indices outside of this range (inclusive) are clipped
00154   float ClipTolerance; //used to clean up numerical problems
00155   
00156   //the second output
00157   int GenerateContourEdges;
00158 
00159   char *InputScalarsSelection;
00160   vtkSetStringMacro(InputScalarsSelection);
00161   
00162 private:
00163   vtkBandedPolyDataContourFilter(const vtkBandedPolyDataContourFilter&);  // Not implemented.
00164   void operator=(const vtkBandedPolyDataContourFilter&);  // Not implemented.
00165 };
00166 
00168 
00170 inline void vtkBandedPolyDataContourFilter::SetValue(int i, float value)
00171   {this->ContourValues->SetValue(i,value);}
00173 
00175 
00176 inline float vtkBandedPolyDataContourFilter::GetValue(int i)
00177   {return this->ContourValues->GetValue(i);}
00179 
00181 
00183 inline float *vtkBandedPolyDataContourFilter::GetValues()
00184   {return this->ContourValues->GetValues();}
00186 
00188 
00191 inline void vtkBandedPolyDataContourFilter::GetValues(float *contourValues)
00192   {this->ContourValues->GetValues(contourValues);}
00194 
00196 
00199 inline void vtkBandedPolyDataContourFilter::SetNumberOfContours(int number)
00200   {this->ContourValues->SetNumberOfContours(number);}
00202 
00204 
00205 inline int vtkBandedPolyDataContourFilter::GetNumberOfContours()
00206   {return this->ContourValues->GetNumberOfContours();}
00208 
00210 
00212 inline void vtkBandedPolyDataContourFilter::GenerateValues(int numContours, 
00213                                                            float range[2])
00214   {this->ContourValues->GenerateValues(numContours, range);}
00216 
00218 
00220 inline void vtkBandedPolyDataContourFilter::GenerateValues(int numContours, 
00221                                                            float rangeStart, 
00222                                                            float rangeEnd)
00223   {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
00225 
00226 
00227 #endif
00228 
00229