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 =========================================================================*/
00032 #ifndef __vtkMaskFields_h
00033 #define __vtkMaskFields_h
00034 
00035 #include "vtkDataSetAlgorithm.h"
00036 
00037 #include "vtkDataSetAttributes.h" // Needed for NUM_ATTRIBUTES
00038 
00039 class vtkDataSet;
00040 
00041 class VTK_GRAPHICS_EXPORT vtkMaskFields : public vtkDataSetAlgorithm
00042 {
00043 public:
00044   vtkTypeMacro(vtkMaskFields,vtkDataSetAlgorithm);
00045   void PrintSelf(ostream& os, vtkIndent indent);
00046 
00048   static vtkMaskFields *New();
00049 
00051 
00060   void CopyFieldOn(int fieldLocation, const char* name) { this->CopyFieldOnOff(fieldLocation, name, 1); }
00061   void CopyFieldOff(int fieldLocation, const char* name) { this->CopyFieldOnOff(fieldLocation, name, 0); }
00063 
00064 
00066 
00076   void CopyAttributeOn(int attributeLocation, int attributeType) { this->CopyAttributeOnOff(attributeLocation, attributeType, 1); }
00077   void CopyAttributeOff(int attributeLocation, int attributeType) { this->CopyAttributeOnOff(attributeLocation, attributeType, 0); }
00079 
00081 
00083   void CopyFieldsOff() { this->CopyFields = 0; }
00084   void CopyAttributesOff() { this->CopyAttributes = 0; }
00086 
00087   void CopyFieldsOn() { this->CopyFields = 1; }
00088   void CopyAttributesOn() { this->CopyAttributes = 1; }
00089 
00091 
00093   void CopyAttributeOn(const char* attributeLoc, 
00094                        const char* attributeType);
00095   void CopyAttributeOff(const char* attributeLoc, 
00096                         const char* attributeType);
00097   void CopyFieldOn(const char* fieldLoc, 
00098                    const char* name);
00099   void CopyFieldOff(const char* fieldLoc, 
00100                     const char* name);
00102 
00108   virtual void CopyAllOn();
00109 
00115   virtual void CopyAllOff();
00116 
00117 //BTX
00118   enum FieldLocation
00119     {
00120       OBJECT_DATA=0,
00121       POINT_DATA=1,
00122       CELL_DATA=2
00123     };
00124 //ETX
00125 
00126 protected:
00127   vtkMaskFields();
00128   virtual ~vtkMaskFields();
00129 
00130   virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00131 
00132 //BTX
00133   struct CopyFieldFlag
00134   {
00135     char* Name;
00136     int Type;
00137     int Location;
00138     int IsCopied;
00139   };
00140 //ETX
00141 
00142   CopyFieldFlag* CopyFieldFlags; // the names of fields not to be copied
00143   int NumberOfFieldFlags; // the number of fields not to be copied
00144   void CopyFieldOnOff(int fieldLocation, const char* name, int onOff);
00145   void CopyAttributeOnOff(int attributeLocation, int attributeType, int onOff);
00146   void ClearFieldFlags();
00147   int FindFlag(const char* field, int location);
00148   int FindFlag(int arrayType, int location);
00149   int GetFlag(const char* field, int location);
00150   int GetFlag(int arrayType, int location);
00151   int GetAttributeLocation(const char* loc);
00152   int GetAttributeType(const char* type);
00153 
00154   int CopyFields;
00155   int CopyAttributes;
00156 
00157   static char FieldLocationNames[3][12];
00158   static char AttributeNames[vtkDataSetAttributes::NUM_ATTRIBUTES][10];
00159 
00160 private:
00161   vtkMaskFields(const vtkMaskFields&);  // Not implemented.
00162   void operator=(const vtkMaskFields&);  // Not implemented.
00163 };
00164 
00165 #endif
00166 
00167