vtkSplitField.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00067 #ifndef __vtkSplitField_h
00068 #define __vtkSplitField_h
00069
00070 #include "vtkDataSetToDataSetFilter.h"
00071
00072 #include "vtkDataSetAttributes.h"
00073
00074 class vtkFieldData;
00075
00076 class VTK_GRAPHICS_EXPORT vtkSplitField : public vtkDataSetToDataSetFilter
00077 {
00078 public:
00079 vtkTypeRevisionMacro(vtkSplitField,vtkDataSetToDataSetFilter);
00080 void PrintSelf(ostream& os, vtkIndent indent);
00081
00083 static vtkSplitField *New();
00084
00087 void SetInputField(int attributeType, int fieldLoc);
00088
00091 void SetInputField(const char* name, int fieldLoc);
00092
00095 void SetInputField(const char* name, const char* fieldLoc);
00096
00098 void Split(int component, const char* arrayName);
00099
00100
00101 enum FieldLocations
00102 {
00103 DATA_OBJECT=0,
00104 POINT_DATA=1,
00105 CELL_DATA=2
00106 };
00107
00108
00109
00110 struct Component
00111 {
00112 int Index;
00113 char* FieldName;
00114 Component* Next;
00115 void SetName(const char* name)
00116 {
00117 delete[] this->FieldName;
00118 this->FieldName = 0;
00119 if (name)
00120 {
00121 this->FieldName = new char[strlen(name)+1];
00122 strcpy(this->FieldName, name);
00123 }
00124 }
00125 Component() { FieldName = 0; }
00126 ~Component() { delete[] FieldName; }
00127 };
00128
00129
00130 protected:
00131
00132
00133 enum FieldTypes
00134 {
00135 NAME,
00136 ATTRIBUTE
00137 };
00138
00139
00140 vtkSplitField();
00141 virtual ~vtkSplitField();
00142
00143 void Execute();
00144
00145 char* FieldName;
00146 int FieldType;
00147 int AttributeType;
00148 int FieldLocation;
00149
00150 static char FieldLocationNames[3][12];
00151 static char AttributeNames[vtkDataSetAttributes::NUM_ATTRIBUTES][10];
00152
00153 vtkDataArray* SplitArray(vtkDataArray* da, int component);
00154
00155
00156
00157 Component* Head;
00158 Component* Tail;
00159
00160
00161 Component* GetNextComponent(Component* op)
00162 { return op->Next; }
00163 Component* GetFirst()
00164 { return this->Head; }
00165 void AddComponent(Component* op);
00166 Component* FindComponent(int index);
00167 void DeleteAllComponents();
00168
00169 void PrintComponent(Component* op, ostream& os, vtkIndent indent);
00170 void PrintAllComponents(ostream& os, vtkIndent indent);
00171 private:
00172 vtkSplitField(const vtkSplitField&);
00173 void operator=(const vtkSplitField&);
00174 };
00175
00176 #endif
00177
00178