Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Graphics/vtkDataObjectToDataSetFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkDataObjectToDataSetFilter.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00074 #ifndef __vtkDataObjectToDataSetFilter_h
00075 #define __vtkDataObjectToDataSetFilter_h
00076 
00077 #include "vtkSource.h"
00078 
00079 class vtkCellArray;
00080 class vtkDataArray;
00081 class vtkDataSet;
00082 class vtkPointSet;
00083 class vtkPolyData;
00084 class vtkRectilinearGrid;
00085 class vtkStructuredGrid;
00086 class vtkStructuredPoints;
00087 class vtkUnstructuredGrid;
00088 
00089 class VTK_GRAPHICS_EXPORT vtkDataObjectToDataSetFilter : public vtkSource
00090 {
00091 public:
00092   static vtkDataObjectToDataSetFilter *New();
00093   vtkTypeRevisionMacro(vtkDataObjectToDataSetFilter,vtkSource);
00094   void PrintSelf(ostream& os, vtkIndent indent);
00095 
00097 
00098   void SetInput(vtkDataObject *input);
00099   vtkDataObject *GetInput();
00101 
00103 
00104   void SetDataSetType(int);
00105   vtkGetMacro(DataSetType,int);
00106   void SetDataSetTypeToPolyData() {
00107     this->SetDataSetType(VTK_POLY_DATA);};
00108   void SetDataSetTypeToStructuredPoints() {
00109     this->SetDataSetType(VTK_STRUCTURED_POINTS);};
00110   void SetDataSetTypeToStructuredGrid() {
00111     this->SetDataSetType(VTK_STRUCTURED_GRID);};
00112   void SetDataSetTypeToRectilinearGrid() {
00113     this->SetDataSetType(VTK_RECTILINEAR_GRID);};
00114   void SetDataSetTypeToUnstructuredGrid() {
00115     this->SetDataSetType(VTK_UNSTRUCTURED_GRID);};
00117 
00119 
00124   vtkDataSet *GetOutput();
00125   vtkDataSet *GetOutput(int idx);
00126   vtkPolyData *GetPolyDataOutput();
00127   vtkStructuredPoints *GetStructuredPointsOutput();
00128   vtkStructuredGrid *GetStructuredGridOutput();
00129   vtkUnstructuredGrid *GetUnstructuredGridOutput();
00130   vtkRectilinearGrid *GetRectilinearGridOutput();
00132 
00134 
00145   void SetPointComponent(int comp, char *arrayName, int arrayComp,
00146                          int min, int max, int normalize);
00147   void SetPointComponent(int comp, char *arrayName, int arrayComp)
00148     {this->SetPointComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00149   const char *GetPointComponentArrayName(int comp);
00150   int GetPointComponentArrayComponent(int comp);
00151   int GetPointComponentMinRange(int comp);
00152   int GetPointComponentMaxRange(int comp);
00153   int GetPointComponentNormailzeFlag(int comp);
00155   
00157 
00164   void SetVertsComponent(char *arrayName, int arrayComp, int min, int max);
00165   void SetVertsComponent(char *arrayName, int arrayComp)
00166     {this->SetVertsComponent(arrayName, arrayComp, -1, -1);};
00167   const char *GetVertsComponentArrayName();
00168   int GetVertsComponentArrayComponent();
00169   int GetVertsComponentMinRange();
00170   int GetVertsComponentMaxRange();
00171   void SetLinesComponent(char *arrayName, int arrayComp, int min, int max);
00172   void SetLinesComponent(char *arrayName, int arrayComp)
00173     {this->SetLinesComponent(arrayName, arrayComp, -1, -1);};
00174   const char *GetLinesComponentArrayName();
00175   int GetLinesComponentArrayComponent();
00176   int GetLinesComponentMinRange();
00177   int GetLinesComponentMaxRange();
00178   void SetPolysComponent(char *arrayName, int arrayComp, int min, int max);
00179   void SetPolysComponent(char *arrayName, int arrayComp)
00180     {this->SetPolysComponent(arrayName, arrayComp, -1, -1);};
00181   const char *GetPolysComponentArrayName();
00182   int GetPolysComponentArrayComponent();
00183   int GetPolysComponentMinRange();
00184   int GetPolysComponentMaxRange();
00185   void SetStripsComponent(char *arrayName, int arrayComp, int min, int max);
00186   void SetStripsComponent(char *arrayName, int arrayComp)
00187     {this->SetStripsComponent(arrayName, arrayComp, -1, -1);};
00188   const char *GetStripsComponentArrayName();
00189   int GetStripsComponentArrayComponent();
00190   int GetStripsComponentMinRange();
00191   int GetStripsComponentMaxRange();
00193   
00195 
00202   void SetCellTypeComponent(char *arrayName, int arrayComp,
00203                             int min, int max);
00204   void SetCellTypeComponent(char *arrayName, int arrayComp)
00205     {this->SetCellTypeComponent(arrayName, arrayComp, -1, -1);};
00206   const char *GetCellTypeComponentArrayName();
00207   int GetCellTypeComponentArrayComponent();
00208   int GetCellTypeComponentMinRange();
00209   int GetCellTypeComponentMaxRange();
00210   void SetCellConnectivityComponent(char *arrayName, int arrayComp,
00211                                     int min, int max);
00212   void SetCellConnectivityComponent(char *arrayName, int arrayComp)
00213     {this->SetCellConnectivityComponent(arrayName, arrayComp, -1, -1);};
00214   const char *GetCellConnectivityComponentArrayName();
00215   int GetCellConnectivityComponentArrayComponent();
00216   int GetCellConnectivityComponentMinRange();
00217   int GetCellConnectivityComponentMaxRange();
00219   
00221 
00223   vtkSetMacro(DefaultNormalize,int);
00224   vtkGetMacro(DefaultNormalize,int);
00225   vtkBooleanMacro(DefaultNormalize,int);
00227 
00229 
00232   vtkSetVector3Macro(Dimensions,int);
00233   vtkGetVectorMacro(Dimensions,int,3);
00235   
00237 
00239   vtkSetVector3Macro(Origin,float);
00240   vtkGetVectorMacro(Origin,float,3);
00242   
00244 
00246   vtkSetVector3Macro(Spacing,float);
00247   vtkGetVectorMacro(Spacing,float,3);
00249   
00251 
00256   void SetDimensionsComponent(char *arrayName, int arrayComp, int min, int max);
00257   void SetDimensionsComponent(char *arrayName, int arrayComp)
00258     {this->SetDimensionsComponent(arrayName, arrayComp, -1, -1);};
00259   void SetSpacingComponent(char *arrayName, int arrayComp, int min, int max);
00260   void SetSpacingComponent(char *arrayName, int arrayComp)
00261     {this->SetSpacingComponent(arrayName, arrayComp, -1, -1);};
00262   void SetOriginComponent(char *arrayName, int arrayComp, int min, int max);
00263   void SetOriginComponent(char *arrayName, int arrayComp)
00264     {this->SetOriginComponent(arrayName, arrayComp, -1, -1);};  
00266 
00267 protected:
00268   vtkDataObjectToDataSetFilter();
00269   ~vtkDataObjectToDataSetFilter();
00270 
00271   void Execute(); //generate output data
00272   void ExecuteInformation();
00273   void ComputeInputUpdateExtents(vtkDataObject *output);
00274 
00275   char Updating;
00276 
00277   // control flags used to generate the output dataset
00278   int DataSetType; //the type of dataset to generate
00279   
00280   // Support definition of points
00281   char *PointArrays[3]; //the name of the arrays
00282   int PointArrayComponents[3]; //the array components used for x-y-z
00283   vtkIdType PointComponentRange[3][2]; //the range of the components to use
00284   int PointNormalize[3]; //flags control normalization
00285 
00286   // These define cells for vtkPolyData
00287   char *VertsArray; //the name of the array
00288   int VertsArrayComponent; //the array component
00289   vtkIdType VertsComponentRange[2]; //the range of the components to use
00290 
00291   char *LinesArray; //the name of the array
00292   int LinesArrayComponent; //the array component used for cell types
00293   vtkIdType LinesComponentRange[2]; //the range of the components to use
00294 
00295   char *PolysArray; //the name of the array
00296   int PolysArrayComponent; //the array component
00297   vtkIdType PolysComponentRange[2]; //the range of the components to use
00298 
00299   char *StripsArray; //the name of the array
00300   int StripsArrayComponent; //the array component
00301   vtkIdType StripsComponentRange[2]; //the range of the components to use
00302 
00303   // Used to define vtkUnstructuredGrid datasets
00304   char *CellTypeArray; //the name of the array
00305   int CellTypeArrayComponent; //the array component used for cell types
00306   vtkIdType CellTypeComponentRange[2]; //the range of the components to use
00307 
00308   char *CellConnectivityArray; //the name of the array
00309   int CellConnectivityArrayComponent; //the array components used for cell connectivity
00310   vtkIdType CellConnectivityComponentRange[2]; //the range of the components to use
00311 
00312   // helper methods (and attributes) to construct datasets
00313   void SetArrayName(char* &name, char *newName);
00314   vtkIdType ConstructPoints(vtkPointSet *ps);
00315   vtkIdType ConstructPoints(vtkRectilinearGrid *rg);
00316   int ConstructCells(vtkPolyData *pd);
00317   int ConstructCells(vtkUnstructuredGrid *ug);
00318   vtkCellArray *ConstructCellArray(vtkDataArray *da, int comp,
00319                                    vtkIdType compRange[2]);
00320 
00321   // Default value for normalization
00322   int DefaultNormalize;
00323 
00324   // Couple of different ways to specify dimensions, spacing, and origin.
00325   int Dimensions[3];
00326   float Origin[3];
00327   float Spacing[3];
00328   
00329   char *DimensionsArray; //the name of the array
00330   int DimensionsArrayComponent; //the component of the array used for dimensions
00331   vtkIdType DimensionsComponentRange[2]; //the ComponentRange of the array for the dimensions
00332   
00333   char *OriginArray; //the name of the array
00334   int OriginArrayComponent; //the component of the array used for Origins
00335   vtkIdType OriginComponentRange[2]; //the ComponentRange of the array for the Origins
00336   
00337   char *SpacingArray; //the name of the array
00338   int SpacingArrayComponent; //the component of the array used for Spacings
00339   vtkIdType SpacingComponentRange[2]; //the ComponentRange of the array for the Spacings
00340   
00341   void ConstructDimensions();
00342   void ConstructSpacing();
00343   void ConstructOrigin();
00344   
00345 private:
00346   vtkDataObjectToDataSetFilter(const vtkDataObjectToDataSetFilter&);  // Not implemented.
00347   void operator=(const vtkDataObjectToDataSetFilter&);  // Not implemented.
00348 };
00349 
00350 #endif