VTK
dox/Graphics/vtkMaskFields.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkMaskFields.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00035 #ifndef __vtkMaskFields_h
00036 #define __vtkMaskFields_h
00037 
00038 #include "vtkDataSetAlgorithm.h"
00039 
00040 #include "vtkDataSetAttributes.h" // Needed for NUM_ATTRIBUTES
00041 
00042 class vtkDataSet;
00043 
00044 class VTK_GRAPHICS_EXPORT vtkMaskFields : public vtkDataSetAlgorithm
00045 {
00046 public:
00047   vtkTypeMacro(vtkMaskFields,vtkDataSetAlgorithm);
00048   void PrintSelf(ostream& os, vtkIndent indent);
00049 
00051   static vtkMaskFields *New();
00052 
00054 
00063   void CopyFieldOn(int fieldLocation, const char* name) { this->CopyFieldOnOff(fieldLocation, name, 1); }
00064   void CopyFieldOff(int fieldLocation, const char* name) { this->CopyFieldOnOff(fieldLocation, name, 0); }
00066 
00067 
00069 
00079   void CopyAttributeOn(int attributeLocation, int attributeType) { this->CopyAttributeOnOff(attributeLocation, attributeType, 1); }
00080   void CopyAttributeOff(int attributeLocation, int attributeType) { this->CopyAttributeOnOff(attributeLocation, attributeType, 0); }
00082 
00084 
00086   void CopyFieldsOff() { this->CopyFields = 0; }
00087   void CopyAttributesOff() { this->CopyAttributes = 0; }
00089 
00090   void CopyFieldsOn() { this->CopyFields = 1; }
00091   void CopyAttributesOn() { this->CopyAttributes = 1; }
00092 
00094 
00096   void CopyAttributeOn(const char* attributeLoc, 
00097                        const char* attributeType);
00098   void CopyAttributeOff(const char* attributeLoc, 
00099                         const char* attributeType);
00100   void CopyFieldOn(const char* fieldLoc, 
00101                    const char* name);
00102   void CopyFieldOff(const char* fieldLoc, 
00103                     const char* name);
00105 
00111   virtual void CopyAllOn();
00112 
00118   virtual void CopyAllOff();
00119 
00120 //BTX
00121   enum FieldLocation
00122     {
00123       OBJECT_DATA=0,
00124       POINT_DATA=1,
00125       CELL_DATA=2
00126     };
00127 //ETX
00128 
00129 protected:
00130   vtkMaskFields();
00131   virtual ~vtkMaskFields();
00132 
00133   virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00134 
00135 //BTX
00136   struct CopyFieldFlag
00137   {
00138     char* Name;
00139     int Type;
00140     int Location;
00141     int IsCopied;
00142   };
00143 //ETX
00144 
00145   CopyFieldFlag* CopyFieldFlags; // the names of fields not to be copied
00146   int NumberOfFieldFlags; // the number of fields not to be copied
00147   void CopyFieldOnOff(int fieldLocation, const char* name, int onOff);
00148   void CopyAttributeOnOff(int attributeLocation, int attributeType, int onOff);
00149   void ClearFieldFlags();
00150   int FindFlag(const char* field, int location);
00151   int FindFlag(int arrayType, int location);
00152   int GetFlag(const char* field, int location);
00153   int GetFlag(int arrayType, int location);
00154   int GetAttributeLocation(const char* loc);
00155   int GetAttributeType(const char* type);
00156 
00157   int CopyFields;
00158   int CopyAttributes;
00159 
00160   static char FieldLocationNames[3][12];
00161   static char AttributeNames[vtkDataSetAttributes::NUM_ATTRIBUTES][10];
00162 
00163 private:
00164   vtkMaskFields(const vtkMaskFields&);  // Not implemented.
00165   void operator=(const vtkMaskFields&);  // Not implemented.
00166 };
00167 
00168 #endif
00169 
00170