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

vtkDataObjectToDataSetFilter.h

Go to the documentation of this file.
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 =========================================================================*/
00083 #ifndef __vtkDataObjectToDataSetFilter_h
00084 #define __vtkDataObjectToDataSetFilter_h
00085 
00086 #include "vtkSource.h"
00087 
00088 class vtkCellArray;
00089 class vtkDataArray;
00090 class vtkDataSet;
00091 class vtkPointSet;
00092 class vtkPolyData;
00093 class vtkRectilinearGrid;
00094 class vtkStructuredGrid;
00095 class vtkStructuredPoints;
00096 class vtkUnstructuredGrid;
00097 
00098 class VTK_GRAPHICS_EXPORT vtkDataObjectToDataSetFilter : public vtkSource
00099 {
00100 public:
00101   static vtkDataObjectToDataSetFilter *New();
00102   vtkTypeRevisionMacro(vtkDataObjectToDataSetFilter,vtkSource);
00103   void PrintSelf(ostream& os, vtkIndent indent);
00104 
00106 
00107   void SetInput(vtkDataObject *input);
00108   vtkDataObject *GetInput();
00110 
00112 
00113   void SetDataSetType(int);
00114   vtkGetMacro(DataSetType,int);
00115   void SetDataSetTypeToPolyData() {
00116     this->SetDataSetType(VTK_POLY_DATA);};
00117   void SetDataSetTypeToStructuredPoints() {
00118     this->SetDataSetType(VTK_STRUCTURED_POINTS);};
00119   void SetDataSetTypeToStructuredGrid() {
00120     this->SetDataSetType(VTK_STRUCTURED_GRID);};
00121   void SetDataSetTypeToRectilinearGrid() {
00122     this->SetDataSetType(VTK_RECTILINEAR_GRID);};
00123   void SetDataSetTypeToUnstructuredGrid() {
00124     this->SetDataSetType(VTK_UNSTRUCTURED_GRID);};
00126 
00128 
00133   vtkDataSet *GetOutput();
00134   vtkDataSet *GetOutput(int idx);
00135   vtkPolyData *GetPolyDataOutput();
00136   vtkStructuredPoints *GetStructuredPointsOutput();
00137   vtkStructuredGrid *GetStructuredGridOutput();
00138   vtkUnstructuredGrid *GetUnstructuredGridOutput();
00139   vtkRectilinearGrid *GetRectilinearGridOutput();
00141 
00143 
00154   void SetPointComponent(int comp, char *arrayName, int arrayComp,
00155                          int min, int max, int normalize);
00156   void SetPointComponent(int comp, char *arrayName, int arrayComp)
00157     {this->SetPointComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00158   const char *GetPointComponentArrayName(int comp);
00159   int GetPointComponentArrayComponent(int comp);
00160   int GetPointComponentMinRange(int comp);
00161   int GetPointComponentMaxRange(int comp);
00162   int GetPointComponentNormailzeFlag(int comp);
00164   
00166 
00173   void SetVertsComponent(char *arrayName, int arrayComp, int min, int max);
00174   void SetVertsComponent(char *arrayName, int arrayComp)
00175     {this->SetVertsComponent(arrayName, arrayComp, -1, -1);};
00176   const char *GetVertsComponentArrayName();
00177   int GetVertsComponentArrayComponent();
00178   int GetVertsComponentMinRange();
00179   int GetVertsComponentMaxRange();
00180   void SetLinesComponent(char *arrayName, int arrayComp, int min, int max);
00181   void SetLinesComponent(char *arrayName, int arrayComp)
00182     {this->SetLinesComponent(arrayName, arrayComp, -1, -1);};
00183   const char *GetLinesComponentArrayName();
00184   int GetLinesComponentArrayComponent();
00185   int GetLinesComponentMinRange();
00186   int GetLinesComponentMaxRange();
00187   void SetPolysComponent(char *arrayName, int arrayComp, int min, int max);
00188   void SetPolysComponent(char *arrayName, int arrayComp)
00189     {this->SetPolysComponent(arrayName, arrayComp, -1, -1);};
00190   const char *GetPolysComponentArrayName();
00191   int GetPolysComponentArrayComponent();
00192   int GetPolysComponentMinRange();
00193   int GetPolysComponentMaxRange();
00194   void SetStripsComponent(char *arrayName, int arrayComp, int min, int max);
00195   void SetStripsComponent(char *arrayName, int arrayComp)
00196     {this->SetStripsComponent(arrayName, arrayComp, -1, -1);};
00197   const char *GetStripsComponentArrayName();
00198   int GetStripsComponentArrayComponent();
00199   int GetStripsComponentMinRange();
00200   int GetStripsComponentMaxRange();
00202   
00204 
00211   void SetCellTypeComponent(char *arrayName, int arrayComp,
00212                             int min, int max);
00213   void SetCellTypeComponent(char *arrayName, int arrayComp)
00214     {this->SetCellTypeComponent(arrayName, arrayComp, -1, -1);};
00215   const char *GetCellTypeComponentArrayName();
00216   int GetCellTypeComponentArrayComponent();
00217   int GetCellTypeComponentMinRange();
00218   int GetCellTypeComponentMaxRange();
00219   void SetCellConnectivityComponent(char *arrayName, int arrayComp,
00220                                     int min, int max);
00221   void SetCellConnectivityComponent(char *arrayName, int arrayComp)
00222     {this->SetCellConnectivityComponent(arrayName, arrayComp, -1, -1);};
00223   const char *GetCellConnectivityComponentArrayName();
00224   int GetCellConnectivityComponentArrayComponent();
00225   int GetCellConnectivityComponentMinRange();
00226   int GetCellConnectivityComponentMaxRange();
00228   
00230 
00232   vtkSetMacro(DefaultNormalize,int);
00233   vtkGetMacro(DefaultNormalize,int);
00234   vtkBooleanMacro(DefaultNormalize,int);
00236 
00238 
00241   vtkSetVector3Macro(Dimensions,int);
00242   vtkGetVectorMacro(Dimensions,int,3);
00244   
00246 
00248   vtkSetVector3Macro(Origin,double);
00249   vtkGetVectorMacro(Origin,double,3);
00251   
00253 
00255   vtkSetVector3Macro(Spacing,double);
00256   vtkGetVectorMacro(Spacing,double,3);
00258   
00260 
00265   void SetDimensionsComponent(char *arrayName, int arrayComp, int min, int max);
00266   void SetDimensionsComponent(char *arrayName, int arrayComp)
00267     {this->SetDimensionsComponent(arrayName, arrayComp, -1, -1);};
00268   void SetSpacingComponent(char *arrayName, int arrayComp, int min, int max);
00269   void SetSpacingComponent(char *arrayName, int arrayComp)
00270     {this->SetSpacingComponent(arrayName, arrayComp, -1, -1);};
00271   void SetOriginComponent(char *arrayName, int arrayComp, int min, int max);
00272   void SetOriginComponent(char *arrayName, int arrayComp)
00273     {this->SetOriginComponent(arrayName, arrayComp, -1, -1);};  
00275 
00276 protected:
00277   vtkDataObjectToDataSetFilter();
00278   ~vtkDataObjectToDataSetFilter();
00279 
00280   void Execute(); //generate output data
00281   void ExecuteInformation();
00282   void ComputeInputUpdateExtents(vtkDataObject *output);
00283 
00284   char Updating;
00285 
00286   // control flags used to generate the output dataset
00287   int DataSetType; //the type of dataset to generate
00288   
00289   // Support definition of points
00290   char *PointArrays[3]; //the name of the arrays
00291   int PointArrayComponents[3]; //the array components used for x-y-z
00292   vtkIdType PointComponentRange[3][2]; //the range of the components to use
00293   int PointNormalize[3]; //flags control normalization
00294 
00295   // These define cells for vtkPolyData
00296   char *VertsArray; //the name of the array
00297   int VertsArrayComponent; //the array component
00298   vtkIdType VertsComponentRange[2]; //the range of the components to use
00299 
00300   char *LinesArray; //the name of the array
00301   int LinesArrayComponent; //the array component used for cell types
00302   vtkIdType LinesComponentRange[2]; //the range of the components to use
00303 
00304   char *PolysArray; //the name of the array
00305   int PolysArrayComponent; //the array component
00306   vtkIdType PolysComponentRange[2]; //the range of the components to use
00307 
00308   char *StripsArray; //the name of the array
00309   int StripsArrayComponent; //the array component
00310   vtkIdType StripsComponentRange[2]; //the range of the components to use
00311 
00312   // Used to define vtkUnstructuredGrid datasets
00313   char *CellTypeArray; //the name of the array
00314   int CellTypeArrayComponent; //the array component used for cell types
00315   vtkIdType CellTypeComponentRange[2]; //the range of the components to use
00316 
00317   char *CellConnectivityArray; //the name of the array
00318   int CellConnectivityArrayComponent; //the array components used for cell connectivity
00319   vtkIdType CellConnectivityComponentRange[2]; //the range of the components to use
00320 
00321   // helper methods (and attributes) to construct datasets
00322   void SetArrayName(char* &name, char *newName);
00323   vtkIdType ConstructPoints(vtkPointSet *ps);
00324   vtkIdType ConstructPoints(vtkRectilinearGrid *rg);
00325   int ConstructCells(vtkPolyData *pd);
00326   int ConstructCells(vtkUnstructuredGrid *ug);
00327   vtkCellArray *ConstructCellArray(vtkDataArray *da, int comp,
00328                                    vtkIdType compRange[2]);
00329 
00330   // Default value for normalization
00331   int DefaultNormalize;
00332 
00333   // Couple of different ways to specify dimensions, spacing, and origin.
00334   int Dimensions[3];
00335   double Origin[3];
00336   double Spacing[3];
00337   
00338   char *DimensionsArray; //the name of the array
00339   int DimensionsArrayComponent; //the component of the array used for dimensions
00340   vtkIdType DimensionsComponentRange[2]; //the ComponentRange of the array for the dimensions
00341   
00342   char *OriginArray; //the name of the array
00343   int OriginArrayComponent; //the component of the array used for Origins
00344   vtkIdType OriginComponentRange[2]; //the ComponentRange of the array for the Origins
00345   
00346   char *SpacingArray; //the name of the array
00347   int SpacingArrayComponent; //the component of the array used for Spacings
00348   vtkIdType SpacingComponentRange[2]; //the ComponentRange of the array for the Spacings
00349   
00350   void ConstructDimensions();
00351   void ConstructSpacing();
00352   void ConstructOrigin();
00353   
00354 private:
00355   vtkDataObjectToDataSetFilter(const vtkDataObjectToDataSetFilter&);  // Not implemented.
00356   void operator=(const vtkDataObjectToDataSetFilter&);  // Not implemented.
00357 };
00358 
00359 #endif