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