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 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038 
00039 =========================================================================*/
00094 #ifndef __vtkDataObjectToDataSetFilter_h
00095 #define __vtkDataObjectToDataSetFilter_h
00096 
00097 #include "vtkSource.h"
00098 #include "vtkFieldData.h"
00099 
00100 class vtkDataSet;
00101 class vtkPointSet;
00102 class vtkPolyData;
00103 class vtkStructuredPoints;
00104 class vtkStructuredGrid;
00105 class vtkRectilinearGrid;
00106 class vtkUnstructuredGrid;
00107 class vtkCellArray;
00108 
00109 class VTK_EXPORT vtkDataObjectToDataSetFilter : public vtkSource
00110 {
00111 public:
00112   static vtkDataObjectToDataSetFilter *New();
00113   vtkTypeMacro(vtkDataObjectToDataSetFilter,vtkSource);
00114   void PrintSelf(ostream& os, vtkIndent indent);
00115 
00117   void SetInput(vtkDataObject *input);
00118   vtkDataObject *GetInput();
00119 
00121   void SetDataSetType(int);
00122   vtkGetMacro(DataSetType,int);
00123   void SetDataSetTypeToPolyData() {
00124     this->SetDataSetType(VTK_POLY_DATA);};
00125   void SetDataSetTypeToStructuredPoints() {
00126     this->SetDataSetType(VTK_STRUCTURED_POINTS);};
00127   void SetDataSetTypeToStructuredGrid() {
00128     this->SetDataSetType(VTK_STRUCTURED_GRID);};
00129   void SetDataSetTypeToRectilinearGrid() {
00130     this->SetDataSetType(VTK_RECTILINEAR_GRID);};
00131   void SetDataSetTypeToUnstructuredGrid() {
00132     this->SetDataSetType(VTK_UNSTRUCTURED_GRID);};
00133 
00139   vtkDataSet *GetOutput();
00140   vtkDataSet *GetOutput(int idx)
00141     {return (vtkDataSet *) this->vtkSource::GetOutput(idx); };
00142   vtkPolyData *GetPolyDataOutput();
00143   vtkStructuredPoints *GetStructuredPointsOutput();
00144   vtkStructuredGrid *GetStructuredGridOutput();
00145   vtkUnstructuredGrid *GetUnstructuredGridOutput();
00146   vtkRectilinearGrid *GetRectilinearGridOutput();
00147 
00159   void SetPointComponent(int comp, char *arrayName, int arrayComp,
00160                          int min, int max, int normalize);
00161   void SetPointComponent(int comp, char *arrayName, int arrayComp)
00162     {this->SetPointComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00163   const char *GetPointComponentArrayName(int comp);
00164   int GetPointComponentArrayComponent(int comp);
00165   int GetPointComponentMinRange(int comp);
00166   int GetPointComponentMaxRange(int comp);
00167   int GetPointComponentNormailzeFlag(int comp);
00168   
00176   void SetVertsComponent(char *arrayName, int arrayComp, int min, int max);
00177   void SetVertsComponent(char *arrayName, int arrayComp)
00178     {this->SetVertsComponent(arrayName, arrayComp, -1, -1);};
00179   const char *GetVertsComponentArrayName();
00180   int GetVertsComponentArrayComponent();
00181   int GetVertsComponentMinRange();
00182   int GetVertsComponentMaxRange();
00183   void SetLinesComponent(char *arrayName, int arrayComp, int min, int max);
00184   void SetLinesComponent(char *arrayName, int arrayComp)
00185     {this->SetLinesComponent(arrayName, arrayComp, -1, -1);};
00186   const char *GetLinesComponentArrayName();
00187   int GetLinesComponentArrayComponent();
00188   int GetLinesComponentMinRange();
00189   int GetLinesComponentMaxRange();
00190   void SetPolysComponent(char *arrayName, int arrayComp, int min, int max);
00191   void SetPolysComponent(char *arrayName, int arrayComp)
00192     {this->SetPolysComponent(arrayName, arrayComp, -1, -1);};
00193   const char *GetPolysComponentArrayName();
00194   int GetPolysComponentArrayComponent();
00195   int GetPolysComponentMinRange();
00196   int GetPolysComponentMaxRange();
00197   void SetStripsComponent(char *arrayName, int arrayComp, int min, int max);
00198   void SetStripsComponent(char *arrayName, int arrayComp)
00199     {this->SetStripsComponent(arrayName, arrayComp, -1, -1);};
00200   const char *GetStripsComponentArrayName();
00201   int GetStripsComponentArrayComponent();
00202   int GetStripsComponentMinRange();
00203   int GetStripsComponentMaxRange();
00204   
00212   void SetCellTypeComponent(char *arrayName, int arrayComp,
00213                             int min, int max);
00214   void SetCellTypeComponent(char *arrayName, int arrayComp)
00215     {this->SetCellTypeComponent(arrayName, arrayComp, -1, -1);};
00216   const char *GetCellTypeComponentArrayName();
00217   int GetCellTypeComponentArrayComponent();
00218   int GetCellTypeComponentMinRange();
00219   int GetCellTypeComponentMaxRange();
00220   void SetCellConnectivityComponent(char *arrayName, int arrayComp,
00221                                     int min, int max);
00222   void SetCellConnectivityComponent(char *arrayName, int arrayComp)
00223     {this->SetCellConnectivityComponent(arrayName, arrayComp, -1, -1);};
00224   const char *GetCellConnectivityComponentArrayName();
00225   int GetCellConnectivityComponentArrayComponent();
00226   int GetCellConnectivityComponentMinRange();
00227   int GetCellConnectivityComponentMaxRange();
00228   
00231   vtkSetMacro(DefaultNormalize,int);
00232   vtkGetMacro(DefaultNormalize,int);
00233   vtkBooleanMacro(DefaultNormalize,int);
00234 
00238   vtkSetVector3Macro(Dimensions,int);
00239   vtkGetVectorMacro(Dimensions,int,3);
00240   
00243   vtkSetVector3Macro(Origin,float);
00244   vtkGetVectorMacro(Origin,float,3);
00245   
00248   vtkSetVector3Macro(Spacing,float);
00249   vtkGetVectorMacro(Spacing,float,3);
00250   
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);};  
00265 
00266 protected:
00267   vtkDataObjectToDataSetFilter();
00268   ~vtkDataObjectToDataSetFilter();
00269   vtkDataObjectToDataSetFilter(const vtkDataObjectToDataSetFilter&) {};
00270   void operator=(const vtkDataObjectToDataSetFilter&) {};
00271 
00272   void Execute(); //generate output data
00273   void ExecuteInformation();
00274   void ComputeInputUpdateExtents(vtkDataObject *output);
00275 
00276   char Updating;
00277 
00278   // control flags used to generate the output dataset
00279   int DataSetType; //the type of dataset to generate
00280   
00281   // Support definition of points
00282   char *PointArrays[3]; //the name of the arrays
00283   int PointArrayComponents[3]; //the array components used for x-y-z
00284   int PointComponentRange[3][2]; //the range of the components to use
00285   int PointNormalize[3]; //flags control normalization
00286 
00287   // These define cells for vtkPolyData
00288   char *VertsArray; //the name of the array
00289   int VertsArrayComponent; //the array component
00290   int VertsComponentRange[2]; //the range of the components to use
00291 
00292   char *LinesArray; //the name of the array
00293   int LinesArrayComponent; //the array component used for cell types
00294   int LinesComponentRange[2]; //the range of the components to use
00295 
00296   char *PolysArray; //the name of the array
00297   int PolysArrayComponent; //the array component
00298   int PolysComponentRange[2]; //the range of the components to use
00299 
00300   char *StripsArray; //the name of the array
00301   int StripsArrayComponent; //the array component
00302   int StripsComponentRange[2]; //the range of the components to use
00303 
00304   // Used to define vtkUnstructuredGrid datasets
00305   char *CellTypeArray; //the name of the array
00306   int CellTypeArrayComponent; //the array component used for cell types
00307   int CellTypeComponentRange[2]; //the range of the components to use
00308 
00309   char *CellConnectivityArray; //the name of the array
00310   int CellConnectivityArrayComponent; //the array components used for cell connectivity
00311   int CellConnectivityComponentRange[2]; //the range of the components to use
00312 
00313   // helper methods (and attributes) to construct datasets
00314   void SetArrayName(char* &name, char *newName);
00315   int ConstructPoints(vtkPointSet *ps);
00316   int ConstructPoints(vtkRectilinearGrid *rg);
00317   int ConstructCells(vtkPolyData *pd);
00318   int ConstructCells(vtkUnstructuredGrid *ug);
00319   vtkCellArray *ConstructCellArray(vtkDataArray *da, int comp, int 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   int 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   int 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   int SpacingComponentRange[2]; //the ComponentRange of the array for the Spacings
00340   
00341   void ConstructDimensions();
00342   void ConstructSpacing();
00343   void ConstructOrigin();
00344   
00345 };
00346 
00347 #endif
00348 
00349 

Generated on Wed Nov 21 12:26:58 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001