1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkMaskFields.h,v $
6 Date: $Date: 2002/09/26 12:07:14 $
7 Version: $Revision: 1.4 $
9 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
11 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
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.
17 =========================================================================*/
18 // .NAME vtkMaskFields - Allow control of which fields get passed
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.
26 // vtkFieldData vtkDataSet vtkDataObjectToDataSetFilter
27 // vtkDataSetAttributes vtkDataArray vtkRearrangeFields
28 // vtkSplitField vtkMergeFields vtkAssignAttribute
30 #ifndef __vtkMaskFields_h
31 #define __vtkMaskFields_h
33 #include "vtkDataSetToDataSetFilter.h"
35 #include "vtkDataSetAttributes.h" // Needed for NUM_ATTRIBUTES
39 class VTK_GRAPHICS_EXPORT vtkMaskFields : public vtkDataSetToDataSetFilter
42 vtkTypeRevisionMacro(vtkMaskFields,vtkDataSetToDataSetFilter);
43 void PrintSelf(ostream& os, vtkIndent indent);
46 // Create a new vtkMaskFields.
47 static vtkMaskFields *New();
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
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:
59 // maskFields->CopyFieldOff(vtkMaskFields::CELL_DATA, "foo");
61 // causes the field "foo" on the input cell data to not get copied
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); }
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
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:
77 // maskFields->CopyAttributeOff(vtkMaskFields::POINT_DATA, vtkDataSetAttributes::SCALARS);
79 // causes the scalars on the input point data to not get copied
81 void CopyAttributeOn(int attributeLocation, int attributeType) { this->CopyAttributeOnOff(attributeLocation, attributeType, 1); }
82 void CopyAttributeOff(int attributeLocation, int attributeType) { this->CopyAttributeOnOff(attributeLocation, attributeType, 0); }
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; }
90 void CopyFieldsOn() { this->CopyFields = 1; }
91 void CopyAttributesOn() { this->CopyAttributes = 1; }
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,
102 void CopyFieldOff(const char* fieldLoc,
106 // Turn on copying of all data.
107 // During the copying/passing, the following rules are followed for each
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();
116 // Turn off copying of all data.
117 // During the copying/passing, the following rules are followed for each
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();
126 virtual ~vtkMaskFields();
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);
166 static char FieldLocationNames[3][12];
167 static char AttributeNames[vtkDataSetAttributes::NUM_ATTRIBUTES][10];
170 vtkMaskFields(const vtkMaskFields&); // Not implemented.
171 void operator=(const vtkMaskFields&); // Not implemented.