Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound 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 =========================================================================*/
00061 #ifndef __vtkBandedPolyDataContourFilter_h
00062 #define __vtkBandedPolyDataContourFilter_h
00063 
00064 #include "vtkPolyDataToPolyDataFilter.h"
00065 
00066 #include "vtkContourValues.h" // Needed for inline methods
00067 
00068 class vtkPoints;
00069 class vtkCellArray;
00070 class vtkPointData;
00071 class vtkDataArray;
00072 class vtkFloatArray;
00073 
00074 #define VTK_SCALAR_MODE_INDEX 0
00075 #define VTK_SCALAR_MODE_VALUE 1
00076 
00077 class VTK_GRAPHICS_EXPORT vtkBandedPolyDataContourFilter : public vtkPolyDataToPolyDataFilter
00078 {
00079 public:
00080   vtkTypeRevisionMacro(vtkBandedPolyDataContourFilter,vtkPolyDataToPolyDataFilter);
00081   void PrintSelf(ostream& os, vtkIndent indent);
00082 
00084   static vtkBandedPolyDataContourFilter *New();
00085 
00087 
00091   void SetValue(int i, float value);
00092   float GetValue(int i);
00093   float *GetValues();
00094   void GetValues(float *contourValues);
00095   void SetNumberOfContours(int number);
00096   int GetNumberOfContours();
00097   void GenerateValues(int numContours, float range[2]);
00098   void GenerateValues(int numContours, float rangeStart, float rangeEnd);
00100 
00102 
00106   vtkSetMacro(Clipping,int);
00107   vtkGetMacro(Clipping,int);
00108   vtkBooleanMacro(Clipping,int);
00110 
00112 
00116   vtkSetClampMacro(ScalarMode,int,VTK_SCALAR_MODE_INDEX,VTK_SCALAR_MODE_VALUE);
00117   vtkGetMacro(ScalarMode,int);
00118   void SetScalarModeToIndex()
00119     {this->SetScalarMode(VTK_SCALAR_MODE_INDEX);}
00120   void SetScalarModeToValue()
00121     {this->SetScalarMode(VTK_SCALAR_MODE_VALUE);}
00123   
00125 
00129   vtkSetMacro(GenerateContourEdges,int);
00130   vtkGetMacro(GenerateContourEdges,int);
00131   vtkBooleanMacro(GenerateContourEdges,int);
00133 
00136   vtkPolyData *GetContourEdgesOutput();
00137 
00140   unsigned long GetMTime();
00141 
00142 protected:
00143   vtkBandedPolyDataContourFilter();
00144   ~vtkBandedPolyDataContourFilter();
00145 
00146   void Execute();
00147 
00148   int ComputeScalarIndex(float);
00149   int IsContourValue(float val);
00150   int ClipEdge(int v1, int v2, vtkPoints *pts, vtkDataArray *scalars,
00151                vtkPointData *inPD, vtkPointData *outPD);
00152   int InsertCell(vtkCellArray *cells, int npts, vtkIdType *pts,
00153                  int cellId, float s, vtkFloatArray *newS);
00154 
00155   // data members
00156   vtkContourValues *ContourValues;
00157 
00158   int Clipping;
00159   int ScalarMode;
00160 
00161   // sorted and cleaned contour values
00162   float *ClipValues;
00163   int   NumberOfClipValues;
00164   int ClipIndex[2]; //indices outside of this range (inclusive) are clipped
00165   float ClipTolerance; //used to clean up numerical problems
00166   
00167   //the second output
00168   int GenerateContourEdges;
00169 
00170   char *InputScalarsSelection;
00171   vtkSetStringMacro(InputScalarsSelection);
00172   
00173 private:
00174   vtkBandedPolyDataContourFilter(const vtkBandedPolyDataContourFilter&);  // Not implemented.
00175   void operator=(const vtkBandedPolyDataContourFilter&);  // Not implemented.
00176 };
00177 
00179 
00181 inline void vtkBandedPolyDataContourFilter::SetValue(int i, float value)
00182   {this->ContourValues->SetValue(i,value);}
00184 
00186 
00187 inline float vtkBandedPolyDataContourFilter::GetValue(int i)
00188   {return this->ContourValues->GetValue(i);}
00190 
00192 
00194 inline float *vtkBandedPolyDataContourFilter::GetValues()
00195   {return this->ContourValues->GetValues();}
00197 
00199 
00202 inline void vtkBandedPolyDataContourFilter::GetValues(float *contourValues)
00203   {this->ContourValues->GetValues(contourValues);}
00205 
00207 
00210 inline void vtkBandedPolyDataContourFilter::SetNumberOfContours(int number)
00211   {this->ContourValues->SetNumberOfContours(number);}
00213 
00215 
00216 inline int vtkBandedPolyDataContourFilter::GetNumberOfContours()
00217   {return this->ContourValues->GetNumberOfContours();}
00219 
00221 
00223 inline void vtkBandedPolyDataContourFilter::GenerateValues(int numContours, 
00224                                                            float range[2])
00225   {this->ContourValues->GenerateValues(numContours, range);}
00227 
00229 
00231 inline void vtkBandedPolyDataContourFilter::GenerateValues(int numContours, 
00232                                                            float rangeStart, 
00233                                                            float rangeEnd)
00234   {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
00236 
00237 
00238 #endif
00239 
00240