00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00047 #ifndef __vtkMergeFields_h
00048 #define __vtkMergeFields_h
00049
00050 #include "vtkDataSetAlgorithm.h"
00051
00052 class vtkDataArray;
00053 class vtkFieldData;
00054
00055 class VTK_GRAPHICS_EXPORT vtkMergeFields : public vtkDataSetAlgorithm
00056 {
00057 public:
00058 vtkTypeRevisionMacro(vtkMergeFields,vtkDataSetAlgorithm);
00059 void PrintSelf(ostream& os, vtkIndent indent);
00060
00062 static vtkMergeFields *New();
00063
00066 void SetOutputField(const char* name, int fieldLoc);
00067
00071 void SetOutputField(const char* name, const char* fieldLoc);
00072
00074 void Merge(int component, const char* arrayName, int sourceComp);
00075
00077
00079 vtkSetMacro(NumberOfComponents, int);
00081
00082
00083 enum FieldLocations
00084 {
00085 DATA_OBJECT=0,
00086 POINT_DATA=1,
00087 CELL_DATA=2
00088 };
00089
00090
00091
00092 struct Component
00093 {
00094 int Index;
00095 int SourceIndex;
00096 char* FieldName;
00097 Component* Next;
00098 void SetName(const char* name)
00099 {
00100 delete[] this->FieldName;
00101 this->FieldName = 0;
00102 if (name)
00103 {
00104 this->FieldName = new char[strlen(name)+1];
00105 strcpy(this->FieldName, name);
00106 }
00107 }
00108 Component() { FieldName = 0; }
00109 ~Component() { delete[] FieldName; }
00110 };
00111
00112
00113 protected:
00114
00115
00116 enum FieldType
00117 {
00118 NAME,
00119 ATTRIBUTE
00120 };
00121
00122
00123 vtkMergeFields();
00124 virtual ~vtkMergeFields();
00125
00126 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00127
00128 char* FieldName;
00129 int FieldLocation;
00130 int NumberOfComponents;
00131 int OutputDataType;
00132
00133 static char FieldLocationNames[3][12];
00134
00135
00136 int MergeArray(vtkDataArray* in, vtkDataArray* out, int inComp, int outComp);
00137
00138
00139 Component* Head;
00140 Component* Tail;
00141
00142
00143 Component* GetNextComponent(Component* op)
00144 { return op->Next; }
00145 Component* GetFirst()
00146 { return this->Head; }
00147 void AddComponent(Component* op);
00148 Component* FindComponent(int index);
00149 void DeleteAllComponents();
00150
00151 void PrintComponent(Component* op, ostream& os, vtkIndent indent);
00152 void PrintAllComponents(ostream& os, vtkIndent indent);
00153 private:
00154 vtkMergeFields(const vtkMergeFields&);
00155 void operator=(const vtkMergeFields&);
00156 };
00157
00158 #endif
00159
00160