VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkCutter.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 =========================================================================*/ 00047 #ifndef __vtkCutter_h 00048 #define __vtkCutter_h 00049 00050 #include "vtkPolyDataAlgorithm.h" 00051 00052 #include "vtkContourValues.h" // Needed for inline methods 00053 00054 #define VTK_SORT_BY_VALUE 0 00055 #define VTK_SORT_BY_CELL 1 00056 00057 class vtkImplicitFunction; 00058 class vtkPointLocator; 00059 class vtkSynchronizedTemplates3D; 00060 class vtkSynchronizedTemplatesCutter3D; 00061 class vtkGridSynchronizedTemplates3D; 00062 class vtkRectilinearSynchronizedTemplates; 00063 00064 class VTK_GRAPHICS_EXPORT vtkCutter : public vtkPolyDataAlgorithm 00065 { 00066 public: 00067 vtkTypeRevisionMacro(vtkCutter,vtkPolyDataAlgorithm); 00068 void PrintSelf(ostream& os, vtkIndent indent); 00069 00072 static vtkCutter *New(); 00073 00075 00077 void SetValue(int i, double value) 00078 {this->ContourValues->SetValue(i,value);} 00080 00082 00083 double GetValue(int i) 00084 {return this->ContourValues->GetValue(i);} 00086 00088 00090 double *GetValues() 00091 {return this->ContourValues->GetValues();} 00093 00095 00098 void GetValues(double *contourValues) 00099 {this->ContourValues->GetValues(contourValues);} 00101 00103 00106 void SetNumberOfContours(int number) 00107 {this->ContourValues->SetNumberOfContours(number);} 00109 00111 00112 int GetNumberOfContours() 00113 {return this->ContourValues->GetNumberOfContours();} 00115 00117 00119 void GenerateValues(int numContours, double range[2]) 00120 {this->ContourValues->GenerateValues(numContours, range);} 00122 00124 00126 void GenerateValues(int numContours, double rangeStart, double rangeEnd) 00127 {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);} 00129 00132 unsigned long GetMTime(); 00133 00135 00136 virtual void SetCutFunction(vtkImplicitFunction*); 00137 vtkGetObjectMacro(CutFunction,vtkImplicitFunction); 00139 00141 00144 vtkSetMacro(GenerateCutScalars,int); 00145 vtkGetMacro(GenerateCutScalars,int); 00146 vtkBooleanMacro(GenerateCutScalars,int); 00148 00150 00152 void SetLocator(vtkPointLocator *locator); 00153 vtkGetObjectMacro(Locator,vtkPointLocator); 00155 00157 00167 vtkSetClampMacro(SortBy,int,VTK_SORT_BY_VALUE,VTK_SORT_BY_CELL); 00168 vtkGetMacro(SortBy,int); 00169 void SetSortByToSortByValue() 00170 {this->SetSortBy(VTK_SORT_BY_VALUE);} 00171 void SetSortByToSortByCell() 00172 {this->SetSortBy(VTK_SORT_BY_CELL);} 00173 const char *GetSortByAsString(); 00175 00178 void CreateDefaultLocator(); 00179 00184 static void GetCellTypeDimensions(unsigned char* cellTypeDimensions); 00185 00186 protected: 00187 vtkCutter(vtkImplicitFunction *cf=NULL); 00188 ~vtkCutter(); 00189 00191 00192 virtual int ProcessRequest(vtkInformation*, 00193 vtkInformationVector**, 00194 vtkInformationVector*); 00196 00197 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00198 virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00199 virtual int FillInputPortInformation(int port, vtkInformation *info); 00200 void UnstructuredGridCutter(vtkDataSet *input, vtkPolyData *output); 00201 void DataSetCutter(vtkDataSet *input, vtkPolyData *output); 00202 void StructuredPointsCutter(vtkDataSet *, vtkPolyData *, 00203 vtkInformation *, vtkInformationVector **, 00204 vtkInformationVector *); 00205 void StructuredGridCutter(vtkDataSet *, vtkPolyData *); 00206 void RectilinearGridCutter(vtkDataSet *, vtkPolyData *); 00207 vtkImplicitFunction *CutFunction; 00208 00209 vtkSynchronizedTemplates3D *SynchronizedTemplates3D; 00210 vtkSynchronizedTemplatesCutter3D *SynchronizedTemplatesCutter3D; 00211 vtkGridSynchronizedTemplates3D *GridSynchronizedTemplates; 00212 vtkRectilinearSynchronizedTemplates *RectilinearSynchronizedTemplates; 00213 00214 vtkPointLocator *Locator; 00215 int SortBy; 00216 vtkContourValues *ContourValues; 00217 int GenerateCutScalars; 00218 private: 00219 vtkCutter(const vtkCutter&); // Not implemented. 00220 void operator=(const vtkCutter&); // Not implemented. 00221 }; 00222 00224 inline const char *vtkCutter::GetSortByAsString(void) 00225 { 00226 if ( this->SortBy == VTK_SORT_BY_VALUE ) 00227 { 00228 return "SortByValue"; 00229 } 00230 else 00231 { 00232 return "SortByCell"; 00233 } 00234 } 00235 00236 #endif