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 00229 static int UpdateComponentRange(vtkDataArray *da, vtkIdType compRange[2]); 00230 //ETX 00231 00233 virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00234 00235 protected: 00236 vtkFieldDataToAttributeDataFilter(); 00237 ~vtkFieldDataToAttributeDataFilter(); 00238 00239 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); //generate output data 00240 00241 int InputField; 00242 int OutputAttributeData; 00243 00244 int NumberOfScalarComponents; //the number of components to fill-in 00245 char *ScalarArrays[4]; //the name of the arrays used to construct the scalar 00246 int ScalarArrayComponents[4]; //the components of the arrays used to construct 00247 vtkIdType ScalarComponentRange[4][2]; //the range of the components to use 00248 int ScalarNormalize[4]; //flags control normalization 00249 00250 char *VectorArrays[3]; //the name of the arrays used to construct the vectors 00251 int VectorArrayComponents[3]; //the components of the arrays used to construct 00252 vtkIdType VectorComponentRange[3][2]; //the range of the components to use 00253 int VectorNormalize[3]; //flags control normalization 00254 00255 char *GhostLevelArray; //the name of the array used to construct the ghost levels 00256 int GhostLevelArrayComponent; //the component of the array used to construct 00257 vtkIdType GhostLevelComponentRange[2]; //the range of the components to use 00258 int GhostLevelNormalize; //flags control normalization 00259 00260 char *NormalArrays[3]; //the name of the arrays used to construct the normals 00261 int NormalArrayComponents[3]; //the components of the arrays used to construct 00262 vtkIdType NormalComponentRange[3][2]; //the range of the components to use 00263 int NormalNormalize[3]; //flags control normalization 00264 00265 char *TensorArrays[9]; //the name of the arrays used to construct the tensors 00266 int TensorArrayComponents[9]; //the components of the arrays used to construct 00267 vtkIdType TensorComponentRange[9][2]; //the range of the components to use 00268 int TensorNormalize[9]; //flags control normalization 00269 00270 int NumberOfTCoordComponents; //the number of components to fill-in 00271 char *TCoordArrays[3]; //the name of the arrays used to construct the tcoords 00272 int TCoordArrayComponents[3]; //the components of the arrays used to construct 00273 vtkIdType TCoordComponentRange[3][2]; //the range of the components to use 00274 int TCoordNormalize[3]; //flags control normalization 00275 00276 int DefaultNormalize; 00277 00278 void ConstructScalars(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 00279 vtkIdType componentRange[4][2], char *arrays[4], 00280 int arrayComponents[4], int normalize[4], int numComp); 00281 void ConstructVectors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 00282 vtkIdType componentRange[3][2], char *arrays[3], 00283 int arrayComponents[3], int normalize[3]); 00284 void ConstructGhostLevels(int num, vtkFieldData *fd, 00285 vtkDataSetAttributes *attr, 00286 vtkIdType componentRange[2], 00287 char *array, int arrayComponent, int normalize); 00288 void ConstructNormals(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 00289 vtkIdType componentRange[3][2], char *arrays[3], 00290 int arrayComponents[3], int normalize[3]); 00291 void ConstructTCoords(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 00292 vtkIdType componentRange[3][2], char *arrays[3], 00293 int arrayComponents[3], int normalize[3], int numComp); 00294 void ConstructTensors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, 00295 vtkIdType componentRange[9][2], char *arrays[9], 00296 int arrayComponents[9], int normalize[9]); 00297 void ConstructFieldData(int num, vtkDataSetAttributes *attr); 00298 00299 private: 00300 vtkFieldDataToAttributeDataFilter(const vtkFieldDataToAttributeDataFilter&); // Not implemented. 00301 void operator=(const vtkFieldDataToAttributeDataFilter&); // Not implemented. 00302 }; 00303 00304 #endif 00305 00306