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