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

dox/Graphics/vtkMergeFields.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkMergeFields.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 =========================================================================*/ 00051 #ifndef __vtkMergeFields_h 00052 #define __vtkMergeFields_h 00053 00054 #include "vtkDataSetToDataSetFilter.h" 00055 00056 class vtkDataArray; 00057 class vtkFieldData; 00058 00059 class VTK_GRAPHICS_EXPORT vtkMergeFields : public vtkDataSetToDataSetFilter 00060 { 00061 public: 00062 vtkTypeRevisionMacro(vtkMergeFields,vtkDataSetToDataSetFilter); 00063 void PrintSelf(ostream& os, vtkIndent indent); 00064 00066 static vtkMergeFields *New(); 00067 00070 void SetOutputField(const char* name, int fieldLoc); 00071 00075 void SetOutputField(const char* name, const char* fieldLoc); 00076 00078 void Merge(int component, const char* arrayName, int sourceComp); 00079 00081 00083 vtkSetMacro(NumberOfComponents, int); 00085 00086 //BTX 00087 enum FieldLocations 00088 { 00089 DATA_OBJECT=0, 00090 POINT_DATA=1, 00091 CELL_DATA=2 00092 }; 00093 //ETX 00094 00095 //BTX 00096 struct Component 00097 { 00098 int Index; 00099 int SourceIndex; 00100 char* FieldName; 00101 Component* Next; // linked list 00102 void SetName(const char* name) 00103 { 00104 delete[] this->FieldName; 00105 this->FieldName = 0; 00106 if (name) 00107 { 00108 this->FieldName = new char[strlen(name)+1]; 00109 strcpy(this->FieldName, name); 00110 } 00111 } 00112 Component() { FieldName = 0; } 00113 ~Component() { delete[] FieldName; } 00114 }; 00115 //ETX 00116 00117 protected: 00118 00119 //BTX 00120 enum FieldType 00121 { 00122 NAME, 00123 ATTRIBUTE 00124 }; 00125 //ETX 00126 00127 vtkMergeFields(); 00128 virtual ~vtkMergeFields(); 00129 00130 void Execute(); 00131 00132 char* FieldName; 00133 int FieldLocation; 00134 int NumberOfComponents; 00135 int OutputDataType; 00136 00137 static char FieldLocationNames[3][12]; 00138 00139 00140 int MergeArray(vtkDataArray* in, vtkDataArray* out, int inComp, int outComp); 00141 00142 // Components are stored as a linked list. 00143 Component* Head; 00144 Component* Tail; 00145 00146 // Methods to browse/modify the linked list. 00147 Component* GetNextComponent(Component* op) 00148 { return op->Next; } 00149 Component* GetFirst() 00150 { return this->Head; } 00151 void AddComponent(Component* op); 00152 Component* FindComponent(int index); 00153 void DeleteAllComponents(); 00154 00155 void PrintComponent(Component* op, ostream& os, vtkIndent indent); 00156 void PrintAllComponents(ostream& os, vtkIndent indent); 00157 private: 00158 vtkMergeFields(const vtkMergeFields&); // Not implemented. 00159 void operator=(const vtkMergeFields&); // Not implemented. 00160 }; 00161 00162 #endif 00163 00164