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 =========================================================================*/
82 #ifndef vtkGenericGlyph3DFilter_h
83 #define vtkGenericGlyph3DFilter_h
84 
85 #include "vtkFiltersGenericModule.h" // For export macro
86 #include "vtkPolyDataAlgorithm.h"
87 
88 #define VTK_SCALE_BY_SCALAR 0
89 #define VTK_SCALE_BY_VECTOR 1
90 #define VTK_SCALE_BY_VECTORCOMPONENTS 2
91 #define VTK_DATA_SCALING_OFF 3
92 
93 #define VTK_COLOR_BY_SCALE 0
94 #define VTK_COLOR_BY_SCALAR 1
95 #define VTK_COLOR_BY_VECTOR 2
96 
97 #define VTK_USE_VECTOR 0
98 #define VTK_USE_NORMAL 1
99 #define VTK_VECTOR_ROTATION_OFF 2
100 
101 #define VTK_INDEXING_OFF 0
102 #define VTK_INDEXING_BY_SCALAR 1
103 #define VTK_INDEXING_BY_VECTOR 2
104 
105 class VTKFILTERSGENERIC_EXPORT vtkGenericGlyph3DFilter : public vtkPolyDataAlgorithm
106 {
107 public:
109  void PrintSelf(ostream& os, vtkIndent indent) override;
110 
117  static vtkGenericGlyph3DFilter *New();
118 
122  void SetSourceData(vtkPolyData *pd) {this->SetSourceData(0,pd);};
123 
127  void SetSourceData(int id, vtkPolyData *pd);
128 
132  vtkPolyData *GetSource(int id=0);
133 
135 
138  vtkSetMacro(Scaling,vtkTypeBool);
139  vtkBooleanMacro(Scaling,vtkTypeBool);
140  vtkGetMacro(Scaling,vtkTypeBool);
142 
144 
147  vtkSetMacro(ScaleMode,int);
148  vtkGetMacro(ScaleMode,int);
150  {this->SetScaleMode(VTK_SCALE_BY_SCALAR);};
152  {this->SetScaleMode(VTK_SCALE_BY_VECTOR);};
154  {this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);};
156  {this->SetScaleMode(VTK_DATA_SCALING_OFF);};
157  const char *GetScaleModeAsString();
159 
161 
164  vtkSetMacro(ColorMode,int);
165  vtkGetMacro(ColorMode,int);
167  {this->SetColorMode(VTK_COLOR_BY_SCALE);};
169  {this->SetColorMode(VTK_COLOR_BY_SCALAR);};
171  {this->SetColorMode(VTK_COLOR_BY_VECTOR);};
172  const char *GetColorModeAsString();
174 
176 
179  vtkSetMacro(ScaleFactor,double);
180  vtkGetMacro(ScaleFactor,double);
182 
184 
187  vtkSetVector2Macro(Range,double);
188  vtkGetVectorMacro(Range,double,2);
190 
192 
195  vtkSetMacro(Orient,vtkTypeBool);
196  vtkBooleanMacro(Orient,vtkTypeBool);
197  vtkGetMacro(Orient,vtkTypeBool);
199 
201 
205  vtkSetMacro(Clamping,vtkTypeBool);
206  vtkBooleanMacro(Clamping,vtkTypeBool);
207  vtkGetMacro(Clamping,vtkTypeBool);
209 
211 
214  vtkSetMacro(VectorMode,int);
215  vtkGetMacro(VectorMode,int);
216  void SetVectorModeToUseVector() {this->SetVectorMode(VTK_USE_VECTOR);};
217  void SetVectorModeToUseNormal() {this->SetVectorMode(VTK_USE_NORMAL);};
219  {this->SetVectorMode(VTK_VECTOR_ROTATION_OFF);};
220  const char *GetVectorModeAsString();
222 
224 
229  vtkSetMacro(IndexMode,int);
230  vtkGetMacro(IndexMode,int);
231  void SetIndexModeToScalar() {this->SetIndexMode(VTK_INDEXING_BY_SCALAR);};
232  void SetIndexModeToVector() {this->SetIndexMode(VTK_INDEXING_BY_VECTOR);};
233  void SetIndexModeToOff() {this->SetIndexMode(VTK_INDEXING_OFF);};
234  const char *GetIndexModeAsString();
236 
238 
244  vtkSetMacro(GeneratePointIds,vtkTypeBool);
245  vtkGetMacro(GeneratePointIds,vtkTypeBool);
246  vtkBooleanMacro(GeneratePointIds,vtkTypeBool);
248 
250 
254  vtkSetStringMacro(PointIdsName);
255  vtkGetStringMacro(PointIdsName);
257 
259 
263  vtkGetStringMacro(InputScalarsSelection);
264  void SelectInputScalars(const char *fieldName)
265  {this->SetInputScalarsSelection(fieldName);}
267 
269 
273  vtkGetStringMacro(InputVectorsSelection);
274  void SelectInputVectors(const char *fieldName)
275  {this->SetInputVectorsSelection(fieldName);}
277 
279 
283  vtkGetStringMacro(InputNormalsSelection);
284  void SelectInputNormals(const char *fieldName)
285  {this->SetInputNormalsSelection(fieldName);}
287 
288 protected:
290  ~vtkGenericGlyph3DFilter() override;
291 
292  int FillInputPortInformation(int, vtkInformation*) override;
293 
297  vtkPolyData **Source; // Geometry to copy to each point
298  vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
299  int ScaleMode; // Scale by scalar value or vector magnitude
300  int ColorMode; // new scalars based on scale, scalar or vector
301  double ScaleFactor; // Scale factor to use to scale geometry
302  double Range[2]; // Range to use to perform scalar scaling
303  vtkTypeBool Orient; // boolean controls whether to "orient" data
304  int VectorMode; // Orient/scale via normal or via vector data
305  vtkTypeBool Clamping; // whether to clamp scale factor
306  int IndexMode; // what to use to index into glyph table
307  vtkTypeBool GeneratePointIds; // produce input points ids for each output point
309 
313  vtkSetStringMacro(InputScalarsSelection);
314  vtkSetStringMacro(InputVectorsSelection);
315  vtkSetStringMacro(InputNormalsSelection);
316 
317 private:
319  void operator=(const vtkGenericGlyph3DFilter&) = delete;
320 };
321 
323 
327 {
328  if ( this->ScaleMode == VTK_SCALE_BY_SCALAR )
329  {
330  return "ScaleByScalar";
331  }
332  else if ( this->ScaleMode == VTK_SCALE_BY_VECTOR )
333  {
334  return "ScaleByVector";
335  }
336  else
337  {
338  return "DataScalingOff";
339  }
340 }
342 
344 
348 {
349  if ( this->ColorMode == VTK_COLOR_BY_SCALAR )
350  {
351  return "ColorByScalar";
352  }
353  else if ( this->ColorMode == VTK_COLOR_BY_VECTOR )
354  {
355  return "ColorByVector";
356  }
357  else
358  {
359  return "ColorByScale";
360  }
361 }
363 
365 
369 {
370  if ( this->VectorMode == VTK_USE_VECTOR)
371  {
372  return "UseVector";
373  }
374  else if ( this->VectorMode == VTK_USE_NORMAL)
375  {
376  return "UseNormal";
377  }
378  else
379  {
380  return "VectorRotationOff";
381  }
382 }
384 
386 
390 {
391  if ( this->IndexMode == VTK_INDEXING_OFF)
392  {
393  return "IndexingOff";
394  }
395  else if ( this->IndexMode == VTK_INDEXING_BY_SCALAR)
396  {
397  return "IndexingByScalar";
398  }
399  else
400  {
401  return "IndexingByVector";
402  }
403 }
405 
406 #endif
void SetIndexModeToOff()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
void SetSourceData(vtkPolyData *pd)
Set the source to use for the glyph.
void SetColorModeToColorByScale()
Either color by scale, scalar or by vector/normal magnitude.
void SetVectorModeToVectorRotationOff()
Specify whether to use vector or normal to perform vector operations.
#define VTK_INDEXING_BY_VECTOR
Store vtkAlgorithm input/output information.
void SetScaleModeToScaleByScalar()
Either scale by scalar or by vector/normal magnitude.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
void SelectInputNormals(const char *fieldName)
If you want to use an arbitrary normals array, then set its name here.
void SetScaleModeToScaleByVector()
Either scale by scalar or by vector/normal magnitude.
void SetColorModeToColorByVector()
Either color by scale, scalar or by vector/normal magnitude.
const char * GetVectorModeAsString()
Return the vector mode as a character string.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
#define VTK_VECTOR_ROTATION_OFF
#define VTK_COLOR_BY_VECTOR
void SelectInputVectors(const char *fieldName)
If you want to use an arbitrary vectors array, then set its name here.
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:69
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
copy oriented and scaled glyph geometry to every input point
void SelectInputScalars(const char *fieldName)
If you want to use an arbitrary scalars array, then set its name here.
Superclass for algorithms that produce only polydata as output.
#define VTK_SCALE_BY_SCALAR
a simple class to control print indentation
Definition: vtkIndent.h:39
#define VTK_USE_VECTOR
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
#define VTK_SCALE_BY_VECTORCOMPONENTS
void SetVectorModeToUseVector()
Specify whether to use vector or normal to perform vector operations.
#define VTK_COLOR_BY_SCALAR
const char * GetIndexModeAsString()
Return the index mode as a character string.
void SetVectorModeToUseNormal()
Specify whether to use vector or normal to perform vector operations.
void SetScaleModeToDataScalingOff()
Either scale by scalar or by vector/normal magnitude.
#define VTK_INDEXING_BY_SCALAR
#define VTK_DATA_SCALING_OFF
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void SetColorModeToColorByScalar()
Either color by scale, scalar or by vector/normal magnitude.
#define VTK_USE_NORMAL
Store zero or more vtkInformation instances.
void SetScaleModeToScaleByVectorComponents()
Either scale by scalar or by vector/normal magnitude.
const char * GetScaleModeAsString()
Return the method of scaling as a descriptive character string.
#define VTK_SCALE_BY_VECTOR
#define VTK_INDEXING_OFF
void SetIndexModeToVector()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
#define VTK_COLOR_BY_SCALE
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetIndexModeToScalar()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.