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 
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 "vtkSource.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 vtkSource
00086 {
00087 public:
00088   static vtkDataObjectToDataSetFilter *New();
00089   vtkTypeRevisionMacro(vtkDataObjectToDataSetFilter,vtkSource);
00090   void PrintSelf(ostream& os, vtkIndent indent);
00091 
00093 
00094   void SetInput(vtkDataObject *input);
00095   vtkDataObject *GetInput();
00097 
00099 
00100   void SetDataSetType(int);
00101   vtkGetMacro(DataSetType,int);
00102   void SetDataSetTypeToPolyData() {
00103     this->SetDataSetType(VTK_POLY_DATA);};
00104   void SetDataSetTypeToStructuredPoints() {
00105     this->SetDataSetType(VTK_STRUCTURED_POINTS);};
00106   void SetDataSetTypeToStructuredGrid() {
00107     this->SetDataSetType(VTK_STRUCTURED_GRID);};
00108   void SetDataSetTypeToRectilinearGrid() {
00109     this->SetDataSetType(VTK_RECTILINEAR_GRID);};
00110   void SetDataSetTypeToUnstructuredGrid() {
00111     this->SetDataSetType(VTK_UNSTRUCTURED_GRID);};
00113 
00115 
00120   vtkDataSet *GetOutput();
00121   vtkDataSet *GetOutput(int idx);
00122   vtkPolyData *GetPolyDataOutput();
00123   vtkStructuredPoints *GetStructuredPointsOutput();
00124   vtkStructuredGrid *GetStructuredGridOutput();
00125   vtkUnstructuredGrid *GetUnstructuredGridOutput();
00126   vtkRectilinearGrid *GetRectilinearGridOutput();
00128 
00130 
00141   void SetPointComponent(int comp, char *arrayName, int arrayComp,
00142                          int min, int max, int normalize);
00143   void SetPointComponent(int comp, char *arrayName, int arrayComp)
00144     {this->SetPointComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00145   const char *GetPointComponentArrayName(int comp);
00146   int GetPointComponentArrayComponent(int comp);
00147   int GetPointComponentMinRange(int comp);
00148   int GetPointComponentMaxRange(int comp);
00149   int GetPointComponentNormailzeFlag(int comp);
00151   
00153 
00160   void SetVertsComponent(char *arrayName, int arrayComp, int min, int max);
00161   void SetVertsComponent(char *arrayName, int arrayComp)
00162     {this->SetVertsComponent(arrayName, arrayComp, -1, -1);};
00163   const char *GetVertsComponentArrayName();
00164   int GetVertsComponentArrayComponent();
00165   int GetVertsComponentMinRange();
00166   int GetVertsComponentMaxRange();
00167   void SetLinesComponent(char *arrayName, int arrayComp, int min, int max);
00168   void SetLinesComponent(char *arrayName, int arrayComp)
00169     {this->SetLinesComponent(arrayName, arrayComp, -1, -1);};
00170   const char *GetLinesComponentArrayName();
00171   int GetLinesComponentArrayComponent();
00172   int GetLinesComponentMinRange();
00173   int GetLinesComponentMaxRange();
00174   void SetPolysComponent(char *arrayName, int arrayComp, int min, int max);
00175   void SetPolysComponent(char *arrayName, int arrayComp)
00176     {this->SetPolysComponent(arrayName, arrayComp, -1, -1);};
00177   const char *GetPolysComponentArrayName();
00178   int GetPolysComponentArrayComponent();
00179   int GetPolysComponentMinRange();
00180   int GetPolysComponentMaxRange();
00181   void SetStripsComponent(char *arrayName, int arrayComp, int min, int max);
00182   void SetStripsComponent(char *arrayName, int arrayComp)
00183     {this->SetStripsComponent(arrayName, arrayComp, -1, -1);};
00184   const char *GetStripsComponentArrayName();
00185   int GetStripsComponentArrayComponent();
00186   int GetStripsComponentMinRange();
00187   int GetStripsComponentMaxRange();
00189   
00191 
00198   void SetCellTypeComponent(char *arrayName, int arrayComp,
00199                             int min, int max);
00200   void SetCellTypeComponent(char *arrayName, int arrayComp)
00201     {this->SetCellTypeComponent(arrayName, arrayComp, -1, -1);};
00202   const char *GetCellTypeComponentArrayName();
00203   int GetCellTypeComponentArrayComponent();
00204   int GetCellTypeComponentMinRange();
00205   int GetCellTypeComponentMaxRange();
00206   void SetCellConnectivityComponent(char *arrayName, int arrayComp,
00207                                     int min, int max);
00208   void SetCellConnectivityComponent(char *arrayName, int arrayComp)
00209     {this->SetCellConnectivityComponent(arrayName, arrayComp, -1, -1);};
00210   const char *GetCellConnectivityComponentArrayName();
00211   int GetCellConnectivityComponentArrayComponent();
00212   int GetCellConnectivityComponentMinRange();
00213   int GetCellConnectivityComponentMaxRange();
00215   
00217 
00219   vtkSetMacro(DefaultNormalize,int);
00220   vtkGetMacro(DefaultNormalize,int);
00221   vtkBooleanMacro(DefaultNormalize,int);
00223 
00225 
00228   vtkSetVector3Macro(Dimensions,int);
00229   vtkGetVectorMacro(Dimensions,int,3);
00231   
00233 
00235   vtkSetVector3Macro(Origin,double);
00236   vtkGetVectorMacro(Origin,double,3);
00238   
00240 
00242   vtkSetVector3Macro(Spacing,double);
00243   vtkGetVectorMacro(Spacing,double,3);
00245   
00247 
00252   void SetDimensionsComponent(char *arrayName, int arrayComp, int min, int max);
00253   void SetDimensionsComponent(char *arrayName, int arrayComp)
00254     {this->SetDimensionsComponent(arrayName, arrayComp, -1, -1);};
00255   void SetSpacingComponent(char *arrayName, int arrayComp, int min, int max);
00256   void SetSpacingComponent(char *arrayName, int arrayComp)
00257     {this->SetSpacingComponent(arrayName, arrayComp, -1, -1);};
00258   void SetOriginComponent(char *arrayName, int arrayComp, int min, int max);
00259   void SetOriginComponent(char *arrayName, int arrayComp)
00260     {this->SetOriginComponent(arrayName, arrayComp, -1, -1);};  
00262 
00263 protected:
00264   vtkDataObjectToDataSetFilter();
00265   ~vtkDataObjectToDataSetFilter();
00266 
00267   void Execute(); //generate output data
00268   void ExecuteInformation();
00269   void ComputeInputUpdateExtents(vtkDataObject *output);
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(vtkPointSet *ps);
00311   vtkIdType ConstructPoints(vtkRectilinearGrid *rg);
00312   int ConstructCells(vtkPolyData *pd);
00313   int ConstructCells(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();
00338   void ConstructSpacing();
00339   void ConstructOrigin();
00340   
00341 private:
00342   vtkDataObjectToDataSetFilter(const vtkDataObjectToDataSetFilter&);  // Not implemented.
00343   void operator=(const vtkDataObjectToDataSetFilter&);  // Not implemented.
00344 };
00345 
00346 #endif