VTK
dox/Graphics/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 "vtkPolyDataAlgorithm.h"
00054 
00055 #include "vtkContourValues.h" // Needed for inline methods
00056 
00057 #define VTK_SORT_BY_VALUE 0
00058 #define VTK_SORT_BY_CELL 1
00059 
00060 class vtkImplicitFunction;
00061 class vtkIncrementalPointLocator;
00062 class vtkSynchronizedTemplates3D;
00063 class vtkSynchronizedTemplatesCutter3D;
00064 class vtkGridSynchronizedTemplates3D;
00065 class vtkRectilinearSynchronizedTemplates;
00066 
00067 class VTK_GRAPHICS_EXPORT vtkCutter : public vtkPolyDataAlgorithm
00068 {
00069 public:
00070   vtkTypeMacro(vtkCutter,vtkPolyDataAlgorithm);
00071   void PrintSelf(ostream& os, vtkIndent indent);
00072 
00075   static vtkCutter *New();
00076 
00078 
00080   void SetValue(int i, double value) 
00081     {this->ContourValues->SetValue(i,value);}
00083   
00085 
00086   double GetValue(int i) 
00087     {return this->ContourValues->GetValue(i);}
00089 
00091 
00093   double *GetValues() 
00094     {return this->ContourValues->GetValues();}
00096 
00098 
00101   void GetValues(double *contourValues)
00102     {this->ContourValues->GetValues(contourValues);}
00104   
00106 
00109   void SetNumberOfContours(int number) 
00110     {this->ContourValues->SetNumberOfContours(number);}
00112 
00114 
00115   int GetNumberOfContours() 
00116     {return this->ContourValues->GetNumberOfContours();}
00118 
00120 
00122   void GenerateValues(int numContours, double range[2]) 
00123     {this->ContourValues->GenerateValues(numContours, range);}
00125 
00127 
00129   void GenerateValues(int numContours, double rangeStart, double rangeEnd) 
00130     {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
00132 
00135   unsigned long GetMTime();
00136 
00138 
00139   virtual void SetCutFunction(vtkImplicitFunction*);
00140   vtkGetObjectMacro(CutFunction,vtkImplicitFunction);
00142 
00144 
00147   vtkSetMacro(GenerateCutScalars,int);
00148   vtkGetMacro(GenerateCutScalars,int);
00149   vtkBooleanMacro(GenerateCutScalars,int);
00151 
00153 
00155   void SetLocator(vtkIncrementalPointLocator *locator);
00156   vtkGetObjectMacro(Locator,vtkIncrementalPointLocator);
00158 
00160 
00170   vtkSetClampMacro(SortBy,int,VTK_SORT_BY_VALUE,VTK_SORT_BY_CELL);
00171   vtkGetMacro(SortBy,int);
00172   void SetSortByToSortByValue() 
00173     {this->SetSortBy(VTK_SORT_BY_VALUE);}
00174   void SetSortByToSortByCell() 
00175     {this->SetSortBy(VTK_SORT_BY_CELL);}
00176   const char *GetSortByAsString();
00178 
00181   void CreateDefaultLocator();
00182 
00187   static void GetCellTypeDimensions(unsigned char* cellTypeDimensions);
00188 
00189 protected:
00190   vtkCutter(vtkImplicitFunction *cf=NULL);
00191   ~vtkCutter();
00192 
00194 
00195   virtual int ProcessRequest(vtkInformation*,
00196                              vtkInformationVector**,
00197                              vtkInformationVector*);
00199 
00200   virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00201   virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00202   virtual int FillInputPortInformation(int port, vtkInformation *info);
00203   void UnstructuredGridCutter(vtkDataSet *input, vtkPolyData *output);
00204   void DataSetCutter(vtkDataSet *input, vtkPolyData *output);
00205   void StructuredPointsCutter(vtkDataSet *, vtkPolyData *,
00206                               vtkInformation *, vtkInformationVector **, 
00207                               vtkInformationVector *);
00208   void StructuredGridCutter(vtkDataSet *, vtkPolyData *);
00209   void RectilinearGridCutter(vtkDataSet *, vtkPolyData *);
00210   vtkImplicitFunction *CutFunction;
00211 
00212   vtkSynchronizedTemplates3D *SynchronizedTemplates3D;
00213   vtkSynchronizedTemplatesCutter3D *SynchronizedTemplatesCutter3D;
00214   vtkGridSynchronizedTemplates3D *GridSynchronizedTemplates;
00215   vtkRectilinearSynchronizedTemplates *RectilinearSynchronizedTemplates;
00216 
00217   vtkIncrementalPointLocator *Locator;
00218   int SortBy;
00219   vtkContourValues *ContourValues;
00220   int GenerateCutScalars;
00221 private:
00222   vtkCutter(const vtkCutter&);  // Not implemented.
00223   void operator=(const vtkCutter&);  // Not implemented.
00224 };
00225 
00227 
00228 inline const char *vtkCutter::GetSortByAsString(void)
00229 {
00230   if ( this->SortBy == VTK_SORT_BY_VALUE ) 
00231     {
00232     return "SortByValue";
00233     }
00234   else 
00235     {
00236     return "SortByCell";
00237     }
00238 }
00240 
00241 #endif