00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00070 #ifndef __vtkFieldDataToAttributeDataFilter_h
00071 #define __vtkFieldDataToAttributeDataFilter_h
00072
00073 #include "vtkDataSetToDataSetFilter.h"
00074
00075 #define VTK_DATA_OBJECT_FIELD 0
00076 #define VTK_POINT_DATA_FIELD 1
00077 #define VTK_CELL_DATA_FIELD 2
00078
00079 #define VTK_CELL_DATA 0
00080 #define VTK_POINT_DATA 1
00081
00082 class vtkDataArray;
00083 class vtkDataSetAttributes;
00084 class vtkFieldData;
00085
00086 class VTK_GRAPHICS_EXPORT vtkFieldDataToAttributeDataFilter : public vtkDataSetToDataSetFilter
00087 {
00088 public:
00089 void PrintSelf(ostream& os, vtkIndent indent);
00090 vtkTypeRevisionMacro(vtkFieldDataToAttributeDataFilter,vtkDataSetToDataSetFilter);
00091
00094 static vtkFieldDataToAttributeDataFilter *New();
00095
00097
00101 vtkSetMacro(InputField,int);
00102 vtkGetMacro(InputField,int);
00103 void SetInputFieldToDataObjectField()
00104 {this->SetInputField(VTK_DATA_OBJECT_FIELD);};
00105 void SetInputFieldToPointDataField()
00106 {this->SetInputField(VTK_POINT_DATA_FIELD);};
00107 void SetInputFieldToCellDataField()
00108 {this->SetInputField(VTK_CELL_DATA_FIELD);};
00110
00112
00114 vtkSetMacro(OutputAttributeData,int);
00115 vtkGetMacro(OutputAttributeData,int);
00116 void SetOutputAttributeDataToCellData()
00117 {this->SetOutputAttributeData(VTK_CELL_DATA);};
00118 void SetOutputAttributeDataToPointData()
00119 {this->SetOutputAttributeData(VTK_POINT_DATA);};
00121
00123
00128 void SetScalarComponent(int comp, const char *arrayName, int arrayComp,
00129 int min, int max, int normalize);
00130 void SetScalarComponent(int comp, const char *arrayName, int arrayComp)
00131 {this->SetScalarComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00132 const char *GetScalarComponentArrayName(int comp);
00133 int GetScalarComponentArrayComponent(int comp);
00134 int GetScalarComponentMinRange(int comp);
00135 int GetScalarComponentMaxRange(int comp);
00136 int GetScalarComponentNormalizeFlag(int comp);
00138
00140
00145 void SetVectorComponent(int comp, const char *arrayName, int arrayComp,
00146 int min, int max, int normalize);
00147 void SetVectorComponent(int comp, const char *arrayName, int arrayComp)
00148 {this->SetVectorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00149 const char *GetVectorComponentArrayName(int comp);
00150 int GetVectorComponentArrayComponent(int comp);
00151 int GetVectorComponentMinRange(int comp);
00152 int GetVectorComponentMaxRange(int comp);
00153 int GetVectorComponentNormalizeFlag(int comp);
00155
00157
00162 void SetNormalComponent(int comp, const char *arrayName, int arrayComp,
00163 int min, int max, int normalize);
00164 void SetNormalComponent(int comp, const char *arrayName, int arrayComp)
00165 {this->SetNormalComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00166 const char *GetNormalComponentArrayName(int comp);
00167 int GetNormalComponentArrayComponent(int comp);
00168 int GetNormalComponentMinRange(int comp);
00169 int GetNormalComponentMaxRange(int comp);
00170 int GetNormalComponentNormalizeFlag(int comp);
00172
00174
00179 void SetTensorComponent(int comp, const char *arrayName, int arrayComp,
00180 int min, int max, int normalize);
00181 void SetTensorComponent(int comp, const char *arrayName, int arrayComp)
00182 {this->SetTensorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00183 const char *GetTensorComponentArrayName(int comp);
00184 int GetTensorComponentArrayComponent(int comp);
00185 int GetTensorComponentMinRange(int comp);
00186 int GetTensorComponentMaxRange(int comp);
00187 int GetTensorComponentNormalizeFlag(int comp);
00189
00191
00196 void SetTCoordComponent(int comp, const char *arrayName, int arrayComp,
00197 int min, int max, int normalize);
00198 void SetTCoordComponent(int comp, const char *arrayName, int arrayComp)
00199 {this->SetTCoordComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
00200 const char *GetTCoordComponentArrayName(int comp);
00201 int GetTCoordComponentArrayComponent(int comp);
00202 int GetTCoordComponentMinRange(int comp);
00203 int GetTCoordComponentMaxRange(int comp);
00204 int GetTCoordComponentNormalizeFlag(int comp);
00206
00208
00210 vtkSetMacro(DefaultNormalize,int);
00211 vtkGetMacro(DefaultNormalize,int);
00212 vtkBooleanMacro(DefaultNormalize,int);
00214
00215
00216
00220 static int GetComponentsType(int numComp, vtkDataArray **arrays);
00221
00223
00227 static int ConstructArray(vtkDataArray *da, int comp, vtkDataArray *frray,
00228 int fieldComp, vtkIdType min, vtkIdType max,
00229 int normalize);
00231
00234 static vtkDataArray *GetFieldArray(vtkFieldData *fd, char *name, int comp);
00235
00237 static void SetArrayName(vtkObject *self, char* &name, const char *newName);
00238
00239
00242 static int UpdateComponentRange(vtkDataArray *da, vtkIdType compRange[2]);
00243
00244
00246 virtual void ComputeInputUpdateExtents( vtkDataObject *output );
00247
00248 protected:
00249 vtkFieldDataToAttributeDataFilter();
00250 ~vtkFieldDataToAttributeDataFilter();
00251
00252 void Execute();
00253
00254 int InputField;
00255 int OutputAttributeData;
00256
00257 int NumberOfScalarComponents;
00258 char *ScalarArrays[4];
00259 int ScalarArrayComponents[4];
00260 vtkIdType ScalarComponentRange[4][2];
00261 int ScalarNormalize[4];
00262
00263 char *VectorArrays[3];
00264 int VectorArrayComponents[3];
00265 vtkIdType VectorComponentRange[3][2];
00266 int VectorNormalize[3];
00267
00268 char *GhostLevelArray;
00269 int GhostLevelArrayComponent;
00270 vtkIdType GhostLevelComponentRange[2];
00271 int GhostLevelNormalize;
00272
00273 char *NormalArrays[3];
00274 int NormalArrayComponents[3];
00275 vtkIdType NormalComponentRange[3][2];
00276 int NormalNormalize[3];
00277
00278 char *TensorArrays[9];
00279 int TensorArrayComponents[9];
00280 vtkIdType TensorComponentRange[9][2];
00281 int TensorNormalize[9];
00282
00283 int NumberOfTCoordComponents;
00284 char *TCoordArrays[3];
00285 int TCoordArrayComponents[3];
00286 vtkIdType TCoordComponentRange[3][2];
00287 int TCoordNormalize[3];
00288
00289 int DefaultNormalize;
00290
00291 void ConstructScalars(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
00292 vtkIdType componentRange[4][2], char *arrays[4],
00293 int arrayComponents[4], int normalize[4], int numComp);
00294 void ConstructVectors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
00295 vtkIdType componentRange[3][2], char *arrays[3],
00296 int arrayComponents[3], int normalize[3]);
00297 void ConstructGhostLevels(int num, vtkFieldData *fd,
00298 vtkDataSetAttributes *attr,
00299 vtkIdType componentRange[2],
00300 char *array, int arrayComponent, int normalize);
00301 void ConstructNormals(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
00302 vtkIdType componentRange[3][2], char *arrays[3],
00303 int arrayComponents[3], int normalize[3]);
00304 void ConstructTCoords(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
00305 vtkIdType componentRange[3][2], char *arrays[3],
00306 int arrayComponents[3], int normalize[3], int numComp);
00307 void ConstructTensors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
00308 vtkIdType componentRange[9][2], char *arrays[9],
00309 int arrayComponents[9], int normalize[9]);
00310 void ConstructFieldData(int num, vtkDataSetAttributes *attr);
00311
00312 private:
00313 vtkFieldDataToAttributeDataFilter(const vtkFieldDataToAttributeDataFilter&);
00314 void operator=(const vtkFieldDataToAttributeDataFilter&);
00315 };
00316
00317 #endif
00318
00319