1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkMergeFilter.h
5 
6   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7   All rights reserved.
8   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10      This software is distributed WITHOUT ANY WARRANTY; without even
11      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12      PURPOSE.  See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /**
16  * @class   vtkMergeFilter
17  * @brief   extract separate components of data from different datasets
18  *
19  * vtkMergeFilter is a filter that extracts separate components of data from
20  * different datasets and merges them into a single dataset. The output from
21  * this filter is of the same type as the input (i.e., vtkDataSet.) It treats
22  * both cell and point data set attributes.
23 */
24 
25 #ifndef vtkMergeFilter_h
26 #define vtkMergeFilter_h
27 
28 #include "vtkFiltersCoreModule.h" // For export macro
29 #include "vtkDataSetAlgorithm.h"
30 
31 class vtkFieldList;
32 
33 class VTKFILTERSCORE_EXPORT vtkMergeFilter : public vtkDataSetAlgorithm
34 {
35 public:
36   static vtkMergeFilter *New();
37   vtkTypeMacro(vtkMergeFilter,vtkDataSetAlgorithm);
38   void PrintSelf(ostream& os, vtkIndent indent) override;
39 
40   //@{
41   /**
42    * Specify object from which to extract geometry information.
43    * Note that this method does not connect the pipeline. The algorithm will
44    * work on the input data as it is without updating the producer of the data.
45    * See SetGeometryConnection for connecting the pipeline.
46    */
SetGeometryInputData(vtkDataSet * input)47   void SetGeometryInputData(vtkDataSet *input) {this->SetInputData(input);};
48   vtkDataSet *GetGeometry();
49   //@}
50 
51   /**
52    * Specify object from which to extract geometry information.
53    * Equivalent to SetInputConnection(0, algOutput)
54    */
SetGeometryConnection(vtkAlgorithmOutput * algOutput)55   void SetGeometryConnection(vtkAlgorithmOutput* algOutput)
56   {
57       this->SetInputConnection(algOutput);
58   }
59 
60   //@{
61   /**
62    * Specify object from which to extract scalar information.
63    * Note that this method does not connect the pipeline. The algorithm will
64    * work on the input data as it is without updating the producer of the data.
65    * See SetScalarConnection for connecting the pipeline.
66    */
67   void SetScalarsData(vtkDataSet *);
68   vtkDataSet *GetScalars();
69   //@}
70 
71   /**
72    * Specify object from which to extract scalar information.
73    * Equivalent to SetInputConnection(1, algOutput)
74    */
SetScalarsConnection(vtkAlgorithmOutput * algOutput)75   void SetScalarsConnection(vtkAlgorithmOutput* algOutput)
76   {
77       this->SetInputConnection(1, algOutput);
78   }
79 
80   //@{
81   /**
82    * Set / get the object from which to extract vector information.
83    * Note that this method does not connect the pipeline. The algorithm will
84    * work on the input data as it is without updating the producer of the data.
85    * See SetVectorsConnection for connecting the pipeline.
86    */
87   void SetVectorsData(vtkDataSet *);
88   vtkDataSet *GetVectors();
89   //@}
90 
91   /**
92    * Set the connection from which to extract vector information.
93    * Equivalent to SetInputConnection(2, algOutput)
94    */
SetVectorsConnection(vtkAlgorithmOutput * algOutput)95   void SetVectorsConnection(vtkAlgorithmOutput* algOutput)
96   {
97       this->SetInputConnection(2, algOutput);
98   }
99 
100   //@{
101   /**
102    * Set / get the object from which to extract normal information.
103    * Note that this method does not connect the pipeline. The algorithm will
104    * work on the input data as it is without updating the producer of the data.
105    * See SetNormalsConnection for connecting the pipeline.
106    */
107   void SetNormalsData(vtkDataSet *);
108   vtkDataSet *GetNormals();
109   //@}
110 
111   /**
112    * Set  the connection from which to extract normal information.
113    * Equivalent to SetInputConnection(3, algOutput)
114    */
SetNormalsConnection(vtkAlgorithmOutput * algOutput)115   void SetNormalsConnection(vtkAlgorithmOutput* algOutput)
116   {
117       this->SetInputConnection(3, algOutput);
118   }
119 
120   //@{
121   /**
122    * Set / get the object from which to extract texture coordinates
123    * information.
124    * Note that this method does not connect the pipeline. The algorithm will
125    * work on the input data as it is without updating the producer of the data.
126    * See SetTCoordsConnection for connecting the pipeline.
127    */
128   void SetTCoordsData(vtkDataSet *);
129   vtkDataSet *GetTCoords();
130   //@}
131 
132   /**
133    * Set the connection from which to extract texture coordinates
134    * information.
135    * Equivalent to SetInputConnection(4, algOutput)
136    */
SetTCoordsConnection(vtkAlgorithmOutput * algOutput)137   void SetTCoordsConnection(vtkAlgorithmOutput* algOutput)
138   {
139       this->SetInputConnection(4, algOutput);
140   }
141 
142   //@{
143   /**
144    * Set / get the object from which to extract tensor data.
145    * Note that this method does not connect the pipeline. The algorithm will
146    * work on the input data as it is without updating the producer of the data.
147    * See SetTensorsConnection for connecting the pipeline.
148    */
149   void SetTensorsData(vtkDataSet *);
150   vtkDataSet *GetTensors();
151   //@}
152 
153   /**
154    * Set the connection from which to extract tensor data.
155    * Equivalent to SetInputConnection(5, algOutput)
156    */
SetTensorsConnection(vtkAlgorithmOutput * algOutput)157   void SetTensorsConnection(vtkAlgorithmOutput* algOutput)
158   {
159       this->SetInputConnection(5, algOutput);
160   }
161 
162   /**
163    * Set the object from which to extract a field and the name
164    * of the field. Note that this does not create pipeline
165    * connectivity.
166    */
167   void AddField(const char* name, vtkDataSet* input);
168 
169 protected:
170   vtkMergeFilter();
171   ~vtkMergeFilter() override;
172 
173   // Usual data generation method
174   int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override;
175   int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override;
176   int FillInputPortInformation(int port, vtkInformation *info) override;
177 
178   vtkFieldList* FieldList;
179 private:
180   vtkMergeFilter(const vtkMergeFilter&) = delete;
181   void operator=(const vtkMergeFilter&) = delete;
182 };
183 
184 #endif
185 
186 
187