Graphics/vtkSplitField.h Source File

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

# 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 =========================================================================*/
    00071 #ifndef __vtkSplitField_h
    00072 #define __vtkSplitField_h
    00073
    00074 #include "vtkDataSetToDataSetFilter.h"
    00075
    00076 #include "vtkDataSetAttributes.h" // Needed for NUM_ATTRIBUTES
    00077
    00078 class vtkFieldData;
    00079
    00080 class VTK_GRAPHICS_EXPORT vtkSplitField : public vtkDataSetToDataSetFilter
    00081 {
    00082 public:
    00083   vtkTypeRevisionMacro(vtkSplitField,vtkDataSetToDataSetFilter);
    00084   void PrintSelf(ostream& os, vtkIndent indent);
    00085
    00087   static vtkSplitField *New();
    00088
    00091   void SetInputField(int attributeType, int fieldLoc);
    00092
    00095   void SetInputField(const char* name, int fieldLoc);
    00096
    00099   void SetInputField(const char* name, const char* fieldLoc);
    00100
    00102   void Split(int component, const char* arrayName);
    00103
    00104 //BTX
    00105   enum FieldLocations
    00106   {
    00107     DATA_OBJECT=0,
    00108     POINT_DATA=1,
    00109     CELL_DATA=2
    00110   };
    00111 //ETX
    00112
    00113 //BTX
    00114   struct Component
    00115   {
    00116     int Index;
    00117     char* FieldName;
    00118     Component* Next;   // linked list
    00119     void SetName(const char* name)
    00120       {
    00121         delete[] this->FieldName;
    00122         this->FieldName = 0;
    00123         if (name)
    00124           {
    00125           this->FieldName = new char[strlen(name)+1];
    00126           strcpy(this->FieldName, name);
    00127           }
    00128       }
    00129     Component() { FieldName = 0; }
    00130     ~Component() { delete[] FieldName; }
    00131   };
    00132 //ETX
    00133
    00134 protected:
    00135
    00136 //BTX
    00137   enum FieldTypes
    00138   {
    00139     NAME,
    00140     ATTRIBUTE
    00141   };
    00142 //ETX
    00143
    00144   vtkSplitField();
    00145   virtual ~vtkSplitField();
    00146
    00147   void Execute();
    00148
    00149   char* FieldName;
    00150   int FieldType;
    00151   int AttributeType;
    00152   int FieldLocation;
    00153
    00154   static char FieldLocationNames[3][12];
    00155   static char AttributeNames[vtkDataSetAttributes::NUM_ATTRIBUTES][10];
    00156
    00157   vtkDataArray* SplitArray(vtkDataArray* da, int component);
    00158
    00159
    00160   // Components are stored as a linked list.
    00161   Component* Head;
    00162   Component* Tail;
    00163
    00164   // Methods to browse/modify the linked list.
    00165   Component* GetNextComponent(Component* op)
    00166     { return op->Next; }
    00167   Component* GetFirst()
    00168     { return this->Head; }
    00169   void AddComponent(Component* op);
    00170   Component* FindComponent(int index);
    00171   void DeleteAllComponents();
    00172
    00173   void PrintComponent(Component* op, ostream& os, vtkIndent indent);
    00174   void PrintAllComponents(ostream& os, vtkIndent indent);
    00175 private:
    00176   vtkSplitField(const vtkSplitField&);  // Not implemented.
    00177   void operator=(const vtkSplitField&);  // Not implemented.
    00178 };
    00179
    00180 #endif
    00181
    00182