VTK  9.1.0
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 #define VTK_FOLLOW_CAMERA_DIRECTION 3
99 
100 #define VTK_INDEXING_OFF 0
101 #define VTK_INDEXING_BY_SCALAR 1
102 #define VTK_INDEXING_BY_VECTOR 2
103 
104 class vtkTransform;
105 
106 class VTKFILTERSCORE_EXPORT vtkGlyph3D : public vtkPolyDataAlgorithm
107 {
108 public:
110  void PrintSelf(ostream& os, vtkIndent indent) override;
111 
118  static vtkGlyph3D* New();
119 
126  void SetSourceData(vtkPolyData* pd) { this->SetSourceData(0, pd); }
127 
134  void SetSourceData(int id, vtkPolyData* pd);
135 
137 
142  void SetSourceConnection(int id, vtkAlgorithmOutput* algOutput);
144  {
145  this->SetSourceConnection(0, algOutput);
146  }
148 
152  vtkPolyData* GetSource(int id = 0);
153 
155 
158  vtkSetMacro(Scaling, vtkTypeBool);
159  vtkBooleanMacro(Scaling, vtkTypeBool);
160  vtkGetMacro(Scaling, vtkTypeBool);
162 
164 
167  vtkSetMacro(ScaleMode, int);
168  vtkGetMacro(ScaleMode, int);
169  void SetScaleModeToScaleByScalar() { this->SetScaleMode(VTK_SCALE_BY_SCALAR); }
170  void SetScaleModeToScaleByVector() { this->SetScaleMode(VTK_SCALE_BY_VECTOR); }
172  {
173  this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);
174  }
175  void SetScaleModeToDataScalingOff() { this->SetScaleMode(VTK_DATA_SCALING_OFF); }
176  const char* GetScaleModeAsString();
178 
180 
183  vtkSetMacro(ColorMode, int);
184  vtkGetMacro(ColorMode, int);
185  void SetColorModeToColorByScale() { this->SetColorMode(VTK_COLOR_BY_SCALE); }
186  void SetColorModeToColorByScalar() { this->SetColorMode(VTK_COLOR_BY_SCALAR); }
187  void SetColorModeToColorByVector() { this->SetColorMode(VTK_COLOR_BY_VECTOR); }
188  const char* GetColorModeAsString();
190 
192 
195  vtkSetMacro(ScaleFactor, double);
196  vtkGetMacro(ScaleFactor, double);
198 
200 
203  vtkSetVector2Macro(Range, double);
204  vtkGetVectorMacro(Range, double, 2);
206 
208 
211  vtkSetMacro(Orient, vtkTypeBool);
212  vtkBooleanMacro(Orient, vtkTypeBool);
213  vtkGetMacro(Orient, vtkTypeBool);
215 
217 
221  vtkSetMacro(Clamping, vtkTypeBool);
222  vtkBooleanMacro(Clamping, vtkTypeBool);
223  vtkGetMacro(Clamping, vtkTypeBool);
225 
227 
230  vtkSetMacro(VectorMode, int);
231  vtkGetMacro(VectorMode, int);
232  void SetVectorModeToUseVector() { this->SetVectorMode(VTK_USE_VECTOR); }
233  void SetVectorModeToUseNormal() { this->SetVectorMode(VTK_USE_NORMAL); }
236  const char* GetVectorModeAsString();
238 
240 
244  vtkSetVectorMacro(FollowedCameraPosition, double, 3);
245  vtkGetVectorMacro(FollowedCameraPosition, double, 3);
247 
249 
252  vtkSetVectorMacro(FollowedCameraViewUp, double, 3);
253  vtkGetVectorMacro(FollowedCameraViewUp, double, 3);
255 
257 
264  vtkSetMacro(IndexMode, int);
265  vtkGetMacro(IndexMode, int);
266  void SetIndexModeToScalar() { this->SetIndexMode(VTK_INDEXING_BY_SCALAR); }
267  void SetIndexModeToVector() { this->SetIndexMode(VTK_INDEXING_BY_VECTOR); }
268  void SetIndexModeToOff() { this->SetIndexMode(VTK_INDEXING_OFF); }
269  const char* GetIndexModeAsString();
271 
273 
279  vtkSetMacro(GeneratePointIds, vtkTypeBool);
280  vtkGetMacro(GeneratePointIds, vtkTypeBool);
281  vtkBooleanMacro(GeneratePointIds, vtkTypeBool);
283 
285 
289  vtkSetStringMacro(PointIdsName);
290  vtkGetStringMacro(PointIdsName);
292 
294 
299  vtkSetMacro(FillCellData, vtkTypeBool);
300  vtkGetMacro(FillCellData, vtkTypeBool);
301  vtkBooleanMacro(FillCellData, vtkTypeBool);
303 
308  virtual int IsPointVisible(vtkDataSet*, vtkIdType) { return 1; }
309 
311 
317  vtkGetObjectMacro(SourceTransform, vtkTransform);
319 
323  vtkMTimeType GetMTime() override;
324 
326 
331  vtkSetMacro(OutputPointsPrecision, int);
332  vtkGetMacro(OutputPointsPrecision, int);
334 
335 protected:
337  ~vtkGlyph3D() override;
338 
342 
344 
346 
351  virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output);
352  virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output,
353  vtkDataArray* inSScalars, vtkDataArray* inVectors);
355 
356  vtkPolyData** Source; // Geometry to copy to each point
357  vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
358  int ScaleMode; // Scale by scalar value or vector magnitude
359  int ColorMode; // new scalars based on scale, scalar or vector
360  double ScaleFactor; // Scale factor to use to scale geometry
361  double Range[2]; // Range to use to perform scalar scaling
362  int Orient; // boolean controls whether to "orient" data
363  int VectorMode; // Orient/scale via normal or via vector data
364  double
365  FollowedCameraPosition[3]; // glyphs face towards this point in VTK_FOLLOW_CAMERA_DIRECTION mode
366  double FollowedCameraViewUp[3]; // glyph up direction in VTK_FOLLOW_CAMERA_DIRECTION mode
367  vtkTypeBool Clamping; // whether to clamp scale factor
368  int IndexMode; // what to use to index into glyph table
369  vtkTypeBool GeneratePointIds; // produce input points ids for each output point
370  vtkTypeBool FillCellData; // whether to fill output cell data
374 
375 private:
376  vtkGlyph3D(const vtkGlyph3D&) = delete;
377  void operator=(const vtkGlyph3D&) = delete;
378 };
379 
384 {
385  if (this->ScaleMode == VTK_SCALE_BY_SCALAR)
386  {
387  return "ScaleByScalar";
388  }
389  else if (this->ScaleMode == VTK_SCALE_BY_VECTOR)
390  {
391  return "ScaleByVector";
392  }
393  else
394  {
395  return "DataScalingOff";
396  }
397 }
398 
403 {
404  if (this->ColorMode == VTK_COLOR_BY_SCALAR)
405  {
406  return "ColorByScalar";
407  }
408  else if (this->ColorMode == VTK_COLOR_BY_VECTOR)
409  {
410  return "ColorByVector";
411  }
412  else
413  {
414  return "ColorByScale";
415  }
416 }
417 
422 {
423  if (this->VectorMode == VTK_USE_VECTOR)
424  {
425  return "UseVector";
426  }
427  else if (this->VectorMode == VTK_USE_NORMAL)
428  {
429  return "UseNormal";
430  }
431  else if (this->VectorMode == VTK_FOLLOW_CAMERA_DIRECTION)
432  {
433  return "FollowCameraDirection";
434  }
435  else
436  {
437  return "VectorRotationOff";
438  }
439 }
440 
445 {
446  if (this->IndexMode == VTK_INDEXING_OFF)
447  {
448  return "IndexingOff";
449  }
450  else if (this->IndexMode == VTK_INDEXING_BY_SCALAR)
451  {
452  return "IndexingByScalar";
453  }
454  else
455  {
456  return "IndexingByVector";
457  }
458 }
459 
460 #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:107
void SetIndexModeToScalar()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:266
vtkPolyData * GetSource(int idx, vtkInformationVector *sourceInfo)
void SetSourceData(int id, vtkPolyData *pd)
Specify a source object at a specified table location.
void SetScaleModeToScaleByVector()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:170
int OutputPointsPrecision
Definition: vtkGlyph3D.h:373
void SetVectorModeToUseNormal()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:233
const char * GetVectorModeAsString()
Return the vector mode as a character string.
Definition: vtkGlyph3D.h:421
void SetScaleModeToScaleByVectorComponents()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:171
int ScaleMode
Definition: vtkGlyph3D.h:358
vtkPolyData * GetSource(int id=0)
Get a pointer to a source object at a specified table location.
void SetIndexModeToOff()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:268
void SetScaleModeToScaleByScalar()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:169
void SetColorModeToColorByScalar()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:186
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:359
const char * GetIndexModeAsString()
Return the index mode as a character string.
Definition: vtkGlyph3D.h:444
static vtkGlyph3D * New()
Construct object with scaling on, scaling mode is by scalar value, scale factor = 1....
vtkTypeBool Scaling
Definition: vtkGlyph3D.h:357
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:383
int VectorMode
Definition: vtkGlyph3D.h:363
void SetVectorModeToUseVector()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:232
void SetScaleModeToDataScalingOff()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:175
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:308
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
Definition: vtkGlyph3D.h:402
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:367
int IndexMode
Definition: vtkGlyph3D.h:368
void SetColorModeToColorByScale()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:185
virtual bool Execute(vtkDataSet *input, vtkInformationVector *sourceVector, vtkPolyData *output, vtkDataArray *inSScalars, vtkDataArray *inVectors)
Method called in RequestData() to do the actual data processing.
void SetColorModeToColorByVector()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:187
vtkTypeBool FillCellData
Definition: vtkGlyph3D.h:370
vtkPolyData ** Source
Definition: vtkGlyph3D.h:356
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
Definition: vtkGlyph3D.h:143
~vtkGlyph3D() override
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
void SetVectorModeToFollowCameraDirection()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:235
char * PointIdsName
Definition: vtkGlyph3D.h:371
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
double ScaleFactor
Definition: vtkGlyph3D.h:360
vtkTransform * SourceTransform
Definition: vtkGlyph3D.h:372
void SetIndexModeToVector()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:267
void SetSourceData(vtkPolyData *pd)
Set the source to use for the glyph.
Definition: vtkGlyph3D.h:126
void SetVectorModeToVectorRotationOff()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:234
vtkTypeBool GeneratePointIds
Definition: vtkGlyph3D.h:369
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:86
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_FOLLOW_CAMERA_DIRECTION
Definition: vtkGlyph3D.h:98
#define VTK_SCALE_BY_SCALAR
Definition: vtkGlyph3D.h:86
#define VTK_INDEXING_BY_SCALAR
Definition: vtkGlyph3D.h:101
#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:102
#define VTK_SCALE_BY_VECTOR
Definition: vtkGlyph3D.h:87
#define VTK_INDEXING_OFF
Definition: vtkGlyph3D.h:100
#define VTK_COLOR_BY_SCALE
Definition: vtkGlyph3D.h:91
#define VTK_SCALE_BY_VECTORCOMPONENTS
Definition: vtkGlyph3D.h:88
int vtkIdType
Definition: vtkType.h:332
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287