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 "vtkFiltersCoreModule.h" // For export macro 00061 #include "vtkDataSetAlgorithm.h" 00062 00063 #define VTK_DATA_OBJECT_FIELD 0 00064 #define VTK_POINT_DATA_FIELD 1 00065 #define VTK_CELL_DATA_FIELD 2 00066 00067 #define VTK_CELL_DATA 0 00068 #define VTK_POINT_DATA 1 00069 00070 class vtkDataArray; 00071 class vtkDataSetAttributes; 00072 class vtkFieldData; 00073 00074 class VTKFILTERSCORE_EXPORT vtkFieldDataToAttributeDataFilter : public vtkDataSetAlgorithm 00075 { 00076 public: 00077 void PrintSelf(ostream& os, vtkIndent indent); 00078 vtkTypeMacro(vtkFieldDataToAttributeDataFilter,vtkDataSetAlgorithm); 00079 00082 static vtkFieldDataToAttributeDataFilter *New(); 00083 00085 00089 vtkSetMacro(InputField,int); 00090 vtkGetMacro(InputField,int); 00091 void SetInputFieldToDataObjectField() 00092 {this->SetInputField(VTK_DATA_OBJECT_FIELD);}; 00093 void SetInputFieldToPointDataField() 00094 {this->SetInputField(VTK_POINT_DATA_FIELD);}; 00095 void SetInputFieldToCellDataField() 00096 {this->SetInputField(VTK_CELL_DATA_FIELD);}; 00098 00100 00102 vtkSetMacro(OutputAttributeData,int); 00103 vtkGetMacro(OutputAttributeData,int); 00104 void SetOutputAttributeDataToCellData() 00105 {this->SetOutputAttributeData(VTK_CELL_DATA);}; 00106 void SetOutputAttributeDataToPointData() 00107 {this->SetOutputAttributeData(VTK_POINT_DATA);}; 00109 00111 00116 void SetScalarComponent(int comp, const char *arrayName, int arrayComp, 00117 int min, int max, int normalize); 00118 void SetScalarComponent(int comp, const char *arrayName, int arrayComp) 00119 {this->SetScalarComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);}; 00120 const char *GetScalarComponentArrayName(int comp); 00121 int GetScalarComponentArrayComponent(int comp); 00122 int GetScalarComponentMinRange(int comp); 00123 int GetScalarComponentMaxRange(int comp); 00124 int GetScalarComponentNormalizeFlag(int comp); 00126 00128 00133 void SetVectorComponent(int comp, const char *arrayName, int arrayComp, 00134 int min, int max, int normalize); 00135 void SetVectorComponent(int comp, const char *arrayName, int arrayComp) 00136 {this->SetVectorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);}; 00137 const char *GetVectorComponentArrayName(int comp); 00138 int GetVectorComponentArrayComponent(int comp); 00139 int GetVectorComponentMinRange(int comp); 00140 int GetVectorComponentMaxRange(int comp); 00141 int GetVectorComponentNormalizeFlag(int comp); 00143 00145 00150 void SetNormalComponent(int comp, const char *arrayName, int arrayComp, 00151 int min, int max, int normalize); 00152 void SetNormalComponent(int comp, const char *arrayName, int arrayComp) 00153 {this->SetNormalComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);}; 00154 const char *GetNormalComponentArrayName(int comp); 00155 int GetNormalComponentArrayComponent(int comp); 00156 int GetNormalComponentMinRange(int comp); 00157 int GetNormalComponentMaxRange(int comp); 00158 int GetNormalComponentNormalizeFlag(int comp); 00160 00162 00167 void SetTensorComponent(int comp, const char *arrayName, int arrayComp, 00168 int min, int max, int normalize); 00169 void SetTensorComponent(int comp, const char *arrayName, int arrayComp) 00170 {this->SetTensorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);}; 00171 const char *GetTensorComponentArrayName(int comp); 00172 int GetTensorComponentArrayComponent(int comp); 00173 int GetTensorComponentMinRange(int comp); 00174 int GetTensorComponentMaxRange(int comp); 00175 int GetTensorComponentNormalizeFlag(int comp); 00177 00179 00184 void SetTCoordComponent(int comp, const char *arrayName, int arrayComp, 00185 int min, int max, int normalize); 00186 void SetTCoordComponent(int comp, const char *arrayName, int arrayComp) 00187 {this->SetTCoordComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);}; 00188 const char *GetTCoordComponentArrayName(int comp); 00189 int GetTCoordComponentArrayComponent(int comp); 00190 int GetTCoordComponentMinRange(int comp); 00191 int GetTCoordComponentMaxRange(int comp); 00192 int GetTCoordComponentNormalizeFlag(int comp); 00194 00196 00198 vtkSetMacro(DefaultNormalize,int); 00199 vtkGetMacro(DefaultNormalize,int); 00200 vtkBooleanMacro(DefaultNormalize,int); 00202 00203 // Helper functions, made public to support other classes 00204 00208 static int GetComponentsType(int numComp, vtkDataArray **arrays); 00209 00211 00215 static int ConstructArray(vtkDataArray *da, int comp, vtkDataArray *frray, 00216 int fieldComp, vtkIdType min, vtkIdType max, 00217 int normalize); 00219 00222 static vtkDataArray *GetFieldArray(vtkFieldData *fd, char *name, int comp); 00223 00225 static void SetArrayName(vtkObject *self, char* &name, const char *newName); 00226 00227 //BTX 00229 00231 static int UpdateComponentRange(vtkDataArray *da, vtkIdType compRange[2]); 00232 //ETX 00234 00236 virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00237 00238 protected: 00239 vtkFieldDataToAttributeDataFilter(); 00240 ~vtkFieldDataToAttributeDataFilter(); 00241 00242 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); //generate output data 00243 00244 int InputField; 00245 int OutputAttributeData; 00246 00247 int NumberOfScalarComponents; //the number of components to fill-in 00248 char *ScalarArrays[4]; //the name of the arrays used to construct the scalar 00249 int ScalarArrayComponents[4]; //the components of the arrays used to construct 00250 vtkIdType ScalarComponentRange[4][2]; //the range of the components to use 00251 int ScalarNormalize[4]; //flags control normalization 00252 00253 char *VectorArrays[3]; //the name of the arrays used to construct the vectors 00254 int VectorArrayComponents[3]; //the components of the arrays used to construct 00255 vtkIdType VectorComponentRange[3][2]; //the range of the components to use 00256 int VectorNormalize[3]; //flags control normalization 00257 00258 char *GhostLevelArray; //the name of the array used to construct the ghost levels 00259 int GhostLevelArrayComponent; //the component of the array used to construct 00260 vtkIdType GhostLevelComponentRange[2]; //the range of the components to use 00261 int GhostLevelNormalize; //flags control normalization 00262 00263 char *NormalArrays[3]; //the name of the arrays used to construct the normals 00264 int NormalArrayComponents[3]; //the components of the arrays used to construct 00265 vtkIdType NormalComponentRange[3][2]; //the range of the components to use 00266 int NormalNormalize[3]; //flags control normalization 00267 00268 char *TensorArrays[9]; //the name of the arrays used to construct the tensors 00269 int TensorArrayComponents[9]; //the components of the arrays used to construct 00270 vtkIdType TensorComponentRange[9][2]; //the range of the components to use 00271 int TensorNormalize[9]; //flags control normalization 00272 00273 int NumberOfTCoordComponents; //the number of components to fill-in 00274 char *TCoordArrays[3]; //the name of the arrays used to construct the tcoords 00275 int TCoordArrayComponents[3]; //the components of the arrays used to construct 00276 vtkIdType TCoordComponentRange[3][2]; //the range of the components to use 00277 int TCoordNormalize[3]; //flags control normalization 00278 00279 int DefaultNormalize; 00280 00281 void ConstructScalars(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 00282 vtkIdType componentRange[4][2], char *arrays[4], 00283 int arrayComponents[4], int normalize[4], int numComp); 00284 void ConstructVectors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 00285 vtkIdType componentRange[3][2], char *arrays[3], 00286 int arrayComponents[3], int normalize[3]); 00287 void ConstructGhostLevels(int num, vtkFieldData *fd, 00288 vtkDataSetAttributes *attr, 00289 vtkIdType componentRange[2], 00290 char *array, int arrayComponent, int normalize); 00291 void ConstructNormals(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 00292 vtkIdType componentRange[3][2], char *arrays[3], 00293 int arrayComponents[3], int normalize[3]); 00294 void ConstructTCoords(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 00295 vtkIdType componentRange[3][2], char *arrays[3], 00296 int arrayComponents[3], int normalize[3], int numComp); 00297 void ConstructTensors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 00298 vtkIdType componentRange[9][2], char *arrays[9], 00299 int arrayComponents[9], int normalize[9]); 00300 void ConstructFieldData(int num, vtkDataSetAttributes *attr); 00301 00302 private: 00303 vtkFieldDataToAttributeDataFilter(const vtkFieldDataToAttributeDataFilter&); // Not implemented. 00304 void operator=(const vtkFieldDataToAttributeDataFilter&); // Not implemented. 00305 }; 00306 00307 #endif 00308 00309