VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkFieldDataToAttributeDataFilter.h 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 =========================================================================*/ 00057 #ifndef __vtkFieldDataToAttributeDataFilter_h 00058 #define __vtkFieldDataToAttributeDataFilter_h 00059 00060 #include "vtkDataSetAlgorithm.h" 00061 00062 #define VTK_DATA_OBJECT_FIELD 0 00063 #define VTK_POINT_DATA_FIELD 1 00064 #define VTK_CELL_DATA_FIELD 2 00065 00066 #define VTK_CELL_DATA 0 00067 #define VTK_POINT_DATA 1 00068 00069 class vtkDataArray; 00070 class vtkDataSetAttributes; 00071 class vtkFieldData; 00072 00073 class VTK_GRAPHICS_EXPORT vtkFieldDataToAttributeDataFilter : public vtkDataSetAlgorithm 00074 { 00075 public: 00076 void PrintSelf(ostream& os, vtkIndent indent); 00077 vtkTypeMacro(vtkFieldDataToAttributeDataFilter,vtkDataSetAlgorithm); 00078 00081 static vtkFieldDataToAttributeDataFilter *New(); 00082 00084 00088 vtkSetMacro(InputField,int); 00089 vtkGetMacro(InputField,int); 00090 void SetInputFieldToDataObjectField() 00091 {this->SetInputField(VTK_DATA_OBJECT_FIELD);}; 00092 void SetInputFieldToPointDataField() 00093 {this->SetInputField(VTK_POINT_DATA_FIELD);}; 00094 void SetInputFieldToCellDataField() 00095 {this->SetInputField(VTK_CELL_DATA_FIELD);}; 00097 00099 00101 vtkSetMacro(OutputAttributeData,int); 00102 vtkGetMacro(OutputAttributeData,int); 00103 void SetOutputAttributeDataToCellData() 00104 {this->SetOutputAttributeData(VTK_CELL_DATA);}; 00105 void SetOutputAttributeDataToPointData() 00106 {this->SetOutputAttributeData(VTK_POINT_DATA);}; 00108 00110 00115 void SetScalarComponent(int comp, const char *arrayName, int arrayComp, 00116 int min, int max, int normalize); 00117 void SetScalarComponent(int comp, const char *arrayName, int arrayComp) 00118 {this->SetScalarComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);}; 00119 const char *GetScalarComponentArrayName(int comp); 00120 int GetScalarComponentArrayComponent(int comp); 00121 int GetScalarComponentMinRange(int comp); 00122 int GetScalarComponentMaxRange(int comp); 00123 int GetScalarComponentNormalizeFlag(int comp); 00125 00127 00132 void SetVectorComponent(int comp, const char *arrayName, int arrayComp, 00133 int min, int max, int normalize); 00134 void SetVectorComponent(int comp, const char *arrayName, int arrayComp) 00135 {this->SetVectorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);}; 00136 const char *GetVectorComponentArrayName(int comp); 00137 int GetVectorComponentArrayComponent(int comp); 00138 int GetVectorComponentMinRange(int comp); 00139 int GetVectorComponentMaxRange(int comp); 00140 int GetVectorComponentNormalizeFlag(int comp); 00142 00144 00149 void SetNormalComponent(int comp, const char *arrayName, int arrayComp, 00150 int min, int max, int normalize); 00151 void SetNormalComponent(int comp, const char *arrayName, int arrayComp) 00152 {this->SetNormalComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);}; 00153 const char *GetNormalComponentArrayName(int comp); 00154 int GetNormalComponentArrayComponent(int comp); 00155 int GetNormalComponentMinRange(int comp); 00156 int GetNormalComponentMaxRange(int comp); 00157 int GetNormalComponentNormalizeFlag(int comp); 00159 00161 00166 void SetTensorComponent(int comp, const char *arrayName, int arrayComp, 00167 int min, int max, int normalize); 00168 void SetTensorComponent(int comp, const char *arrayName, int arrayComp) 00169 {this->SetTensorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);}; 00170 const char *GetTensorComponentArrayName(int comp); 00171 int GetTensorComponentArrayComponent(int comp); 00172 int GetTensorComponentMinRange(int comp); 00173 int GetTensorComponentMaxRange(int comp); 00174 int GetTensorComponentNormalizeFlag(int comp); 00176 00178 00183 void SetTCoordComponent(int comp, const char *arrayName, int arrayComp, 00184 int min, int max, int normalize); 00185 void SetTCoordComponent(int comp, const char *arrayName, int arrayComp) 00186 {this->SetTCoordComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);}; 00187 const char *GetTCoordComponentArrayName(int comp); 00188 int GetTCoordComponentArrayComponent(int comp); 00189 int GetTCoordComponentMinRange(int comp); 00190 int GetTCoordComponentMaxRange(int comp); 00191 int GetTCoordComponentNormalizeFlag(int comp); 00193 00195 00197 vtkSetMacro(DefaultNormalize,int); 00198 vtkGetMacro(DefaultNormalize,int); 00199 vtkBooleanMacro(DefaultNormalize,int); 00201 00202 // Helper functions, made public to support other classes 00203 00207 static int GetComponentsType(int numComp, vtkDataArray **arrays); 00208 00210 00214 static int ConstructArray(vtkDataArray *da, int comp, vtkDataArray *frray, 00215 int fieldComp, vtkIdType min, vtkIdType max, 00216 int normalize); 00218 00221 static vtkDataArray *GetFieldArray(vtkFieldData *fd, char *name, int comp); 00222 00224 static void SetArrayName(vtkObject *self, char* &name, const char *newName); 00225 00226 //BTX 00228 00230 static int UpdateComponentRange(vtkDataArray *da, vtkIdType compRange[2]); 00231 //ETX 00233 00235 virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00236 00237 protected: 00238 vtkFieldDataToAttributeDataFilter(); 00239 ~vtkFieldDataToAttributeDataFilter(); 00240 00241 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); //generate output data 00242 00243 int InputField; 00244 int OutputAttributeData; 00245 00246 int NumberOfScalarComponents; //the number of components to fill-in 00247 char *ScalarArrays[4]; //the name of the arrays used to construct the scalar 00248 int ScalarArrayComponents[4]; //the components of the arrays used to construct 00249 vtkIdType ScalarComponentRange[4][2]; //the range of the components to use 00250 int ScalarNormalize[4]; //flags control normalization 00251 00252 char *VectorArrays[3]; //the name of the arrays used to construct the vectors 00253 int VectorArrayComponents[3]; //the components of the arrays used to construct 00254 vtkIdType VectorComponentRange[3][2]; //the range of the components to use 00255 int VectorNormalize[3]; //flags control normalization 00256 00257 char *GhostLevelArray; //the name of the array used to construct the ghost levels 00258 int GhostLevelArrayComponent; //the component of the array used to construct 00259 vtkIdType GhostLevelComponentRange[2]; //the range of the components to use 00260 int GhostLevelNormalize; //flags control normalization 00261 00262 char *NormalArrays[3]; //the name of the arrays used to construct the normals 00263 int NormalArrayComponents[3]; //the components of the arrays used to construct 00264 vtkIdType NormalComponentRange[3][2]; //the range of the components to use 00265 int NormalNormalize[3]; //flags control normalization 00266 00267 char *TensorArrays[9]; //the name of the arrays used to construct the tensors 00268 int TensorArrayComponents[9]; //the components of the arrays used to construct 00269 vtkIdType TensorComponentRange[9][2]; //the range of the components to use 00270 int TensorNormalize[9]; //flags control normalization 00271 00272 int NumberOfTCoordComponents; //the number of components to fill-in 00273 char *TCoordArrays[3]; //the name of the arrays used to construct the tcoords 00274 int TCoordArrayComponents[3]; //the components of the arrays used to construct 00275 vtkIdType TCoordComponentRange[3][2]; //the range of the components to use 00276 int TCoordNormalize[3]; //flags control normalization 00277 00278 int DefaultNormalize; 00279 00280 void ConstructScalars(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 00281 vtkIdType componentRange[4][2], char *arrays[4], 00282 int arrayComponents[4], int normalize[4], int numComp); 00283 void ConstructVectors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 00284 vtkIdType componentRange[3][2], char *arrays[3], 00285 int arrayComponents[3], int normalize[3]); 00286 void ConstructGhostLevels(int num, vtkFieldData *fd, 00287 vtkDataSetAttributes *attr, 00288 vtkIdType componentRange[2], 00289 char *array, int arrayComponent, int normalize); 00290 void ConstructNormals(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 00291 vtkIdType componentRange[3][2], char *arrays[3], 00292 int arrayComponents[3], int normalize[3]); 00293 void ConstructTCoords(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 00294 vtkIdType componentRange[3][2], char *arrays[3], 00295 int arrayComponents[3], int normalize[3], int numComp); 00296 void ConstructTensors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 00297 vtkIdType componentRange[9][2], char *arrays[9], 00298 int arrayComponents[9], int normalize[9]); 00299 void ConstructFieldData(int num, vtkDataSetAttributes *attr); 00300 00301 private: 00302 vtkFieldDataToAttributeDataFilter(const vtkFieldDataToAttributeDataFilter&); // Not implemented. 00303 void operator=(const vtkFieldDataToAttributeDataFilter&); // Not implemented. 00304 }; 00305 00306 #endif 00307 00308