Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

graphics/vtkFieldDataToAttributeDataFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkFieldDataToAttributeDataFilter.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 =========================================================================*/
00084 #ifndef __vtkFieldDataToAttributeDataFilter_h
00085 #define __vtkFieldDataToAttributeDataFilter_h
00086 
00087 #include "vtkDataSetToDataSetFilter.h"
00088 
00089 #define VTK_DATA_OBJECT_FIELD 0
00090 #define VTK_POINT_DATA_FIELD 1
00091 #define VTK_CELL_DATA_FIELD 2
00092 
00093 #define VTK_CELL_DATA 0
00094 #define VTK_POINT_DATA 1
00095 
00096 class VTK_EXPORT vtkFieldDataToAttributeDataFilter : public vtkDataSetToDataSetFilter
00097 {
00098 public:
00099   void PrintSelf(ostream& os, vtkIndent indent);
00100   vtkTypeMacro(vtkFieldDataToAttributeDataFilter,vtkDataSetToDataSetFilter);
00101 
00104   static vtkFieldDataToAttributeDataFilter *New();
00105 
00110   vtkSetMacro(InputField,int);
00111   vtkGetMacro(InputField,int);
00112   void SetInputFieldToDataObjectField() 
00113     {this->SetInputField(VTK_DATA_OBJECT_FIELD);};
00114   void SetInputFieldToPointDataField() 
00115     {this->SetInputField(VTK_POINT_DATA_FIELD);};
00116   void SetInputFieldToCellDataField() 
00117     {this->SetInputField(VTK_CELL_DATA_FIELD);};
00118   
00121   vtkSetMacro(OutputAttributeData,int);
00122   vtkGetMacro(OutputAttributeData,int);
00123   void SetOutputAttributeDataToCellData() 
00124     {this->SetOutputAttributeData(VTK_CELL_DATA);};
00125   void SetOutputAttributeDataToPointData() 
00126     {this->SetOutputAttributeData(VTK_POINT_DATA);};
00127 
00133   void SetScalarComponent(int comp, const char *arrayName, int arrayComp,
00134            int min, int max, int normalize);
00135   void SetScalarComponent(int comp, const char *arrayName, int arrayComp)
00136     {this->SetScalarComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00137   const char *GetScalarComponentArrayName(int comp);
00138   int GetScalarComponentArrayComponent(int comp);
00139   int GetScalarComponentMinRange(int comp);
00140   int GetScalarComponentMaxRange(int comp);
00141   int GetScalarComponentNormalizeFlag(int comp);
00142   
00148   void SetVectorComponent(int comp, const char *arrayName, int arrayComp,
00149            int min, int max, int normalize);
00150   void SetVectorComponent(int comp, const char *arrayName, int arrayComp)
00151     {this->SetVectorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00152   const char *GetVectorComponentArrayName(int comp);
00153   int GetVectorComponentArrayComponent(int comp);
00154   int GetVectorComponentMinRange(int comp);
00155   int GetVectorComponentMaxRange(int comp);
00156   int GetVectorComponentNormalizeFlag(int comp);
00157   
00163   void SetGhostLevelComponent(const char *arrayName, int arrayComp,
00164                int min, int max, int normalize);
00165   void SetGhostLevelComponent(const char *arrayName, int arrayComp)
00166     {this->SetGhostLevelComponent(arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00167   const char *GetGhostLevelComponentArrayName();
00168   int GetGhostLevelComponentArrayComponent();
00169   int GetGhostLevelComponentMinRange();
00170   int GetGhostLevelComponentMaxRange();
00171   int GetGhostLevelComponentNormalizeFlag();
00172   
00178   void SetNormalComponent(int comp, const char *arrayName, int arrayComp,
00179            int min, int max, int normalize);
00180   void SetNormalComponent(int comp, const char *arrayName, int arrayComp)
00181     {this->SetNormalComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00182   const char *GetNormalComponentArrayName(int comp);
00183   int GetNormalComponentArrayComponent(int comp);
00184   int GetNormalComponentMinRange(int comp);
00185   int GetNormalComponentMaxRange(int comp);
00186   int GetNormalComponentNormalizeFlag(int comp);
00187   
00193   void SetTensorComponent(int comp, const char *arrayName, int arrayComp,
00194            int min, int max, int normalize);
00195   void SetTensorComponent(int comp, const char *arrayName, int arrayComp)
00196     {this->SetTensorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00197   const char *GetTensorComponentArrayName(int comp);
00198   int GetTensorComponentArrayComponent(int comp);
00199   int GetTensorComponentMinRange(int comp);
00200   int GetTensorComponentMaxRange(int comp);
00201   int GetTensorComponentNormalizeFlag(int comp);
00202   
00208   void SetTCoordComponent(int comp, const char *arrayName, int arrayComp,
00209            int min, int max, int normalize);
00210   void SetTCoordComponent(int comp, const char *arrayName, int arrayComp)
00211     {this->SetTCoordComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00212   const char *GetTCoordComponentArrayName(int comp);
00213   int GetTCoordComponentArrayComponent(int comp);
00214   int GetTCoordComponentMinRange(int comp);
00215   int GetTCoordComponentMaxRange(int comp);
00216   int GetTCoordComponentNormalizeFlag(int comp);
00217   
00220   vtkSetMacro(DefaultNormalize,int);
00221   vtkGetMacro(DefaultNormalize,int);
00222   vtkBooleanMacro(DefaultNormalize,int);
00223 
00224   // Helper functions, made public to support other classes
00225 
00229   static int GetComponentsType(int numComp, vtkDataArray **arrays);
00230 
00235   static int ConstructArray(vtkDataArray *da, int comp, vtkDataArray *frray,
00236            int fieldComp, int min, int max, int normalize);
00237 
00240   static vtkDataArray *GetFieldArray(vtkFieldData *fd, char *name, int comp);
00241   
00243   static void SetArrayName(vtkObject *self, char* &name, const char *newName);
00244   
00247   static int UpdateComponentRange(vtkDataArray *da, int compRange[2]);
00248 
00249 protected:
00250   vtkFieldDataToAttributeDataFilter();
00251   ~vtkFieldDataToAttributeDataFilter();
00252   vtkFieldDataToAttributeDataFilter(const vtkFieldDataToAttributeDataFilter&) {};
00253   void operator=(const vtkFieldDataToAttributeDataFilter&) {};
00254 
00255   void Execute(); //generate output data
00256 
00257   int InputField;
00258   int OutputAttributeData;
00259 
00260   int NumberOfScalarComponents; //the number of components to fill-in
00261   char *ScalarArrays[4]; //the name of the arrays used to construct the scalar
00262   int ScalarArrayComponents[4]; //the components of the arrays used to construct
00263   int ScalarComponentRange[4][2]; //the range of the components to use
00264   int ScalarNormalize[4]; //flags control normalization
00265   
00266   char *VectorArrays[3]; //the name of the arrays used to construct the vectors
00267   int VectorArrayComponents[3]; //the components of the arrays used to construct
00268   int VectorComponentRange[3][2]; //the range of the components to use
00269   int VectorNormalize[3]; //flags control normalization
00270   
00271   char *GhostLevelArray; //the name of the array used to construct the ghost levels
00272   int GhostLevelArrayComponent; //the component of the array used to construct
00273   int GhostLevelComponentRange[2]; //the range of the components to use
00274   int GhostLevelNormalize; //flags control normalization
00275   
00276   char *NormalArrays[3]; //the name of the arrays used to construct the normals
00277   int NormalArrayComponents[3]; //the components of the arrays used to construct
00278   int NormalComponentRange[3][2]; //the range of the components to use
00279   int NormalNormalize[3]; //flags control normalization
00280   
00281   char *TensorArrays[9]; //the name of the arrays used to construct the tensors
00282   int TensorArrayComponents[9]; //the components of the arrays used to construct
00283   int TensorComponentRange[9][2]; //the range of the components to use
00284   int TensorNormalize[9]; //flags control normalization
00285   
00286   int NumberOfTCoordComponents; //the number of components to fill-in
00287   char *TCoordArrays[3]; //the name of the arrays used to construct the tcoords
00288   int TCoordArrayComponents[3]; //the components of the arrays used to construct
00289   int TCoordComponentRange[3][2]; //the range of the components to use
00290   int TCoordNormalize[3]; //flags control normalization
00291   
00292   int DefaultNormalize;
00293 
00294   void ConstructScalars(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 
00295          int componentRange[4][2], char *arrays[4], 
00296          int arrayComponents[4], int normalize[4], int numComp);
00297   void ConstructVectors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 
00298          int componentRange[3][2], char *arrays[3], 
00299          int arrayComponents[3], int normalize[3]);
00300   void ConstructGhostLevels(int num, vtkFieldData *fd,
00301              vtkDataSetAttributes *attr, int componentRange[2], 
00302              char *array, int arrayComponent, int normalize);
00303   void ConstructNormals(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 
00304          int componentRange[3][2], char *arrays[3], 
00305          int arrayComponents[3], int normalize[3]);
00306   void ConstructTCoords(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 
00307          int componentRange[3][2], char *arrays[3], 
00308          int arrayComponents[3], int normalize[3], int numComp);
00309   void ConstructTensors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 
00310          int componentRange[9][2], char *arrays[9], 
00311          int arrayComponents[9], int normalize[9]);
00312   void ConstructFieldData(int num, vtkDataSetAttributes *attr);
00313   
00314 };
00315 
00316 #endif
00317 
00318 

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