VTK
dox/Filters/Core/vtkCutter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkCutter.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 =========================================================================*/
00050 #ifndef __vtkCutter_h
00051 #define __vtkCutter_h
00052 
00053 #include "vtkFiltersCoreModule.h" // For export macro
00054 #include "vtkPolyDataAlgorithm.h"
00055 
00056 #include "vtkContourValues.h" // Needed for inline methods
00057 
00058 #define VTK_SORT_BY_VALUE 0
00059 #define VTK_SORT_BY_CELL 1
00060 
00061 class vtkImplicitFunction;
00062 class vtkIncrementalPointLocator;
00063 class vtkSynchronizedTemplates3D;
00064 class vtkSynchronizedTemplatesCutter3D;
00065 class vtkGridSynchronizedTemplates3D;
00066 class vtkRectilinearSynchronizedTemplates;
00067 
00068 class VTKFILTERSCORE_EXPORT vtkCutter : public vtkPolyDataAlgorithm
00069 {
00070 public:
00071   vtkTypeMacro(vtkCutter,vtkPolyDataAlgorithm);
00072   void PrintSelf(ostream& os, vtkIndent indent);
00073 
00076   static vtkCutter *New();
00077 
00079 
00081   void SetValue(int i, double value)
00082     {this->ContourValues->SetValue(i,value);}
00084 
00086 
00087   double GetValue(int i)
00088     {return this->ContourValues->GetValue(i);}
00090 
00092 
00094   double *GetValues()
00095     {return this->ContourValues->GetValues();}
00097 
00099 
00102   void GetValues(double *contourValues)
00103     {this->ContourValues->GetValues(contourValues);}
00105 
00107 
00110   void SetNumberOfContours(int number)
00111     {this->ContourValues->SetNumberOfContours(number);}
00113 
00115 
00116   int GetNumberOfContours()
00117     {return this->ContourValues->GetNumberOfContours();}
00119 
00121 
00123   void GenerateValues(int numContours, double range[2])
00124     {this->ContourValues->GenerateValues(numContours, range);}
00126 
00128 
00130   void GenerateValues(int numContours, double rangeStart, double rangeEnd)
00131     {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
00133 
00136   unsigned long GetMTime();
00137 
00139 
00140   virtual void SetCutFunction(vtkImplicitFunction*);
00141   vtkGetObjectMacro(CutFunction,vtkImplicitFunction);
00143 
00145 
00148   vtkSetMacro(GenerateCutScalars,int);
00149   vtkGetMacro(GenerateCutScalars,int);
00150   vtkBooleanMacro(GenerateCutScalars,int);
00152 
00154 
00158   vtkSetMacro(GenerateTriangles,int);
00159   vtkGetMacro(GenerateTriangles,int);
00160   vtkBooleanMacro(GenerateTriangles,int);
00162 
00164 
00166   void SetLocator(vtkIncrementalPointLocator *locator);
00167   vtkGetObjectMacro(Locator,vtkIncrementalPointLocator);
00169 
00171 
00181   vtkSetClampMacro(SortBy,int,VTK_SORT_BY_VALUE,VTK_SORT_BY_CELL);
00182   vtkGetMacro(SortBy,int);
00183   void SetSortByToSortByValue()
00184     {this->SetSortBy(VTK_SORT_BY_VALUE);}
00185   void SetSortByToSortByCell()
00186     {this->SetSortBy(VTK_SORT_BY_CELL);}
00187   const char *GetSortByAsString();
00189 
00192   void CreateDefaultLocator();
00193 
00198   static void GetCellTypeDimensions(unsigned char* cellTypeDimensions);
00199 
00201 
00204   vtkSetClampMacro(OutputPointsPrecision, int, SINGLE_PRECISION, DEFAULT_PRECISION);
00205   vtkGetMacro(OutputPointsPrecision, int);
00207 
00208 protected:
00209   vtkCutter(vtkImplicitFunction *cf=NULL);
00210   ~vtkCutter();
00211 
00213 
00214   virtual int ProcessRequest(vtkInformation*,
00215                              vtkInformationVector**,
00216                              vtkInformationVector*);
00218 
00219   virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00220   virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00221   virtual int FillInputPortInformation(int port, vtkInformation *info);
00222   void UnstructuredGridCutter(vtkDataSet *input, vtkPolyData *output);
00223   void DataSetCutter(vtkDataSet *input, vtkPolyData *output);
00224   void StructuredPointsCutter(vtkDataSet *, vtkPolyData *,
00225                               vtkInformation *, vtkInformationVector **,
00226                               vtkInformationVector *);
00227   void StructuredGridCutter(vtkDataSet *, vtkPolyData *);
00228   void RectilinearGridCutter(vtkDataSet *, vtkPolyData *);
00229   vtkImplicitFunction *CutFunction;
00230   int GenerateTriangles;
00231 
00232   vtkSynchronizedTemplates3D *SynchronizedTemplates3D;
00233   vtkSynchronizedTemplatesCutter3D *SynchronizedTemplatesCutter3D;
00234   vtkGridSynchronizedTemplates3D *GridSynchronizedTemplates;
00235   vtkRectilinearSynchronizedTemplates *RectilinearSynchronizedTemplates;
00236 
00237   vtkIncrementalPointLocator *Locator;
00238   int SortBy;
00239   vtkContourValues *ContourValues;
00240   int GenerateCutScalars;
00241   int OutputPointsPrecision;
00242 private:
00243   vtkCutter(const vtkCutter&);  // Not implemented.
00244   void operator=(const vtkCutter&);  // Not implemented.
00245 };
00246 
00248 
00249 inline const char *vtkCutter::GetSortByAsString(void)
00250 {
00251   if ( this->SortBy == VTK_SORT_BY_VALUE )
00252     {
00253     return "SortByValue";
00254     }
00255   else
00256     {
00257     return "SortByCell";
00258     }
00259 }
00261 
00262 #endif