OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I686LINUX / util / I686LINUX / include / vtk / vtkMaskFields.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkMaskFields.h,v $
5   Language:  C++
6   Date:      $Date: 2002/09/26 12:07:14 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
10   All rights reserved.
11   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
12
13      This software is distributed WITHOUT ANY WARRANTY; without even 
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15      PURPOSE.  See the above copyright notice for more information.
16
17 =========================================================================*/
18 // .NAME vtkMaskFields - Allow control of which fields get passed
19 // to the output
20 // .SECTION Description
21 // vtkMaskFields is used to mark which fields in the input dataset
22 // get copied to the output.  The output will contain only those fields
23 // marked as on by the filter.
24
25 // .SECTION See Also
26 // vtkFieldData vtkDataSet vtkDataObjectToDataSetFilter
27 // vtkDataSetAttributes vtkDataArray vtkRearrangeFields
28 // vtkSplitField vtkMergeFields vtkAssignAttribute
29
30 #ifndef __vtkMaskFields_h
31 #define __vtkMaskFields_h
32
33 #include "vtkDataSetToDataSetFilter.h"
34
35 #include "vtkDataSetAttributes.h" // Needed for NUM_ATTRIBUTES
36
37 class vtkDataSet;
38
39 class VTK_GRAPHICS_EXPORT vtkMaskFields : public vtkDataSetToDataSetFilter
40 {
41 public:
42   vtkTypeRevisionMacro(vtkMaskFields,vtkDataSetToDataSetFilter);
43   void PrintSelf(ostream& os, vtkIndent indent);
44
45   // Description:
46   // Create a new vtkMaskFields.
47   static vtkMaskFields *New();
48
49   // Description:
50   // Turn on/off the copying of the field or specified by name.
51   // During the copying/passing, the following rules are followed for each
52   // array:
53   // 1. If the copy flag for an array is set (on or off), it is applied
54   //    This overrides rule 2.
55   // 2. If CopyAllOn is set, copy the array.
56   //    If CopyAllOff is set, do not copy the array
57   // A field name and a location must be specified. For example:
58   // @verbatim
59   // maskFields->CopyFieldOff(vtkMaskFields::CELL_DATA, "foo");
60   // @endverbatim
61   // causes the field "foo" on the input cell data to not get copied
62   // to the output.
63   void CopyFieldOn(int fieldLocation, const char* name) { this->CopyFieldOnOff(fieldLocation, name, 1); }
64   void CopyFieldOff(int fieldLocation, const char* name) { this->CopyFieldOnOff(fieldLocation, name, 0); }
65
66
67   // Description:
68   // Turn on/off the copying of the attribute or specified by vtkDataSetAttributes:AttributeTypes.
69   // During the copying/passing, the following rules are followed for each
70   // array:
71   // 1. If the copy flag for an array is set (on or off), it is applied
72   //    This overrides rule 2.
73   // 2. If CopyAllOn is set, copy the array.
74   //    If CopyAllOff is set, do not copy the array
75   // An attribute type and a location must be specified. For example:
76   // @verbatim
77   // maskFields->CopyAttributeOff(vtkMaskFields::POINT_DATA, vtkDataSetAttributes::SCALARS);
78   // @endverbatim
79   // causes the scalars on the input point data to not get copied
80   // to the output.
81   void CopyAttributeOn(int attributeLocation, int attributeType) { this->CopyAttributeOnOff(attributeLocation, attributeType, 1); }
82   void CopyAttributeOff(int attributeLocation, int attributeType) { this->CopyAttributeOnOff(attributeLocation, attributeType, 0); }
83
84   // Description:
85   // Convenience methods which operate on all field data or 
86   // attribute data.  More specific than CopyAllOn or CopyAllOff
87   void CopyFieldsOff() { this->CopyFields = 0; }
88   void CopyAttributesOff() { this->CopyAttributes = 0; }
89
90   void CopyFieldsOn() { this->CopyFields = 1; }
91   void CopyAttributesOn() { this->CopyAttributes = 1; }
92
93   // Description:
94   // Helper methods used by other language bindings. Allows the caller to
95   // specify arguments as strings instead of enums.
96   void CopyAttributeOn(const char* attributeLoc, 
97                        const char* attributeType);
98   void CopyAttributeOff(const char* attributeLoc, 
99                         const char* attributeType);
100   void CopyFieldOn(const char* fieldLoc, 
101                    const char* name);
102   void CopyFieldOff(const char* fieldLoc, 
103                     const char* name);
104
105   // Description:
106   // Turn on copying of all data.
107   // During the copying/passing, the following rules are followed for each
108   // array:
109   // 1. If the copy flag for an array is set (on or off), it is applied
110   //    This overrides rule 2.
111   // 2. If CopyAllOn is set, copy the array.
112   //    If CopyAllOff is set, do not copy the array
113   virtual void CopyAllOn();
114
115   // Description:
116   // Turn off copying of all data.
117   // During the copying/passing, the following rules are followed for each
118   // array:
119   // 1. If the copy flag for an array is set (on or off), it is applied
120   //    This overrides rule 2.
121   // 2. If CopyAllOn is set, copy the array.
122   //    If CopyAllOff is set, do not copy the array
123   virtual void CopyAllOff();
124
125   vtkMaskFields();
126   virtual ~vtkMaskFields();
127
128 //BTX
129   enum FieldLocation
130     {
131       OBJECT_DATA=0,
132       POINT_DATA=1,
133       CELL_DATA=2
134     };
135 //ETX
136
137 protected:
138
139   void Execute();
140
141 //BTX
142   struct CopyFieldFlag
143   {
144     char* Name;
145     int Type;
146     int Location;
147     int IsCopied;
148   };
149 //ETX
150
151   CopyFieldFlag* CopyFieldFlags; // the names of fields not to be copied
152   int NumberOfFieldFlags; // the number of fields not to be copied
153   void CopyFieldOnOff(int fieldLocation, const char* name, int onOff);
154   void CopyAttributeOnOff(int attributeLocation, int attributeType, int onOff);
155   void ClearFieldFlags();
156   int FindFlag(const char* field, int location);
157   int FindFlag(int arrayType, int location);
158   int GetFlag(const char* field, int location);
159   int GetFlag(int arrayType, int location);
160   int GetAttributeLocation(const char* loc);
161   int GetAttributeType(const char* type);
162
163   int CopyFields;
164   int CopyAttributes;
165
166   static char FieldLocationNames[3][12];
167   static char AttributeNames[vtkDataSetAttributes::NUM_ATTRIBUTES][10];
168
169 private:
170   vtkMaskFields(const vtkMaskFields&);  // Not implemented.
171   void operator=(const vtkMaskFields&);  // Not implemented.
172 };
173
174 #endif
175
176