00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00057 #ifndef __vtkDataSetAttributes_h
00058 #define __vtkDataSetAttributes_h
00059
00060 #include "vtkObject.h"
00061 #include "vtkFieldData.h"
00062
00063 class VTK_COMMON_EXPORT vtkDataSetAttributes : public vtkFieldData
00064 {
00065 public:
00067 static vtkDataSetAttributes *New();
00068
00069 vtkTypeMacro(vtkDataSetAttributes,vtkFieldData);
00070 void PrintSelf(ostream& os, vtkIndent indent);
00071
00073 virtual void Initialize();
00074
00077 virtual void Update() {}
00078
00085 virtual void PassData(vtkFieldData* fd);
00086
00088
00095 void CopyAllocate(vtkDataSetAttributes* pd, vtkIdType sze=0,
00096 vtkIdType ext=1000);
00098
00106 void CopyData(vtkDataSetAttributes *fromPd, vtkIdType fromId, vtkIdType toId);
00107
00109
00112 void InterpolateAllocate(vtkDataSetAttributes* pd, vtkIdType sze=0,
00113 vtkIdType ext=1000);
00115
00117
00119 void InterpolatePoint(vtkDataSetAttributes *fromPd, vtkIdType toId,
00120 vtkIdList *ids, float *weights);
00122
00124
00128 void InterpolateEdge(vtkDataSetAttributes *fromPd, vtkIdType toId,
00129 vtkIdType p1, vtkIdType p2, float t);
00131
00133
00140 void InterpolateTime(vtkDataSetAttributes *from1,
00141 vtkDataSetAttributes *from2,
00142 vtkIdType id, float t);
00144
00147 virtual void DeepCopy(vtkFieldData *pd);
00148
00150 virtual void ShallowCopy(vtkFieldData *pd);
00151
00153
00154 int SetScalars(vtkDataArray* da);
00155 int SetActiveScalars(const char* name);
00156 vtkDataArray* GetScalars();
00158
00160
00161 int SetVectors(vtkDataArray* da);
00162 int SetActiveVectors(const char* name);
00163 vtkDataArray* GetVectors();
00165
00167
00168 int SetNormals(vtkDataArray* da);
00169 int SetActiveNormals(const char* name);
00170 vtkDataArray* GetNormals();
00172
00174
00175 int SetTCoords(vtkDataArray* da);
00176 int SetActiveTCoords(const char* name);
00177 vtkDataArray* GetTCoords();
00179
00181
00182 int SetTensors(vtkDataArray* da);
00183 int SetActiveTensors(const char* name);
00184 vtkDataArray* GetTensors();
00186
00193 int SetActiveAttribute(const char* name, int attributeType);
00194
00196 int SetActiveAttribute(int index, int attributeType);
00197
00199 void SetCopyAttribute (int index, int value);
00200
00202
00208 void SetCopyScalars(int i);
00209 int GetCopyScalars();
00210 vtkBooleanMacro(CopyScalars, int);
00212
00214
00220 void SetCopyVectors(int i);
00221 int GetCopyVectors();
00222 vtkBooleanMacro(CopyVectors, int);
00224
00226
00232 void SetCopyNormals(int i);
00233 int GetCopyNormals();
00234 vtkBooleanMacro(CopyNormals, int);
00236
00238
00244 void SetCopyTCoords(int i);
00245 int GetCopyTCoords();
00246 vtkBooleanMacro(CopyTCoords, int);
00248
00250
00256 void SetCopyTensors(int i);
00257 int GetCopyTensors();
00258 vtkBooleanMacro(CopyTensors, int);
00260
00267 virtual void CopyAllOn();
00268
00275 virtual void CopyAllOff();
00276
00278
00282 void CopyTuple(vtkDataArray *fromData, vtkDataArray *toData,
00283 vtkIdType fromId, vtkIdType toId);
00285
00288 void GetAttributeIndices(int* indexArray);
00289
00294 int IsArrayAnAttribute(int idx);
00295
00298 vtkDataArray* GetAttribute(int attributeType);
00299
00301 virtual void RemoveArray(const char *name);
00302
00303
00304
00305 enum AttributeTypes
00306 {
00307 SCALARS=0,
00308 VECTORS=1,
00309 NORMALS=2,
00310 TCOORDS=3,
00311 TENSORS=4,
00312 NUM_ATTRIBUTES
00313 };
00314
00315 enum AttributeLimitTypes
00316 {
00317 MAX,
00318 EXACT,
00319 NOLIMIT
00320 };
00321
00322
00323
00324
00325 class VTK_COMMON_EXPORT FieldList
00326 {
00327 public:
00328 FieldList(int numInputs);
00329 ~FieldList();
00330
00331 void InitializeFieldList(vtkDataSetAttributes* dsa);
00332 void IntersectFieldList(vtkDataSetAttributes* dsa);
00333
00334
00335 int IsAttributePresent(int attrType);
00336 int IsFieldPresent(const char *name);
00337
00338 friend class vtkDataSetAttributes;
00339
00340 protected:
00341 FieldList(const FieldList&) {}
00342 void operator=(const FieldList&) {}
00343
00344 private:
00345 void SetField(int index, vtkDataArray *da);
00346 void RemoveField(const char *name);
00347 void ClearFields();
00348
00349
00350 char** Fields;
00351 int *FieldTypes;
00352
00353 int *FieldComponents;
00354
00355 int *FieldIndices;
00356
00357 vtkLookupTable **LUT;
00358 vtkIdType NumberOfTuples;
00359 int NumberOfFields;
00360
00361
00362
00363
00364
00365
00366 int **DSAIndices;
00367 int NumberOfDSAIndices;
00368 int CurrentInput;
00369 };
00370
00372
00374 void CopyAllocate(vtkDataSetAttributes::FieldList& list, vtkIdType sze=0,
00375 vtkIdType ext=1000);
00377
00379
00383 void CopyData(vtkDataSetAttributes::FieldList& list,
00384 vtkDataSetAttributes* dsa, int idx, vtkIdType fromId,
00385 vtkIdType toId);
00387
00388 friend class vtkDataSetAttributes::FieldList;
00389
00390
00391 protected:
00392 vtkDataSetAttributes();
00393 ~vtkDataSetAttributes();
00394
00395
00396 void InterpolateTuple(vtkDataArray *fromData, vtkDataArray *toData,
00397 vtkIdType toId, vtkIdList *ptIds, float *weights);
00398 void InterpolateTuple(vtkDataArray *fromData, vtkDataArray *toData,
00399 vtkIdType toId, vtkIdType id1, vtkIdType id2, float t);
00400 void InterpolateTuple(vtkDataArray *fromData1, vtkDataArray *fromData2,
00401 vtkDataArray *toData, vtkIdType id, float t);
00402
00403 int AttributeIndices[NUM_ATTRIBUTES];
00404 int CopyAttributeFlags[NUM_ATTRIBUTES];
00405
00406
00407 vtkFieldData::BasicIterator RequiredArrays;
00408
00409
00410 int* TargetIndices;
00411
00412 virtual void RemoveArray(int index);
00413
00414 static int NumberOfAttributeComponents[NUM_ATTRIBUTES];
00415 static int AttributeLimits[NUM_ATTRIBUTES];
00416 static char AttributeNames[NUM_ATTRIBUTES][10];
00417
00418 private:
00419 int SetAttribute(vtkDataArray* da, int attributeType);
00420 static int CheckNumberOfComponents(vtkDataArray* da, int attributeType);
00421
00422
00423 vtkFieldData::BasicIterator ComputeRequiredArrays(vtkDataSetAttributes* pd);
00424
00425
00426 private:
00427 vtkDataSetAttributes(const vtkDataSetAttributes&);
00428 void operator=(const vtkDataSetAttributes&);
00429 };
00430
00431 #endif
00432
00433