00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00074 #ifndef __vtkRearrangeFields_h
00075 #define __vtkRearrangeFields_h
00076
00077 #include "vtkDataSetToDataSetFilter.h"
00078
00079 #include "vtkDataSetAttributes.h"
00080
00081 class vtkFieldData;
00082
00083 class VTK_GRAPHICS_EXPORT vtkRearrangeFields : public vtkDataSetToDataSetFilter
00084 {
00085 public:
00086 vtkTypeRevisionMacro(vtkRearrangeFields,vtkDataSetToDataSetFilter);
00087 void PrintSelf(ostream& os, vtkIndent indent);
00088
00090 static vtkRearrangeFields *New();
00091
00092
00093 enum OperationType
00094 {
00095 COPY=0,
00096 MOVE=1
00097 };
00098 enum FieldLocation
00099 {
00100 DATA_OBJECT=0,
00101 POINT_DATA=1,
00102 CELL_DATA=2
00103 };
00104
00105
00107
00110 int AddOperation(int operationType, int attributeType, int fromFieldLoc,
00111 int toFieldLoc);
00112
00113
00114
00115
00116 int AddOperation(int operationType, const char* name, int fromFieldLoc,
00117 int toFieldLoc);
00118
00119
00120
00121
00122 int AddOperation(const char* operationType, const char* attributeType,
00123 const char* fromFieldLoc, const char* toFieldLoc);
00125
00127
00128 int RemoveOperation(int operationId);
00129
00130
00131
00132 int RemoveOperation(int operationType, int attributeType, int fromFieldLoc,
00133 int toFieldLoc);
00134
00135
00136
00137 int RemoveOperation(int operationType, const char* name, int fromFieldLoc,
00138 int toFieldLoc);
00139
00140
00141
00142 int RemoveOperation(const char* operationType, const char* attributeType,
00143 const char* fromFieldLoc, const char* toFieldLoc);
00145
00147
00148 void RemoveAllOperations()
00149 {
00150 this->Modified();
00151 this->LastId = 0;
00152 this->DeleteAllOperations();
00153 }
00155
00156
00157 enum FieldType
00158 {
00159 NAME,
00160 ATTRIBUTE
00161 };
00162
00163 struct Operation
00164 {
00165 int OperationType;
00166 int FieldType;
00167 char* FieldName;
00168 int AttributeType;
00169 int FromFieldLoc;
00170 int ToFieldLoc;
00171 int Id;
00172 Operation* Next;
00173 Operation() { FieldName = 0; }
00174 ~Operation() { delete[] FieldName; }
00175 };
00176
00177
00178 protected:
00179
00180 vtkRearrangeFields();
00181 virtual ~vtkRearrangeFields();
00182
00183 void Execute();
00184
00185
00186
00187 Operation* Head;
00188 Operation* Tail;
00189
00190
00191 int LastId;
00192
00193
00194 Operation* GetNextOperation(Operation* op)
00195 { return op->Next; }
00196 Operation* GetFirst()
00197 { return this->Head; }
00198 void AddOperation(Operation* op);
00199 void DeleteOperation(Operation* op, Operation* before);
00200 Operation* FindOperation(int id, Operation*& before);
00201 Operation* FindOperation(const char* name, Operation*& before);
00202 Operation* FindOperation(int operationType, const char* name,
00203 int fromFieldLoc, int toFieldLoc,
00204 Operation*& before);
00205 Operation* FindOperation(int operationType, int attributeType,
00206 int fromFieldLoc, int toFieldLoc,
00207 Operation*& before);
00208
00209 int CompareOperationsByType(const Operation* op1, const Operation* op2);
00210 int CompareOperationsByName(const Operation* op1, const Operation* op2);
00211
00212 void DeleteAllOperations();
00213 void ApplyOperation(Operation* op, vtkDataSet* input, vtkDataSet* output);
00214
00215
00216 vtkFieldData* GetFieldDataFromLocation(vtkDataSet* ds, int fieldLoc);
00217
00218
00219
00220 static char OperationTypeNames[2][5];
00221 static char FieldLocationNames[3][12];
00222 static char AttributeNames[vtkDataSetAttributes::NUM_ATTRIBUTES][10];
00223
00224 void PrintAllOperations(ostream& os, vtkIndent indent);
00225 void PrintOperation(Operation* op, ostream& os, vtkIndent indent);
00226 private:
00227 vtkRearrangeFields(const vtkRearrangeFields&);
00228 void operator=(const vtkRearrangeFields&);
00229 };
00230
00231 #endif
00232
00233