VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkDataObjectToDataSetFilter.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 =========================================================================*/ 00070 #ifndef __vtkDataObjectToDataSetFilter_h 00071 #define __vtkDataObjectToDataSetFilter_h 00072 00073 #include "vtkDataSetAlgorithm.h" 00074 00075 class vtkCellArray; 00076 class vtkDataArray; 00077 class vtkDataSet; 00078 class vtkPointSet; 00079 class vtkPolyData; 00080 class vtkRectilinearGrid; 00081 class vtkStructuredGrid; 00082 class vtkStructuredPoints; 00083 class vtkUnstructuredGrid; 00084 00085 class VTK_GRAPHICS_EXPORT vtkDataObjectToDataSetFilter : public vtkDataSetAlgorithm 00086 { 00087 public: 00088 static vtkDataObjectToDataSetFilter *New(); 00089 vtkTypeMacro(vtkDataObjectToDataSetFilter,vtkDataSetAlgorithm); 00090 void PrintSelf(ostream& os, vtkIndent indent); 00091 00093 vtkDataObject *GetInput(); 00094 00096 00097 void SetDataSetType(int); 00098 vtkGetMacro(DataSetType,int); 00099 void SetDataSetTypeToPolyData() { 00100 this->SetDataSetType(VTK_POLY_DATA);}; 00101 void SetDataSetTypeToStructuredPoints() { 00102 this->SetDataSetType(VTK_STRUCTURED_POINTS);}; 00103 void SetDataSetTypeToStructuredGrid() { 00104 this->SetDataSetType(VTK_STRUCTURED_GRID);}; 00105 void SetDataSetTypeToRectilinearGrid() { 00106 this->SetDataSetType(VTK_RECTILINEAR_GRID);}; 00107 void SetDataSetTypeToUnstructuredGrid() { 00108 this->SetDataSetType(VTK_UNSTRUCTURED_GRID);}; 00110 00112 00117 vtkDataSet *GetOutput(); 00118 vtkDataSet *GetOutput(int idx); 00119 vtkPolyData *GetPolyDataOutput(); 00120 vtkStructuredPoints *GetStructuredPointsOutput(); 00121 vtkStructuredGrid *GetStructuredGridOutput(); 00122 vtkUnstructuredGrid *GetUnstructuredGridOutput(); 00123 vtkRectilinearGrid *GetRectilinearGridOutput(); 00125 00127 00138 void SetPointComponent(int comp, char *arrayName, int arrayComp, 00139 int min, int max, int normalize); 00140 void SetPointComponent(int comp, char *arrayName, int arrayComp) 00141 {this->SetPointComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);}; 00142 const char *GetPointComponentArrayName(int comp); 00143 int GetPointComponentArrayComponent(int comp); 00144 int GetPointComponentMinRange(int comp); 00145 int GetPointComponentMaxRange(int comp); 00146 int GetPointComponentNormailzeFlag(int comp); 00148 00150 00157 void SetVertsComponent(char *arrayName, int arrayComp, int min, int max); 00158 void SetVertsComponent(char *arrayName, int arrayComp) 00159 {this->SetVertsComponent(arrayName, arrayComp, -1, -1);}; 00160 const char *GetVertsComponentArrayName(); 00161 int GetVertsComponentArrayComponent(); 00162 int GetVertsComponentMinRange(); 00163 int GetVertsComponentMaxRange(); 00164 void SetLinesComponent(char *arrayName, int arrayComp, int min, int max); 00165 void SetLinesComponent(char *arrayName, int arrayComp) 00166 {this->SetLinesComponent(arrayName, arrayComp, -1, -1);}; 00167 const char *GetLinesComponentArrayName(); 00168 int GetLinesComponentArrayComponent(); 00169 int GetLinesComponentMinRange(); 00170 int GetLinesComponentMaxRange(); 00171 void SetPolysComponent(char *arrayName, int arrayComp, int min, int max); 00172 void SetPolysComponent(char *arrayName, int arrayComp) 00173 {this->SetPolysComponent(arrayName, arrayComp, -1, -1);}; 00174 const char *GetPolysComponentArrayName(); 00175 int GetPolysComponentArrayComponent(); 00176 int GetPolysComponentMinRange(); 00177 int GetPolysComponentMaxRange(); 00178 void SetStripsComponent(char *arrayName, int arrayComp, int min, int max); 00179 void SetStripsComponent(char *arrayName, int arrayComp) 00180 {this->SetStripsComponent(arrayName, arrayComp, -1, -1);}; 00181 const char *GetStripsComponentArrayName(); 00182 int GetStripsComponentArrayComponent(); 00183 int GetStripsComponentMinRange(); 00184 int GetStripsComponentMaxRange(); 00186 00188 00195 void SetCellTypeComponent(char *arrayName, int arrayComp, 00196 int min, int max); 00197 void SetCellTypeComponent(char *arrayName, int arrayComp) 00198 {this->SetCellTypeComponent(arrayName, arrayComp, -1, -1);}; 00199 const char *GetCellTypeComponentArrayName(); 00200 int GetCellTypeComponentArrayComponent(); 00201 int GetCellTypeComponentMinRange(); 00202 int GetCellTypeComponentMaxRange(); 00203 void SetCellConnectivityComponent(char *arrayName, int arrayComp, 00204 int min, int max); 00205 void SetCellConnectivityComponent(char *arrayName, int arrayComp) 00206 {this->SetCellConnectivityComponent(arrayName, arrayComp, -1, -1);}; 00207 const char *GetCellConnectivityComponentArrayName(); 00208 int GetCellConnectivityComponentArrayComponent(); 00209 int GetCellConnectivityComponentMinRange(); 00210 int GetCellConnectivityComponentMaxRange(); 00212 00214 00216 vtkSetMacro(DefaultNormalize,int); 00217 vtkGetMacro(DefaultNormalize,int); 00218 vtkBooleanMacro(DefaultNormalize,int); 00220 00222 00225 vtkSetVector3Macro(Dimensions,int); 00226 vtkGetVectorMacro(Dimensions,int,3); 00228 00230 00232 vtkSetVector3Macro(Origin,double); 00233 vtkGetVectorMacro(Origin,double,3); 00235 00237 00239 vtkSetVector3Macro(Spacing,double); 00240 vtkGetVectorMacro(Spacing,double,3); 00242 00244 00249 void SetDimensionsComponent(char *arrayName, int arrayComp, int min, int max); 00250 void SetDimensionsComponent(char *arrayName, int arrayComp) 00251 {this->SetDimensionsComponent(arrayName, arrayComp, -1, -1);}; 00252 void SetSpacingComponent(char *arrayName, int arrayComp, int min, int max); 00253 void SetSpacingComponent(char *arrayName, int arrayComp) 00254 {this->SetSpacingComponent(arrayName, arrayComp, -1, -1);}; 00255 void SetOriginComponent(char *arrayName, int arrayComp, int min, int max); 00256 void SetOriginComponent(char *arrayName, int arrayComp) 00257 {this->SetOriginComponent(arrayName, arrayComp, -1, -1);}; 00259 00260 protected: 00261 vtkDataObjectToDataSetFilter(); 00262 ~vtkDataObjectToDataSetFilter(); 00263 00264 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); //generate output data 00265 virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00266 virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00267 virtual int FillInputPortInformation(int port, vtkInformation *info); 00268 virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, 00269 vtkInformationVector *); 00270 00271 char Updating; 00272 00273 // control flags used to generate the output dataset 00274 int DataSetType; //the type of dataset to generate 00275 00276 // Support definition of points 00277 char *PointArrays[3]; //the name of the arrays 00278 int PointArrayComponents[3]; //the array components used for x-y-z 00279 vtkIdType PointComponentRange[3][2]; //the range of the components to use 00280 int PointNormalize[3]; //flags control normalization 00281 00282 // These define cells for vtkPolyData 00283 char *VertsArray; //the name of the array 00284 int VertsArrayComponent; //the array component 00285 vtkIdType VertsComponentRange[2]; //the range of the components to use 00286 00287 char *LinesArray; //the name of the array 00288 int LinesArrayComponent; //the array component used for cell types 00289 vtkIdType LinesComponentRange[2]; //the range of the components to use 00290 00291 char *PolysArray; //the name of the array 00292 int PolysArrayComponent; //the array component 00293 vtkIdType PolysComponentRange[2]; //the range of the components to use 00294 00295 char *StripsArray; //the name of the array 00296 int StripsArrayComponent; //the array component 00297 vtkIdType StripsComponentRange[2]; //the range of the components to use 00298 00299 // Used to define vtkUnstructuredGrid datasets 00300 char *CellTypeArray; //the name of the array 00301 int CellTypeArrayComponent; //the array component used for cell types 00302 vtkIdType CellTypeComponentRange[2]; //the range of the components to use 00303 00304 char *CellConnectivityArray; //the name of the array 00305 int CellConnectivityArrayComponent; //the array components used for cell connectivity 00306 vtkIdType CellConnectivityComponentRange[2]; //the range of the components to use 00307 00308 // helper methods (and attributes) to construct datasets 00309 void SetArrayName(char* &name, char *newName); 00310 vtkIdType ConstructPoints(vtkDataObject *input, vtkPointSet *ps); 00311 vtkIdType ConstructPoints(vtkDataObject *input, vtkRectilinearGrid *rg); 00312 int ConstructCells(vtkDataObject *input, vtkPolyData *pd); 00313 int ConstructCells(vtkDataObject *input, vtkUnstructuredGrid *ug); 00314 vtkCellArray *ConstructCellArray(vtkDataArray *da, int comp, 00315 vtkIdType compRange[2]); 00316 00317 // Default value for normalization 00318 int DefaultNormalize; 00319 00320 // Couple of different ways to specify dimensions, spacing, and origin. 00321 int Dimensions[3]; 00322 double Origin[3]; 00323 double Spacing[3]; 00324 00325 char *DimensionsArray; //the name of the array 00326 int DimensionsArrayComponent; //the component of the array used for dimensions 00327 vtkIdType DimensionsComponentRange[2]; //the ComponentRange of the array for the dimensions 00328 00329 char *OriginArray; //the name of the array 00330 int OriginArrayComponent; //the component of the array used for Origins 00331 vtkIdType OriginComponentRange[2]; //the ComponentRange of the array for the Origins 00332 00333 char *SpacingArray; //the name of the array 00334 int SpacingArrayComponent; //the component of the array used for Spacings 00335 vtkIdType SpacingComponentRange[2]; //the ComponentRange of the array for the Spacings 00336 00337 void ConstructDimensions(vtkDataObject *input); 00338 void ConstructSpacing(vtkDataObject *input); 00339 void ConstructOrigin(vtkDataObject *input); 00340 00341 private: 00342 vtkDataObjectToDataSetFilter(const vtkDataObjectToDataSetFilter&); // Not implemented. 00343 void operator=(const vtkDataObjectToDataSetFilter&); // Not implemented. 00344 }; 00345 00346 #endif