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