VTK  9.0.2
vtkGlyph3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGlyph3D.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 =========================================================================*/
80 #ifndef vtkGlyph3D_h
81 #define vtkGlyph3D_h
82 
83 #include "vtkFiltersCoreModule.h" // For export macro
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 
103 class vtkTransform;
104 
105 class VTKFILTERSCORE_EXPORT vtkGlyph3D : public vtkPolyDataAlgorithm
106 {
107 public:
109  void PrintSelf(ostream& os, vtkIndent indent) override;
110 
117  static vtkGlyph3D* New();
118 
125  void SetSourceData(vtkPolyData* pd) { this->SetSourceData(0, pd); }
126 
133  void SetSourceData(int id, vtkPolyData* pd);
134 
136 
141  void SetSourceConnection(int id, vtkAlgorithmOutput* algOutput);
143  {
144  this->SetSourceConnection(0, algOutput);
145  }
147 
151  vtkPolyData* GetSource(int id = 0);
152 
154 
157  vtkSetMacro(Scaling, vtkTypeBool);
158  vtkBooleanMacro(Scaling, vtkTypeBool);
159  vtkGetMacro(Scaling, vtkTypeBool);
161 
163 
166  vtkSetMacro(ScaleMode, int);
167  vtkGetMacro(ScaleMode, int);
168  void SetScaleModeToScaleByScalar() { this->SetScaleMode(VTK_SCALE_BY_SCALAR); }
169  void SetScaleModeToScaleByVector() { this->SetScaleMode(VTK_SCALE_BY_VECTOR); }
171  {
172  this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);
173  }
174  void SetScaleModeToDataScalingOff() { this->SetScaleMode(VTK_DATA_SCALING_OFF); }
175  const char* GetScaleModeAsString();
177 
179 
182  vtkSetMacro(ColorMode, int);
183  vtkGetMacro(ColorMode, int);
184  void SetColorModeToColorByScale() { this->SetColorMode(VTK_COLOR_BY_SCALE); }
185  void SetColorModeToColorByScalar() { this->SetColorMode(VTK_COLOR_BY_SCALAR); }
186  void SetColorModeToColorByVector() { this->SetColorMode(VTK_COLOR_BY_VECTOR); }
187  const char* GetColorModeAsString();
189 
191 
194  vtkSetMacro(ScaleFactor, double);
195  vtkGetMacro(ScaleFactor, double);
197 
199 
202  vtkSetVector2Macro(Range, double);
203  vtkGetVectorMacro(Range, double, 2);
205 
207 
210  vtkSetMacro(Orient, vtkTypeBool);
211  vtkBooleanMacro(Orient, vtkTypeBool);
212  vtkGetMacro(Orient, vtkTypeBool);
214 
216 
220  vtkSetMacro(Clamping, vtkTypeBool);
221  vtkBooleanMacro(Clamping, vtkTypeBool);
222  vtkGetMacro(Clamping, vtkTypeBool);
224 
226 
229  vtkSetMacro(VectorMode, int);
230  vtkGetMacro(VectorMode, int);
231  void SetVectorModeToUseVector() { this->SetVectorMode(VTK_USE_VECTOR); }
232  void SetVectorModeToUseNormal() { this->SetVectorMode(VTK_USE_NORMAL); }
234  const char* GetVectorModeAsString();
236 
238 
245  vtkSetMacro(IndexMode, int);
246  vtkGetMacro(IndexMode, int);
247  void SetIndexModeToScalar() { this->SetIndexMode(VTK_INDEXING_BY_SCALAR); }
248  void SetIndexModeToVector() { this->SetIndexMode(VTK_INDEXING_BY_VECTOR); }
249  void SetIndexModeToOff() { this->SetIndexMode(VTK_INDEXING_OFF); }
250  const char* GetIndexModeAsString();
252 
254 
260  vtkSetMacro(GeneratePointIds, vtkTypeBool);
261  vtkGetMacro(GeneratePointIds, vtkTypeBool);
262  vtkBooleanMacro(GeneratePointIds, vtkTypeBool);
264 
266 
270  vtkSetStringMacro(PointIdsName);
271  vtkGetStringMacro(PointIdsName);
273 
275 
280  vtkSetMacro(FillCellData, vtkTypeBool);
281  vtkGetMacro(FillCellData, vtkTypeBool);
282  vtkBooleanMacro(FillCellData, vtkTypeBool);
284 
289  virtual int IsPointVisible(vtkDataSet*, vtkIdType) { return 1; }
290 
292 
298  vtkGetObjectMacro(SourceTransform, vtkTransform);
300 
304  vtkMTimeType GetMTime() override;
305 
307 
312  vtkSetMacro(OutputPointsPrecision, int);
313  vtkGetMacro(OutputPointsPrecision, int);
315 
316 protected:
318  ~vtkGlyph3D() override;
319 
323 
325 
327 
332  virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output);
333  virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output,
334  vtkDataArray* inSScalars, vtkDataArray* inVectors);
336 
337  vtkPolyData** Source; // Geometry to copy to each point
338  vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
339  int ScaleMode; // Scale by scalar value or vector magnitude
340  int ColorMode; // new scalars based on scale, scalar or vector
341  double ScaleFactor; // Scale factor to use to scale geometry
342  double Range[2]; // Range to use to perform scalar scaling
343  int Orient; // boolean controls whether to "orient" data
344  int VectorMode; // Orient/scale via normal or via vector data
345  vtkTypeBool Clamping; // whether to clamp scale factor
346  int IndexMode; // what to use to index into glyph table
347  vtkTypeBool GeneratePointIds; // produce input points ids for each output point
348  vtkTypeBool FillCellData; // whether to fill output cell data
352 
353 private:
354  vtkGlyph3D(const vtkGlyph3D&) = delete;
355  void operator=(const vtkGlyph3D&) = delete;
356 };
357 
359 
362 inline const char* vtkGlyph3D::GetScaleModeAsString(void)
363 {
364  if (this->ScaleMode == VTK_SCALE_BY_SCALAR)
365  {
366  return "ScaleByScalar";
367  }
368  else if (this->ScaleMode == VTK_SCALE_BY_VECTOR)
369  {
370  return "ScaleByVector";
371  }
372  else
373  {
374  return "DataScalingOff";
375  }
376 }
378 
380 
383 inline const char* vtkGlyph3D::GetColorModeAsString(void)
384 {
385  if (this->ColorMode == VTK_COLOR_BY_SCALAR)
386  {
387  return "ColorByScalar";
388  }
389  else if (this->ColorMode == VTK_COLOR_BY_VECTOR)
390  {
391  return "ColorByVector";
392  }
393  else
394  {
395  return "ColorByScale";
396  }
397 }
399 
401 
404 inline const char* vtkGlyph3D::GetVectorModeAsString(void)
405 {
406  if (this->VectorMode == VTK_USE_VECTOR)
407  {
408  return "UseVector";
409  }
410  else if (this->VectorMode == VTK_USE_NORMAL)
411  {
412  return "UseNormal";
413  }
414  else
415  {
416  return "VectorRotationOff";
417  }
418 }
420 
422 
425 inline const char* vtkGlyph3D::GetIndexModeAsString(void)
426 {
427  if (this->IndexMode == VTK_INDEXING_OFF)
428  {
429  return "IndexingOff";
430  }
431  else if (this->IndexMode == VTK_INDEXING_BY_SCALAR)
432  {
433  return "IndexingByScalar";
434  }
435  else
436  {
437  return "IndexingByVector";
438  }
439 }
441 
442 #endif
Proxy object to connect input/output ports.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
abstract class to specify dataset behavior
Definition: vtkDataSet.h:57
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:106
void SetIndexModeToScalar()
Definition: vtkGlyph3D.h:247
vtkPolyData * GetSource(int idx, vtkInformationVector *sourceInfo)
void SetSourceData(int id, vtkPolyData *pd)
Specify a source object at a specified table location.
void SetScaleModeToScaleByVector()
Definition: vtkGlyph3D.h:169
int OutputPointsPrecision
Definition: vtkGlyph3D.h:351
void SetVectorModeToUseNormal()
Definition: vtkGlyph3D.h:232
const char * GetVectorModeAsString()
Return the vector mode as a character string.
Definition: vtkGlyph3D.h:404
void SetScaleModeToScaleByVectorComponents()
Definition: vtkGlyph3D.h:170
int ScaleMode
Definition: vtkGlyph3D.h:339
vtkPolyData * GetSource(int id=0)
Get a pointer to a source object at a specified table location.
void SetIndexModeToOff()
Definition: vtkGlyph3D.h:249
void SetScaleModeToScaleByScalar()
Definition: vtkGlyph3D.h:168
void SetColorModeToColorByScalar()
Definition: vtkGlyph3D.h:185
void SetSourceTransform(vtkTransform *)
When set, this is use to transform the source polydata before using it to generate the glyph.
int ColorMode
Definition: vtkGlyph3D.h:340
const char * GetIndexModeAsString()
Return the index mode as a character string.
Definition: vtkGlyph3D.h:425
static vtkGlyph3D * New()
Construct object with scaling on, scaling mode is by scalar value, scale factor = 1....
vtkTypeBool Scaling
Definition: vtkGlyph3D.h:338
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
const char * GetScaleModeAsString()
Return the method of scaling as a descriptive character string.
Definition: vtkGlyph3D.h:362
int VectorMode
Definition: vtkGlyph3D.h:344
void SetVectorModeToUseVector()
Definition: vtkGlyph3D.h:231
void SetScaleModeToDataScalingOff()
Definition: vtkGlyph3D.h:174
vtkMTimeType GetMTime() override
Overridden to include SourceTransform's MTime.
virtual int IsPointVisible(vtkDataSet *, vtkIdType)
This can be overwritten by subclass to return 0 when a point is blanked.
Definition: vtkGlyph3D.h:289
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
Definition: vtkGlyph3D.h:383
void SetSourceConnection(int id, vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkTypeBool Clamping
Definition: vtkGlyph3D.h:345
int IndexMode
Definition: vtkGlyph3D.h:346
void SetColorModeToColorByScale()
Definition: vtkGlyph3D.h:184
virtual bool Execute(vtkDataSet *input, vtkInformationVector *sourceVector, vtkPolyData *output, vtkDataArray *inSScalars, vtkDataArray *inVectors)
void SetColorModeToColorByVector()
Definition: vtkGlyph3D.h:186
vtkTypeBool FillCellData
Definition: vtkGlyph3D.h:348
vtkPolyData ** Source
Definition: vtkGlyph3D.h:337
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Definition: vtkGlyph3D.h:142
~vtkGlyph3D() override
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
char * PointIdsName
Definition: vtkGlyph3D.h:349
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
double ScaleFactor
Definition: vtkGlyph3D.h:341
vtkTransform * SourceTransform
Definition: vtkGlyph3D.h:350
void SetIndexModeToVector()
Definition: vtkGlyph3D.h:248
void SetSourceData(vtkPolyData *pd)
Set the source to use for the glyph.
Definition: vtkGlyph3D.h:125
void SetVectorModeToVectorRotationOff()
Definition: vtkGlyph3D.h:233
vtkTypeBool GeneratePointIds
Definition: vtkGlyph3D.h:347
virtual bool Execute(vtkDataSet *input, vtkInformationVector *sourceVector, vtkPolyData *output)
Method called in RequestData() to do the actual data processing.
a simple class to control print indentation
Definition: vtkIndent.h:34
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:85
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:55
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
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_COLOR_BY_VECTOR
Definition: vtkGlyph3D.h:93
#define VTK_SCALE_BY_SCALAR
Definition: vtkGlyph3D.h:86
#define VTK_INDEXING_BY_SCALAR
Definition: vtkGlyph3D.h:100
#define VTK_DATA_SCALING_OFF
Definition: vtkGlyph3D.h:89
#define VTK_VECTOR_ROTATION_OFF
Definition: vtkGlyph3D.h:97
#define VTK_COLOR_BY_SCALAR
Definition: vtkGlyph3D.h:92
#define VTK_USE_VECTOR
Definition: vtkGlyph3D.h:95
#define VTK_USE_NORMAL
Definition: vtkGlyph3D.h:96
#define VTK_INDEXING_BY_VECTOR
Definition: vtkGlyph3D.h:101
#define VTK_SCALE_BY_VECTOR
Definition: vtkGlyph3D.h:87
#define VTK_INDEXING_OFF
Definition: vtkGlyph3D.h:99
#define VTK_COLOR_BY_SCALE
Definition: vtkGlyph3D.h:91
#define VTK_SCALE_BY_VECTORCOMPONENTS
Definition: vtkGlyph3D.h:88
int vtkIdType
Definition: vtkType.h:338
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293