VTK  9.2.6
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);
149  void SetScaleModeToScaleByScalar() { this->SetScaleMode(VTK_SCALE_BY_SCALAR); }
150  void SetScaleModeToScaleByVector() { this->SetScaleMode(VTK_SCALE_BY_VECTOR); }
152  {
153  this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);
154  }
155  void SetScaleModeToDataScalingOff() { this->SetScaleMode(VTK_DATA_SCALING_OFF); }
156  const char* GetScaleModeAsString();
158 
160 
163  vtkSetMacro(ColorMode, int);
164  vtkGetMacro(ColorMode, int);
165  void SetColorModeToColorByScale() { this->SetColorMode(VTK_COLOR_BY_SCALE); }
166  void SetColorModeToColorByScalar() { this->SetColorMode(VTK_COLOR_BY_SCALAR); }
167  void SetColorModeToColorByVector() { this->SetColorMode(VTK_COLOR_BY_VECTOR); }
168  const char* GetColorModeAsString();
170 
172 
175  vtkSetMacro(ScaleFactor, double);
176  vtkGetMacro(ScaleFactor, double);
178 
180 
183  vtkSetVector2Macro(Range, double);
184  vtkGetVectorMacro(Range, double, 2);
186 
188 
191  vtkSetMacro(Orient, vtkTypeBool);
192  vtkBooleanMacro(Orient, vtkTypeBool);
193  vtkGetMacro(Orient, vtkTypeBool);
195 
197 
201  vtkSetMacro(Clamping, vtkTypeBool);
202  vtkBooleanMacro(Clamping, vtkTypeBool);
203  vtkGetMacro(Clamping, vtkTypeBool);
205 
207 
210  vtkSetMacro(VectorMode, int);
211  vtkGetMacro(VectorMode, int);
212  void SetVectorModeToUseVector() { this->SetVectorMode(VTK_USE_VECTOR); }
213  void SetVectorModeToUseNormal() { this->SetVectorMode(VTK_USE_NORMAL); }
215  const char* GetVectorModeAsString();
217 
219 
224  vtkSetMacro(IndexMode, int);
225  vtkGetMacro(IndexMode, int);
226  void SetIndexModeToScalar() { this->SetIndexMode(VTK_INDEXING_BY_SCALAR); }
227  void SetIndexModeToVector() { this->SetIndexMode(VTK_INDEXING_BY_VECTOR); }
228  void SetIndexModeToOff() { this->SetIndexMode(VTK_INDEXING_OFF); }
229  const char* GetIndexModeAsString();
231 
233 
239  vtkSetMacro(GeneratePointIds, vtkTypeBool);
240  vtkGetMacro(GeneratePointIds, vtkTypeBool);
241  vtkBooleanMacro(GeneratePointIds, vtkTypeBool);
243 
245 
249  vtkSetStringMacro(PointIdsName);
250  vtkGetStringMacro(PointIdsName);
252 
254 
258  vtkGetStringMacro(InputScalarsSelection);
259  void SelectInputScalars(const char* fieldName) { this->SetInputScalarsSelection(fieldName); }
261 
263 
267  vtkGetStringMacro(InputVectorsSelection);
268  void SelectInputVectors(const char* fieldName) { this->SetInputVectorsSelection(fieldName); }
270 
272 
276  vtkGetStringMacro(InputNormalsSelection);
277  void SelectInputNormals(const char* fieldName) { this->SetInputNormalsSelection(fieldName); }
279 
280 protected:
282  ~vtkGenericGlyph3DFilter() override;
283 
284  int FillInputPortInformation(int, vtkInformation*) override;
285 
289  vtkPolyData** Source; // Geometry to copy to each point
290  vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
291  int ScaleMode; // Scale by scalar value or vector magnitude
292  int ColorMode; // new scalars based on scale, scalar or vector
293  double ScaleFactor; // Scale factor to use to scale geometry
294  double Range[2]; // Range to use to perform scalar scaling
295  vtkTypeBool Orient; // boolean controls whether to "orient" data
296  int VectorMode; // Orient/scale via normal or via vector data
297  vtkTypeBool Clamping; // whether to clamp scale factor
298  int IndexMode; // what to use to index into glyph table
299  vtkTypeBool GeneratePointIds; // produce input points ids for each output point
301 
305  vtkSetStringMacro(InputScalarsSelection);
306  vtkSetStringMacro(InputVectorsSelection);
307  vtkSetStringMacro(InputNormalsSelection);
308 
309 private:
311  void operator=(const vtkGenericGlyph3DFilter&) = delete;
312 };
313 
318 {
319  if (this->ScaleMode == VTK_SCALE_BY_SCALAR)
320  {
321  return "ScaleByScalar";
322  }
323  else if (this->ScaleMode == VTK_SCALE_BY_VECTOR)
324  {
325  return "ScaleByVector";
326  }
327  else
328  {
329  return "DataScalingOff";
330  }
331 }
332 
337 {
338  if (this->ColorMode == VTK_COLOR_BY_SCALAR)
339  {
340  return "ColorByScalar";
341  }
342  else if (this->ColorMode == VTK_COLOR_BY_VECTOR)
343  {
344  return "ColorByVector";
345  }
346  else
347  {
348  return "ColorByScale";
349  }
350 }
351 
356 {
357  if (this->VectorMode == VTK_USE_VECTOR)
358  {
359  return "UseVector";
360  }
361  else if (this->VectorMode == VTK_USE_NORMAL)
362  {
363  return "UseNormal";
364  }
365  else
366  {
367  return "VectorRotationOff";
368  }
369 }
370 
375 {
376  if (this->IndexMode == VTK_INDEXING_OFF)
377  {
378  return "IndexingOff";
379  }
380  else if (this->IndexMode == VTK_INDEXING_BY_SCALAR)
381  {
382  return "IndexingByScalar";
383  }
384  else
385  {
386  return "IndexingByVector";
387  }
388 }
389 
390 #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:90
#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
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:85
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.