Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

dox/Graphics/vtkSplitField.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkSplitField.h,v $ 00005 Language: C++ 00006 00007 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 00008 All rights reserved. 00009 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notice for more information. 00014 00015 =========================================================================*/ 00060 #ifndef __vtkSplitField_h 00061 #define __vtkSplitField_h 00062 00063 #include "vtkDataSetToDataSetFilter.h" 00064 00065 #include "vtkDataSetAttributes.h" // Needed for NUM_ATTRIBUTES 00066 00067 class vtkFieldData; 00068 00069 class VTK_GRAPHICS_EXPORT vtkSplitField : public vtkDataSetToDataSetFilter 00070 { 00071 public: 00072 vtkTypeRevisionMacro(vtkSplitField,vtkDataSetToDataSetFilter); 00073 void PrintSelf(ostream& os, vtkIndent indent); 00074 00076 static vtkSplitField *New(); 00077 00080 void SetInputField(int attributeType, int fieldLoc); 00081 00084 void SetInputField(const char* name, int fieldLoc); 00085 00088 void SetInputField(const char* name, const char* fieldLoc); 00089 00091 void Split(int component, const char* arrayName); 00092 00093 //BTX 00094 enum FieldLocations 00095 { 00096 DATA_OBJECT=0, 00097 POINT_DATA=1, 00098 CELL_DATA=2 00099 }; 00100 //ETX 00101 00102 //BTX 00103 struct Component 00104 { 00105 int Index; 00106 char* FieldName; 00107 Component* Next; // linked list 00108 void SetName(const char* name) 00109 { 00110 delete[] this->FieldName; 00111 this->FieldName = 0; 00112 if (name) 00113 { 00114 this->FieldName = new char[strlen(name)+1]; 00115 strcpy(this->FieldName, name); 00116 } 00117 } 00118 Component() { FieldName = 0; } 00119 ~Component() { delete[] FieldName; } 00120 }; 00121 //ETX 00122 00123 protected: 00124 00125 //BTX 00126 enum FieldTypes 00127 { 00128 NAME, 00129 ATTRIBUTE 00130 }; 00131 //ETX 00132 00133 vtkSplitField(); 00134 virtual ~vtkSplitField(); 00135 00136 void Execute(); 00137 00138 char* FieldName; 00139 int FieldType; 00140 int AttributeType; 00141 int FieldLocation; 00142 00143 static char FieldLocationNames[3][12]; 00144 static char AttributeNames[vtkDataSetAttributes::NUM_ATTRIBUTES][10]; 00145 00146 vtkDataArray* SplitArray(vtkDataArray* da, int component); 00147 00148 00149 // Components are stored as a linked list. 00150 Component* Head; 00151 Component* Tail; 00152 00153 // Methods to browse/modify the linked list. 00154 Component* GetNextComponent(Component* op) 00155 { return op->Next; } 00156 Component* GetFirst() 00157 { return this->Head; } 00158 void AddComponent(Component* op); 00159 Component* FindComponent(int index); 00160 void DeleteAllComponents(); 00161 00162 void PrintComponent(Component* op, ostream& os, vtkIndent indent); 00163 void PrintAllComponents(ostream& os, vtkIndent indent); 00164 private: 00165 vtkSplitField(const vtkSplitField&); // Not implemented. 00166 void operator=(const vtkSplitField&); // Not implemented. 00167 }; 00168 00169 #endif 00170 00171