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 =========================================================================*/
00098 #ifndef __vtkDataObjectToDataSetFilter_h
00099 #define __vtkDataObjectToDataSetFilter_h
00100 
00101 #include "vtkSource.h"
00102 #include "vtkFieldData.h"
00103 #include "vtkDataSet.h"
00104 
00105 class vtkPointSet;
00106 class vtkPolyData;
00107 class vtkStructuredPoints;
00108 class vtkStructuredGrid;
00109 class vtkRectilinearGrid;
00110 class vtkUnstructuredGrid;
00111 class vtkCellArray;
00112 
00113 class VTK_GRAPHICS_EXPORT vtkDataObjectToDataSetFilter : public vtkSource
00114 {
00115 public:
00116   static vtkDataObjectToDataSetFilter *New();
00117   vtkTypeMacro(vtkDataObjectToDataSetFilter,vtkSource);
00118   void PrintSelf(ostream& os, vtkIndent indent);
00119 
00121 
00122   void SetInput(vtkDataObject *input);
00123   vtkDataObject *GetInput();
00125 
00127 
00128   void SetDataSetType(int);
00129   vtkGetMacro(DataSetType,int);
00130   void SetDataSetTypeToPolyData() {
00131     this->SetDataSetType(VTK_POLY_DATA);};
00132   void SetDataSetTypeToStructuredPoints() {
00133     this->SetDataSetType(VTK_STRUCTURED_POINTS);};
00134   void SetDataSetTypeToStructuredGrid() {
00135     this->SetDataSetType(VTK_STRUCTURED_GRID);};
00136   void SetDataSetTypeToRectilinearGrid() {
00137     this->SetDataSetType(VTK_RECTILINEAR_GRID);};
00138   void SetDataSetTypeToUnstructuredGrid() {
00139     this->SetDataSetType(VTK_UNSTRUCTURED_GRID);};
00141 
00143 
00148   vtkDataSet *GetOutput();
00149   vtkDataSet *GetOutput(int idx)
00150     {return static_cast<vtkDataSet *>(this->vtkSource::GetOutput(idx)); };
00151   vtkPolyData *GetPolyDataOutput();
00152   vtkStructuredPoints *GetStructuredPointsOutput();
00153   vtkStructuredGrid *GetStructuredGridOutput();
00154   vtkUnstructuredGrid *GetUnstructuredGridOutput();
00155   vtkRectilinearGrid *GetRectilinearGridOutput();
00157 
00159 
00170   void SetPointComponent(int comp, char *arrayName, int arrayComp,
00171                          int min, int max, int normalize);
00172   void SetPointComponent(int comp, char *arrayName, int arrayComp)
00173     {this->SetPointComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00174   const char *GetPointComponentArrayName(int comp);
00175   int GetPointComponentArrayComponent(int comp);
00176   int GetPointComponentMinRange(int comp);
00177   int GetPointComponentMaxRange(int comp);
00178   int GetPointComponentNormailzeFlag(int comp);
00180   
00182 
00189   void SetVertsComponent(char *arrayName, int arrayComp, int min, int max);
00190   void SetVertsComponent(char *arrayName, int arrayComp)
00191     {this->SetVertsComponent(arrayName, arrayComp, -1, -1);};
00192   const char *GetVertsComponentArrayName();
00193   int GetVertsComponentArrayComponent();
00194   int GetVertsComponentMinRange();
00195   int GetVertsComponentMaxRange();
00196   void SetLinesComponent(char *arrayName, int arrayComp, int min, int max);
00197   void SetLinesComponent(char *arrayName, int arrayComp)
00198     {this->SetLinesComponent(arrayName, arrayComp, -1, -1);};
00199   const char *GetLinesComponentArrayName();
00200   int GetLinesComponentArrayComponent();
00201   int GetLinesComponentMinRange();
00202   int GetLinesComponentMaxRange();
00203   void SetPolysComponent(char *arrayName, int arrayComp, int min, int max);
00204   void SetPolysComponent(char *arrayName, int arrayComp)
00205     {this->SetPolysComponent(arrayName, arrayComp, -1, -1);};
00206   const char *GetPolysComponentArrayName();
00207   int GetPolysComponentArrayComponent();
00208   int GetPolysComponentMinRange();
00209   int GetPolysComponentMaxRange();
00210   void SetStripsComponent(char *arrayName, int arrayComp, int min, int max);
00211   void SetStripsComponent(char *arrayName, int arrayComp)
00212     {this->SetStripsComponent(arrayName, arrayComp, -1, -1);};
00213   const char *GetStripsComponentArrayName();
00214   int GetStripsComponentArrayComponent();
00215   int GetStripsComponentMinRange();
00216   int GetStripsComponentMaxRange();
00218   
00220 
00227   void SetCellTypeComponent(char *arrayName, int arrayComp,
00228                             int min, int max);
00229   void SetCellTypeComponent(char *arrayName, int arrayComp)
00230     {this->SetCellTypeComponent(arrayName, arrayComp, -1, -1);};
00231   const char *GetCellTypeComponentArrayName();
00232   int GetCellTypeComponentArrayComponent();
00233   int GetCellTypeComponentMinRange();
00234   int GetCellTypeComponentMaxRange();
00235   void SetCellConnectivityComponent(char *arrayName, int arrayComp,
00236                                     int min, int max);
00237   void SetCellConnectivityComponent(char *arrayName, int arrayComp)
00238     {this->SetCellConnectivityComponent(arrayName, arrayComp, -1, -1);};
00239   const char *GetCellConnectivityComponentArrayName();
00240   int GetCellConnectivityComponentArrayComponent();
00241   int GetCellConnectivityComponentMinRange();
00242   int GetCellConnectivityComponentMaxRange();
00244   
00246 
00248   vtkSetMacro(DefaultNormalize,int);
00249   vtkGetMacro(DefaultNormalize,int);
00250   vtkBooleanMacro(DefaultNormalize,int);
00252 
00254 
00257   vtkSetVector3Macro(Dimensions,int);
00258   vtkGetVectorMacro(Dimensions,int,3);
00260   
00262 
00264   vtkSetVector3Macro(Origin,float);
00265   vtkGetVectorMacro(Origin,float,3);
00267   
00269 
00271   vtkSetVector3Macro(Spacing,float);
00272   vtkGetVectorMacro(Spacing,float,3);
00274   
00276 
00281   void SetDimensionsComponent(char *arrayName, int arrayComp, int min, int max);
00282   void SetDimensionsComponent(char *arrayName, int arrayComp)
00283     {this->SetDimensionsComponent(arrayName, arrayComp, -1, -1);};
00284   void SetSpacingComponent(char *arrayName, int arrayComp, int min, int max);
00285   void SetSpacingComponent(char *arrayName, int arrayComp)
00286     {this->SetSpacingComponent(arrayName, arrayComp, -1, -1);};
00287   void SetOriginComponent(char *arrayName, int arrayComp, int min, int max);
00288   void SetOriginComponent(char *arrayName, int arrayComp)
00289     {this->SetOriginComponent(arrayName, arrayComp, -1, -1);};  
00291 
00292 protected:
00293   vtkDataObjectToDataSetFilter();
00294   ~vtkDataObjectToDataSetFilter();
00295 
00296   void Execute(); //generate output data
00297   void ExecuteInformation();
00298   void ComputeInputUpdateExtents(vtkDataObject *output);
00299 
00300   char Updating;
00301 
00302   // control flags used to generate the output dataset
00303   int DataSetType; //the type of dataset to generate
00304   
00305   // Support definition of points
00306   char *PointArrays[3]; //the name of the arrays
00307   int PointArrayComponents[3]; //the array components used for x-y-z
00308   vtkIdType PointComponentRange[3][2]; //the range of the components to use
00309   int PointNormalize[3]; //flags control normalization
00310 
00311   // These define cells for vtkPolyData
00312   char *VertsArray; //the name of the array
00313   int VertsArrayComponent; //the array component
00314   vtkIdType VertsComponentRange[2]; //the range of the components to use
00315 
00316   char *LinesArray; //the name of the array
00317   int LinesArrayComponent; //the array component used for cell types
00318   vtkIdType LinesComponentRange[2]; //the range of the components to use
00319 
00320   char *PolysArray; //the name of the array
00321   int PolysArrayComponent; //the array component
00322   vtkIdType PolysComponentRange[2]; //the range of the components to use
00323 
00324   char *StripsArray; //the name of the array
00325   int StripsArrayComponent; //the array component
00326   vtkIdType StripsComponentRange[2]; //the range of the components to use
00327 
00328   // Used to define vtkUnstructuredGrid datasets
00329   char *CellTypeArray; //the name of the array
00330   int CellTypeArrayComponent; //the array component used for cell types
00331   vtkIdType CellTypeComponentRange[2]; //the range of the components to use
00332 
00333   char *CellConnectivityArray; //the name of the array
00334   int CellConnectivityArrayComponent; //the array components used for cell connectivity
00335   vtkIdType CellConnectivityComponentRange[2]; //the range of the components to use
00336 
00337   // helper methods (and attributes) to construct datasets
00338   void SetArrayName(char* &name, char *newName);
00339   vtkIdType ConstructPoints(vtkPointSet *ps);
00340   vtkIdType ConstructPoints(vtkRectilinearGrid *rg);
00341   int ConstructCells(vtkPolyData *pd);
00342   int ConstructCells(vtkUnstructuredGrid *ug);
00343   vtkCellArray *ConstructCellArray(vtkDataArray *da, int comp,
00344                                    vtkIdType compRange[2]);
00345 
00346   // Default value for normalization
00347   int DefaultNormalize;
00348 
00349   // Couple of different ways to specify dimensions, spacing, and origin.
00350   int Dimensions[3];
00351   float Origin[3];
00352   float Spacing[3];
00353   
00354   char *DimensionsArray; //the name of the array
00355   int DimensionsArrayComponent; //the component of the array used for dimensions
00356   vtkIdType DimensionsComponentRange[2]; //the ComponentRange of the array for the dimensions
00357   
00358   char *OriginArray; //the name of the array
00359   int OriginArrayComponent; //the component of the array used for Origins
00360   vtkIdType OriginComponentRange[2]; //the ComponentRange of the array for the Origins
00361   
00362   char *SpacingArray; //the name of the array
00363   int SpacingArrayComponent; //the component of the array used for Spacings
00364   vtkIdType SpacingComponentRange[2]; //the ComponentRange of the array for the Spacings
00365   
00366   void ConstructDimensions();
00367   void ConstructSpacing();
00368   void ConstructOrigin();
00369   
00370 private:
00371   vtkDataObjectToDataSetFilter(const vtkDataObjectToDataSetFilter&);  // Not implemented.
00372   void operator=(const vtkDataObjectToDataSetFilter&);  // Not implemented.
00373 };
00374 
00375 #endif

Generated on Thu Mar 28 14:19:20 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001