VTK
vtkDataObjectToDataSetFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDataObjectToDataSetFilter.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 =========================================================================*/
70 #ifndef __vtkDataObjectToDataSetFilter_h
71 #define __vtkDataObjectToDataSetFilter_h
72 
73 #include "vtkDataSetAlgorithm.h"
74 
75 class vtkCellArray;
76 class vtkDataArray;
77 class vtkDataSet;
78 class vtkPointSet;
79 class vtkPolyData;
80 class vtkRectilinearGrid;
81 class vtkStructuredGrid;
84 
86 {
87 public:
90  void PrintSelf(ostream& os, vtkIndent indent);
91 
94 
96 
97  void SetDataSetType(int);
98  vtkGetMacro(DataSetType,int);
100  this->SetDataSetType(VTK_POLY_DATA);};
102  this->SetDataSetType(VTK_STRUCTURED_POINTS);};
104  this->SetDataSetType(VTK_STRUCTURED_GRID);};
106  this->SetDataSetType(VTK_RECTILINEAR_GRID);};
108  this->SetDataSetType(VTK_UNSTRUCTURED_GRID);};
110 
112 
118  vtkDataSet *GetOutput(int idx);
125 
127 
138  void SetPointComponent(int comp, char *arrayName, int arrayComp,
139  int min, int max, int normalize);
140  void SetPointComponent(int comp, char *arrayName, int arrayComp)
141  {this->SetPointComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
142  const char *GetPointComponentArrayName(int comp);
143  int GetPointComponentArrayComponent(int comp);
144  int GetPointComponentMinRange(int comp);
145  int GetPointComponentMaxRange(int comp);
146  int GetPointComponentNormailzeFlag(int comp);
148 
150 
157  void SetVertsComponent(char *arrayName, int arrayComp, int min, int max);
158  void SetVertsComponent(char *arrayName, int arrayComp)
159  {this->SetVertsComponent(arrayName, arrayComp, -1, -1);};
160  const char *GetVertsComponentArrayName();
161  int GetVertsComponentArrayComponent();
162  int GetVertsComponentMinRange();
163  int GetVertsComponentMaxRange();
164  void SetLinesComponent(char *arrayName, int arrayComp, int min, int max);
165  void SetLinesComponent(char *arrayName, int arrayComp)
166  {this->SetLinesComponent(arrayName, arrayComp, -1, -1);};
167  const char *GetLinesComponentArrayName();
168  int GetLinesComponentArrayComponent();
169  int GetLinesComponentMinRange();
170  int GetLinesComponentMaxRange();
171  void SetPolysComponent(char *arrayName, int arrayComp, int min, int max);
172  void SetPolysComponent(char *arrayName, int arrayComp)
173  {this->SetPolysComponent(arrayName, arrayComp, -1, -1);};
174  const char *GetPolysComponentArrayName();
175  int GetPolysComponentArrayComponent();
176  int GetPolysComponentMinRange();
177  int GetPolysComponentMaxRange();
178  void SetStripsComponent(char *arrayName, int arrayComp, int min, int max);
179  void SetStripsComponent(char *arrayName, int arrayComp)
180  {this->SetStripsComponent(arrayName, arrayComp, -1, -1);};
181  const char *GetStripsComponentArrayName();
182  int GetStripsComponentArrayComponent();
183  int GetStripsComponentMinRange();
184  int GetStripsComponentMaxRange();
186 
188 
195  void SetCellTypeComponent(char *arrayName, int arrayComp,
196  int min, int max);
197  void SetCellTypeComponent(char *arrayName, int arrayComp)
198  {this->SetCellTypeComponent(arrayName, arrayComp, -1, -1);};
199  const char *GetCellTypeComponentArrayName();
200  int GetCellTypeComponentArrayComponent();
201  int GetCellTypeComponentMinRange();
202  int GetCellTypeComponentMaxRange();
203  void SetCellConnectivityComponent(char *arrayName, int arrayComp,
204  int min, int max);
205  void SetCellConnectivityComponent(char *arrayName, int arrayComp)
206  {this->SetCellConnectivityComponent(arrayName, arrayComp, -1, -1);};
207  const char *GetCellConnectivityComponentArrayName();
208  int GetCellConnectivityComponentArrayComponent();
209  int GetCellConnectivityComponentMinRange();
210  int GetCellConnectivityComponentMaxRange();
212 
214 
216  vtkSetMacro(DefaultNormalize,int);
217  vtkGetMacro(DefaultNormalize,int);
218  vtkBooleanMacro(DefaultNormalize,int);
220 
222 
225  vtkSetVector3Macro(Dimensions,int);
226  vtkGetVectorMacro(Dimensions,int,3);
228 
230 
232  vtkSetVector3Macro(Origin,double);
233  vtkGetVectorMacro(Origin,double,3);
235 
237 
239  vtkSetVector3Macro(Spacing,double);
240  vtkGetVectorMacro(Spacing,double,3);
242 
244 
249  void SetDimensionsComponent(char *arrayName, int arrayComp, int min, int max);
250  void SetDimensionsComponent(char *arrayName, int arrayComp)
251  {this->SetDimensionsComponent(arrayName, arrayComp, -1, -1);};
252  void SetSpacingComponent(char *arrayName, int arrayComp, int min, int max);
253  void SetSpacingComponent(char *arrayName, int arrayComp)
254  {this->SetSpacingComponent(arrayName, arrayComp, -1, -1);};
255  void SetOriginComponent(char *arrayName, int arrayComp, int min, int max);
256  void SetOriginComponent(char *arrayName, int arrayComp)
257  {this->SetOriginComponent(arrayName, arrayComp, -1, -1);};
259 
260 protected:
263 
264  virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); //generate output data
270 
271  char Updating;
272 
273  // control flags used to generate the output dataset
274  int DataSetType; //the type of dataset to generate
275 
276  // Support definition of points
277  char *PointArrays[3]; //the name of the arrays
278  int PointArrayComponents[3]; //the array components used for x-y-z
279  vtkIdType PointComponentRange[3][2]; //the range of the components to use
280  int PointNormalize[3]; //flags control normalization
281 
282  // These define cells for vtkPolyData
283  char *VertsArray; //the name of the array
284  int VertsArrayComponent; //the array component
285  vtkIdType VertsComponentRange[2]; //the range of the components to use
286 
287  char *LinesArray; //the name of the array
288  int LinesArrayComponent; //the array component used for cell types
289  vtkIdType LinesComponentRange[2]; //the range of the components to use
290 
291  char *PolysArray; //the name of the array
292  int PolysArrayComponent; //the array component
293  vtkIdType PolysComponentRange[2]; //the range of the components to use
294 
295  char *StripsArray; //the name of the array
296  int StripsArrayComponent; //the array component
297  vtkIdType StripsComponentRange[2]; //the range of the components to use
298 
299  // Used to define vtkUnstructuredGrid datasets
300  char *CellTypeArray; //the name of the array
301  int CellTypeArrayComponent; //the array component used for cell types
302  vtkIdType CellTypeComponentRange[2]; //the range of the components to use
303 
304  char *CellConnectivityArray; //the name of the array
305  int CellConnectivityArrayComponent; //the array components used for cell connectivity
306  vtkIdType CellConnectivityComponentRange[2]; //the range of the components to use
307 
308  // helper methods (and attributes) to construct datasets
309  void SetArrayName(char* &name, char *newName);
310  vtkIdType ConstructPoints(vtkDataObject *input, vtkPointSet *ps);
311  vtkIdType ConstructPoints(vtkDataObject *input, vtkRectilinearGrid *rg);
312  int ConstructCells(vtkDataObject *input, vtkPolyData *pd);
313  int ConstructCells(vtkDataObject *input, vtkUnstructuredGrid *ug);
314  vtkCellArray *ConstructCellArray(vtkDataArray *da, int comp,
315  vtkIdType compRange[2]);
316 
317  // Default value for normalization
319 
320  // Couple of different ways to specify dimensions, spacing, and origin.
321  int Dimensions[3];
322  double Origin[3];
323  double Spacing[3];
324 
325  char *DimensionsArray; //the name of the array
326  int DimensionsArrayComponent; //the component of the array used for dimensions
327  vtkIdType DimensionsComponentRange[2]; //the ComponentRange of the array for the dimensions
328 
329  char *OriginArray; //the name of the array
330  int OriginArrayComponent; //the component of the array used for Origins
331  vtkIdType OriginComponentRange[2]; //the ComponentRange of the array for the Origins
332 
333  char *SpacingArray; //the name of the array
334  int SpacingArrayComponent; //the component of the array used for Spacings
335  vtkIdType SpacingComponentRange[2]; //the ComponentRange of the array for the Spacings
336 
337  void ConstructDimensions(vtkDataObject *input);
338  void ConstructSpacing(vtkDataObject *input);
339  void ConstructOrigin(vtkDataObject *input);
340 
341 private:
343  void operator=(const vtkDataObjectToDataSetFilter&); // Not implemented.
344 };
345 
346 #endif