VTK  9.2.20230328
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 VTK_ABI_NAMESPACE_BEGIN
106 class VTKFILTERSGENERIC_EXPORT vtkGenericGlyph3DFilter : public vtkPolyDataAlgorithm
107 {
108 public:
110  void PrintSelf(ostream& os, vtkIndent indent) override;
111 
119 
123  void SetSourceData(vtkPolyData* pd) { this->SetSourceData(0, pd); }
124 
128  void SetSourceData(int id, vtkPolyData* pd);
129 
133  vtkPolyData* GetSource(int id = 0);
134 
136 
139  vtkSetMacro(Scaling, vtkTypeBool);
140  vtkBooleanMacro(Scaling, vtkTypeBool);
141  vtkGetMacro(Scaling, vtkTypeBool);
143 
145 
148  vtkSetMacro(ScaleMode, int);
149  vtkGetMacro(ScaleMode, int);
150  void SetScaleModeToScaleByScalar() { this->SetScaleMode(VTK_SCALE_BY_SCALAR); }
151  void SetScaleModeToScaleByVector() { this->SetScaleMode(VTK_SCALE_BY_VECTOR); }
153  {
154  this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);
155  }
156  void SetScaleModeToDataScalingOff() { this->SetScaleMode(VTK_DATA_SCALING_OFF); }
157  const char* GetScaleModeAsString();
159 
161 
164  vtkSetMacro(ColorMode, int);
165  vtkGetMacro(ColorMode, int);
166  void SetColorModeToColorByScale() { this->SetColorMode(VTK_COLOR_BY_SCALE); }
167  void SetColorModeToColorByScalar() { this->SetColorMode(VTK_COLOR_BY_SCALAR); }
168  void SetColorModeToColorByVector() { this->SetColorMode(VTK_COLOR_BY_VECTOR); }
169  const char* GetColorModeAsString();
171 
173 
176  vtkSetMacro(ScaleFactor, double);
177  vtkGetMacro(ScaleFactor, double);
179 
181 
184  vtkSetVector2Macro(Range, double);
185  vtkGetVectorMacro(Range, double, 2);
187 
189 
192  vtkSetMacro(Orient, vtkTypeBool);
193  vtkBooleanMacro(Orient, vtkTypeBool);
194  vtkGetMacro(Orient, vtkTypeBool);
196 
198 
202  vtkSetMacro(Clamping, vtkTypeBool);
203  vtkBooleanMacro(Clamping, vtkTypeBool);
204  vtkGetMacro(Clamping, vtkTypeBool);
206 
208 
211  vtkSetMacro(VectorMode, int);
212  vtkGetMacro(VectorMode, int);
213  void SetVectorModeToUseVector() { this->SetVectorMode(VTK_USE_VECTOR); }
214  void SetVectorModeToUseNormal() { this->SetVectorMode(VTK_USE_NORMAL); }
216  const char* GetVectorModeAsString();
218 
220 
225  vtkSetMacro(IndexMode, int);
226  vtkGetMacro(IndexMode, int);
227  void SetIndexModeToScalar() { this->SetIndexMode(VTK_INDEXING_BY_SCALAR); }
228  void SetIndexModeToVector() { this->SetIndexMode(VTK_INDEXING_BY_VECTOR); }
229  void SetIndexModeToOff() { this->SetIndexMode(VTK_INDEXING_OFF); }
230  const char* GetIndexModeAsString();
232 
234 
240  vtkSetMacro(GeneratePointIds, vtkTypeBool);
241  vtkGetMacro(GeneratePointIds, vtkTypeBool);
242  vtkBooleanMacro(GeneratePointIds, vtkTypeBool);
244 
246 
250  vtkSetStringMacro(PointIdsName);
251  vtkGetStringMacro(PointIdsName);
253 
255 
259  vtkGetStringMacro(InputScalarsSelection);
260  void SelectInputScalars(const char* fieldName) { this->SetInputScalarsSelection(fieldName); }
262 
264 
268  vtkGetStringMacro(InputVectorsSelection);
269  void SelectInputVectors(const char* fieldName) { this->SetInputVectorsSelection(fieldName); }
271 
273 
277  vtkGetStringMacro(InputNormalsSelection);
278  void SelectInputNormals(const char* fieldName) { this->SetInputNormalsSelection(fieldName); }
280 
281 protected:
284 
286 
290  vtkPolyData** Source; // Geometry to copy to each point
291  vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
292  int ScaleMode; // Scale by scalar value or vector magnitude
293  int ColorMode; // new scalars based on scale, scalar or vector
294  double ScaleFactor; // Scale factor to use to scale geometry
295  double Range[2]; // Range to use to perform scalar scaling
296  vtkTypeBool Orient; // boolean controls whether to "orient" data
297  int VectorMode; // Orient/scale via normal or via vector data
298  vtkTypeBool Clamping; // whether to clamp scale factor
299  int IndexMode; // what to use to index into glyph table
300  vtkTypeBool GeneratePointIds; // produce input points ids for each output point
302 
306  vtkSetStringMacro(InputScalarsSelection);
307  vtkSetStringMacro(InputVectorsSelection);
308  vtkSetStringMacro(InputNormalsSelection);
309 
310 private:
312  void operator=(const vtkGenericGlyph3DFilter&) = delete;
313 };
314 
319 {
320  if (this->ScaleMode == VTK_SCALE_BY_SCALAR)
321  {
322  return "ScaleByScalar";
323  }
324  else if (this->ScaleMode == VTK_SCALE_BY_VECTOR)
325  {
326  return "ScaleByVector";
327  }
328  else
329  {
330  return "DataScalingOff";
331  }
332 }
333 
338 {
339  if (this->ColorMode == VTK_COLOR_BY_SCALAR)
340  {
341  return "ColorByScalar";
342  }
343  else if (this->ColorMode == VTK_COLOR_BY_VECTOR)
344  {
345  return "ColorByVector";
346  }
347  else
348  {
349  return "ColorByScale";
350  }
351 }
352 
357 {
358  if (this->VectorMode == VTK_USE_VECTOR)
359  {
360  return "UseVector";
361  }
362  else if (this->VectorMode == VTK_USE_NORMAL)
363  {
364  return "UseNormal";
365  }
366  else
367  {
368  return "VectorRotationOff";
369  }
370 }
371 
376 {
377  if (this->IndexMode == VTK_INDEXING_OFF)
378  {
379  return "IndexingOff";
380  }
381  else if (this->IndexMode == VTK_INDEXING_BY_SCALAR)
382  {
383  return "IndexingByScalar";
384  }
385  else
386  {
387  return "IndexingByVector";
388  }
389 }
390 
391 VTK_ABI_NAMESPACE_END
392 #endif
copy oriented and scaled glyph geometry to every input point
void SelectInputVectors(const char *fieldName)
If you want to use an arbitrary vectors array, then set its name here.
void SelectInputNormals(const char *fieldName)
If you want to use an arbitrary normals array, then set its name here.
vtkPolyData * GetSource(int id=0)
Get a pointer to a source object at a specified table location.
~vtkGenericGlyph3DFilter() override
static vtkGenericGlyph3DFilter * New()
Construct object with scaling on, scaling mode is by scalar value, scale factor = 1....
void SetScaleModeToScaleByScalar()
Either scale by scalar or by vector/normal magnitude.
void SetScaleModeToScaleByVector()
Either scale by scalar or by vector/normal magnitude.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void SetVectorModeToUseVector()
Specify whether to use vector or normal to perform vector operations.
const char * GetScaleModeAsString()
Return the method of scaling as a descriptive character string.
void SetIndexModeToVector()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
void SetColorModeToColorByVector()
Either color by scale, scalar or by vector/normal magnitude.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
void SetSourceData(vtkPolyData *pd)
Set the source to use for the glyph.
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
void SetColorModeToColorByScalar()
Either color by scale, scalar or by vector/normal magnitude.
void SetColorModeToColorByScale()
Either color by scale, scalar or by vector/normal magnitude.
void SetIndexModeToScalar()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetIndexModeToOff()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
const char * GetVectorModeAsString()
Return the vector mode as a character string.
void SetSourceData(int id, vtkPolyData *pd)
Specify a source object at a specified table location.
void SetVectorModeToUseNormal()
Specify whether to use vector or normal to perform vector operations.
void SelectInputScalars(const char *fieldName)
If you want to use an arbitrary scalars array, then set its name here.
const char * GetIndexModeAsString()
Return the index mode as a character string.
void SetVectorModeToVectorRotationOff()
Specify whether to use vector or normal to perform vector operations.
void SetScaleModeToScaleByVectorComponents()
Either scale by scalar or by vector/normal magnitude.
void SetScaleModeToDataScalingOff()
Either scale by scalar or by vector/normal magnitude.
a simple class to control print indentation
Definition: vtkIndent.h:120
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:201
auto Range(IterablePtr iterable, Options &&... opts) -> typename detail::IterableTraits< typename detail::StripPointers< IterablePtr >::type >::RangeType
Generate an iterable STL proxy object for a VTK container.
Definition: vtkRange.h:86
int vtkTypeBool
Definition: vtkABI.h:71
#define VTK_COLOR_BY_VECTOR
#define VTK_SCALE_BY_SCALAR
#define VTK_INDEXING_BY_SCALAR
#define VTK_DATA_SCALING_OFF
#define VTK_VECTOR_ROTATION_OFF
#define VTK_COLOR_BY_SCALAR
#define VTK_USE_VECTOR
#define VTK_USE_NORMAL
#define VTK_INDEXING_BY_VECTOR
#define VTK_SCALE_BY_VECTOR
#define VTK_INDEXING_OFF
#define VTK_COLOR_BY_SCALE
#define VTK_SCALE_BY_VECTORCOMPONENTS