VTK
vtkGenericGlyph3DFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGenericGlyph3DFilter.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 =========================================================================*/
81 #ifndef __vtkGenericGlyph3DFilter_h
82 #define __vtkGenericGlyph3DFilter_h
83 
84 #include "vtkPolyDataAlgorithm.h"
85 
86 #define VTK_SCALE_BY_SCALAR 0
87 #define VTK_SCALE_BY_VECTOR 1
88 #define VTK_SCALE_BY_VECTORCOMPONENTS 2
89 #define VTK_DATA_SCALING_OFF 3
90 
91 #define VTK_COLOR_BY_SCALE 0
92 #define VTK_COLOR_BY_SCALAR 1
93 #define VTK_COLOR_BY_VECTOR 2
94 
95 #define VTK_USE_VECTOR 0
96 #define VTK_USE_NORMAL 1
97 #define VTK_VECTOR_ROTATION_OFF 2
98 
99 #define VTK_INDEXING_OFF 0
100 #define VTK_INDEXING_BY_SCALAR 1
101 #define VTK_INDEXING_BY_VECTOR 2
102 
104 {
105 public:
107  void PrintSelf(ostream& os, vtkIndent indent);
108 
113  static vtkGenericGlyph3DFilter *New();
114 
116  void SetSource(vtkPolyData *pd) {this->SetSource(0,pd);};
117 
119  void SetSource(int id, vtkPolyData *pd);
120 
122  vtkPolyData *GetSource(int id=0);
123 
125 
126  vtkSetMacro(Scaling,int);
127  vtkBooleanMacro(Scaling,int);
128  vtkGetMacro(Scaling,int);
130 
132 
133  vtkSetMacro(ScaleMode,int);
134  vtkGetMacro(ScaleMode,int);
136  {this->SetScaleMode(VTK_SCALE_BY_SCALAR);};
138  {this->SetScaleMode(VTK_SCALE_BY_VECTOR);};
140  {this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);};
142  {this->SetScaleMode(VTK_DATA_SCALING_OFF);};
143  const char *GetScaleModeAsString();
145 
147 
148  vtkSetMacro(ColorMode,int);
149  vtkGetMacro(ColorMode,int);
151  {this->SetColorMode(VTK_COLOR_BY_SCALE);};
153  {this->SetColorMode(VTK_COLOR_BY_SCALAR);};
155  {this->SetColorMode(VTK_COLOR_BY_VECTOR);};
156  const char *GetColorModeAsString();
158 
160 
161  vtkSetMacro(ScaleFactor,double);
162  vtkGetMacro(ScaleFactor,double);
164 
166 
167  vtkSetVector2Macro(Range,double);
168  vtkGetVectorMacro(Range,double,2);
170 
172 
173  vtkSetMacro(Orient,int);
174  vtkBooleanMacro(Orient,int);
175  vtkGetMacro(Orient,int);
177 
179 
181  vtkSetMacro(Clamping,int);
182  vtkBooleanMacro(Clamping,int);
183  vtkGetMacro(Clamping,int);
185 
187 
188  vtkSetMacro(VectorMode,int);
189  vtkGetMacro(VectorMode,int);
190  void SetVectorModeToUseVector() {this->SetVectorMode(VTK_USE_VECTOR);};
191  void SetVectorModeToUseNormal() {this->SetVectorMode(VTK_USE_NORMAL);};
193  {this->SetVectorMode(VTK_VECTOR_ROTATION_OFF);};
194  const char *GetVectorModeAsString();
196 
198 
201  vtkSetMacro(IndexMode,int);
202  vtkGetMacro(IndexMode,int);
203  void SetIndexModeToScalar() {this->SetIndexMode(VTK_INDEXING_BY_SCALAR);};
204  void SetIndexModeToVector() {this->SetIndexMode(VTK_INDEXING_BY_VECTOR);};
205  void SetIndexModeToOff() {this->SetIndexMode(VTK_INDEXING_OFF);};
206  const char *GetIndexModeAsString();
208 
210 
214  vtkSetMacro(GeneratePointIds,int);
215  vtkGetMacro(GeneratePointIds,int);
216  vtkBooleanMacro(GeneratePointIds,int);
218 
220 
223  vtkSetStringMacro(PointIdsName);
224  vtkGetStringMacro(PointIdsName);
226 
228 
231  vtkGetStringMacro(InputScalarsSelection);
232  void SelectInputScalars(const char *fieldName)
233  {this->SetInputScalarsSelection(fieldName);}
235 
237 
240  vtkGetStringMacro(InputVectorsSelection);
241  void SelectInputVectors(const char *fieldName)
242  {this->SetInputVectorsSelection(fieldName);}
244 
246 
249  vtkGetStringMacro(InputNormalsSelection);
250  void SelectInputNormals(const char *fieldName)
251  {this->SetInputNormalsSelection(fieldName);}
253 
254 protected:
257 
259 
263  vtkPolyData **Source; // Geometry to copy to each point
264  int Scaling; // Determine whether scaling of geometry is performed
265  int ScaleMode; // Scale by scalar value or vector magnitude
266  int ColorMode; // new scalars based on scale, scalar or vector
267  double ScaleFactor; // Scale factor to use to scale geometry
268  double Range[2]; // Range to use to perform scalar scaling
269  int Orient; // boolean controls whether to "orient" data
270  int VectorMode; // Orient/scale via normal or via vector data
271  int Clamping; // whether to clamp scale factor
272  int IndexMode; // what to use to index into glyph table
273  int GeneratePointIds; // produce input points ids for each output point
275 
279  vtkSetStringMacro(InputScalarsSelection);
280  vtkSetStringMacro(InputVectorsSelection);
281  vtkSetStringMacro(InputNormalsSelection);
282 
283 private:
284  vtkGenericGlyph3DFilter(const vtkGenericGlyph3DFilter&); // Not implemented.
285  void operator=(const vtkGenericGlyph3DFilter&); // Not implemented.
286 };
287 
289 
291 {
292  if ( this->ScaleMode == VTK_SCALE_BY_SCALAR )
293  {
294  return "ScaleByScalar";
295  }
296  else if ( this->ScaleMode == VTK_SCALE_BY_VECTOR )
297  {
298  return "ScaleByVector";
299  }
300  else
301  {
302  return "DataScalingOff";
303  }
304 }
306 
308 
310 {
311  if ( this->ColorMode == VTK_COLOR_BY_SCALAR )
312  {
313  return "ColorByScalar";
314  }
315  else if ( this->ColorMode == VTK_COLOR_BY_VECTOR )
316  {
317  return "ColorByVector";
318  }
319  else
320  {
321  return "ColorByScale";
322  }
323 }
325 
327 
329 {
330  if ( this->VectorMode == VTK_USE_VECTOR)
331  {
332  return "UseVector";
333  }
334  else if ( this->VectorMode == VTK_USE_NORMAL)
335  {
336  return "UseNormal";
337  }
338  else
339  {
340  return "VectorRotationOff";
341  }
342 }
344 
346 
348 {
349  if ( this->IndexMode == VTK_INDEXING_OFF)
350  {
351  return "IndexingOff";
352  }
353  else if ( this->IndexMode == VTK_INDEXING_BY_SCALAR)
354  {
355  return "IndexingByScalar";
356  }
357  else
358  {
359  return "IndexingByVector";
360  }
361 }
363 
364 #endif