VTK  9.2.6
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 =========================================================================*/
195 #ifndef vtkGlyph3D_h
196 #define vtkGlyph3D_h
197 
198 #include "vtkFiltersCoreModule.h" // For export macro
199 #include "vtkPolyDataAlgorithm.h"
200 
201 #define VTK_SCALE_BY_SCALAR 0
202 #define VTK_SCALE_BY_VECTOR 1
203 #define VTK_SCALE_BY_VECTORCOMPONENTS 2
204 #define VTK_DATA_SCALING_OFF 3
205 
206 #define VTK_COLOR_BY_SCALE 0
207 #define VTK_COLOR_BY_SCALAR 1
208 #define VTK_COLOR_BY_VECTOR 2
209 
210 #define VTK_USE_VECTOR 0
211 #define VTK_USE_NORMAL 1
212 #define VTK_VECTOR_ROTATION_OFF 2
213 #define VTK_FOLLOW_CAMERA_DIRECTION 3
214 
215 #define VTK_INDEXING_OFF 0
216 #define VTK_INDEXING_BY_SCALAR 1
217 #define VTK_INDEXING_BY_VECTOR 2
218 
219 class vtkTransform;
220 
221 class VTKFILTERSCORE_EXPORT vtkGlyph3D : public vtkPolyDataAlgorithm
222 {
223 public:
225  void PrintSelf(ostream& os, vtkIndent indent) override;
226 
233  static vtkGlyph3D* New();
234 
241  void SetSourceData(vtkPolyData* pd) { this->SetSourceData(0, pd); }
242 
249  void SetSourceData(int id, vtkPolyData* pd);
250 
252 
257  void SetSourceConnection(int id, vtkAlgorithmOutput* algOutput);
259  {
260  this->SetSourceConnection(0, algOutput);
261  }
263 
267  vtkPolyData* GetSource(int id = 0);
268 
270 
273  vtkSetMacro(Scaling, vtkTypeBool);
274  vtkBooleanMacro(Scaling, vtkTypeBool);
275  vtkGetMacro(Scaling, vtkTypeBool);
277 
279 
282  vtkSetMacro(ScaleMode, int);
283  vtkGetMacro(ScaleMode, int);
284  void SetScaleModeToScaleByScalar() { this->SetScaleMode(VTK_SCALE_BY_SCALAR); }
285  void SetScaleModeToScaleByVector() { this->SetScaleMode(VTK_SCALE_BY_VECTOR); }
287  {
288  this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);
289  }
290  void SetScaleModeToDataScalingOff() { this->SetScaleMode(VTK_DATA_SCALING_OFF); }
291  const char* GetScaleModeAsString();
293 
295 
298  vtkSetMacro(ColorMode, int);
299  vtkGetMacro(ColorMode, int);
300  void SetColorModeToColorByScale() { this->SetColorMode(VTK_COLOR_BY_SCALE); }
301  void SetColorModeToColorByScalar() { this->SetColorMode(VTK_COLOR_BY_SCALAR); }
302  void SetColorModeToColorByVector() { this->SetColorMode(VTK_COLOR_BY_VECTOR); }
303  const char* GetColorModeAsString();
305 
307 
310  vtkSetMacro(ScaleFactor, double);
311  vtkGetMacro(ScaleFactor, double);
313 
315 
318  vtkSetVector2Macro(Range, double);
319  vtkGetVectorMacro(Range, double, 2);
321 
323 
326  vtkSetMacro(Orient, vtkTypeBool);
327  vtkBooleanMacro(Orient, vtkTypeBool);
328  vtkGetMacro(Orient, vtkTypeBool);
330 
332 
336  vtkSetMacro(Clamping, vtkTypeBool);
337  vtkBooleanMacro(Clamping, vtkTypeBool);
338  vtkGetMacro(Clamping, vtkTypeBool);
340 
342 
345  vtkSetMacro(VectorMode, int);
346  vtkGetMacro(VectorMode, int);
347  void SetVectorModeToUseVector() { this->SetVectorMode(VTK_USE_VECTOR); }
348  void SetVectorModeToUseNormal() { this->SetVectorMode(VTK_USE_NORMAL); }
351  const char* GetVectorModeAsString();
353 
355 
359  vtkSetVectorMacro(FollowedCameraPosition, double, 3);
360  vtkGetVectorMacro(FollowedCameraPosition, double, 3);
362 
364 
367  vtkSetVectorMacro(FollowedCameraViewUp, double, 3);
368  vtkGetVectorMacro(FollowedCameraViewUp, double, 3);
370 
372 
379  vtkSetMacro(IndexMode, int);
380  vtkGetMacro(IndexMode, int);
381  void SetIndexModeToScalar() { this->SetIndexMode(VTK_INDEXING_BY_SCALAR); }
382  void SetIndexModeToVector() { this->SetIndexMode(VTK_INDEXING_BY_VECTOR); }
383  void SetIndexModeToOff() { this->SetIndexMode(VTK_INDEXING_OFF); }
384  const char* GetIndexModeAsString();
386 
388 
394  vtkSetMacro(GeneratePointIds, vtkTypeBool);
395  vtkGetMacro(GeneratePointIds, vtkTypeBool);
396  vtkBooleanMacro(GeneratePointIds, vtkTypeBool);
398 
400 
404  vtkSetStringMacro(PointIdsName);
405  vtkGetStringMacro(PointIdsName);
407 
409 
414  vtkSetMacro(FillCellData, vtkTypeBool);
415  vtkGetMacro(FillCellData, vtkTypeBool);
416  vtkBooleanMacro(FillCellData, vtkTypeBool);
418 
423  virtual int IsPointVisible(vtkDataSet*, vtkIdType) { return 1; }
424 
426 
432  vtkGetObjectMacro(SourceTransform, vtkTransform);
434 
438  vtkMTimeType GetMTime() override;
439 
441 
446  vtkSetMacro(OutputPointsPrecision, int);
447  vtkGetMacro(OutputPointsPrecision, int);
449 
450 protected:
452  ~vtkGlyph3D() override;
453 
457 
459 
461 
466  virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output);
467  virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output,
468  vtkDataArray* inSScalars, vtkDataArray* inVectors);
470 
471  vtkPolyData** Source; // Geometry to copy to each point
472  vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
473  int ScaleMode; // Scale by scalar value or vector magnitude
474  int ColorMode; // new scalars based on scale, scalar or vector
475  double ScaleFactor; // Scale factor to use to scale geometry
476  double Range[2]; // Range to use to perform scalar scaling
477  int Orient; // boolean controls whether to "orient" data
478  int VectorMode; // Orient/scale via normal or via vector data
479  double
480  FollowedCameraPosition[3]; // glyphs face towards this point in VTK_FOLLOW_CAMERA_DIRECTION mode
481  double FollowedCameraViewUp[3]; // glyph up direction in VTK_FOLLOW_CAMERA_DIRECTION mode
482  vtkTypeBool Clamping; // whether to clamp scale factor
483  int IndexMode; // what to use to index into glyph table
484  vtkTypeBool GeneratePointIds; // produce input points ids for each output point
485  vtkTypeBool FillCellData; // whether to fill output cell data
489 
490 private:
491  vtkGlyph3D(const vtkGlyph3D&) = delete;
492  void operator=(const vtkGlyph3D&) = delete;
493 };
494 
499 {
500  if (this->ScaleMode == VTK_SCALE_BY_SCALAR)
501  {
502  return "ScaleByScalar";
503  }
504  else if (this->ScaleMode == VTK_SCALE_BY_VECTOR)
505  {
506  return "ScaleByVector";
507  }
508  else
509  {
510  return "DataScalingOff";
511  }
512 }
513 
518 {
519  if (this->ColorMode == VTK_COLOR_BY_SCALAR)
520  {
521  return "ColorByScalar";
522  }
523  else if (this->ColorMode == VTK_COLOR_BY_VECTOR)
524  {
525  return "ColorByVector";
526  }
527  else
528  {
529  return "ColorByScale";
530  }
531 }
532 
537 {
538  if (this->VectorMode == VTK_USE_VECTOR)
539  {
540  return "UseVector";
541  }
542  else if (this->VectorMode == VTK_USE_NORMAL)
543  {
544  return "UseNormal";
545  }
546  else if (this->VectorMode == VTK_FOLLOW_CAMERA_DIRECTION)
547  {
548  return "FollowCameraDirection";
549  }
550  else
551  {
552  return "VectorRotationOff";
553  }
554 }
555 
560 {
561  if (this->IndexMode == VTK_INDEXING_OFF)
562  {
563  return "IndexingOff";
564  }
565  else if (this->IndexMode == VTK_INDEXING_BY_SCALAR)
566  {
567  return "IndexingByScalar";
568  }
569  else
570  {
571  return "IndexingByVector";
572  }
573 }
574 
575 #endif
Proxy object to connect input/output ports.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:165
abstract class to specify dataset behavior
Definition: vtkDataSet.h:172
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:222
void SetIndexModeToScalar()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:381
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:285
int OutputPointsPrecision
Definition: vtkGlyph3D.h:488
void SetVectorModeToUseNormal()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:348
const char * GetVectorModeAsString()
Return the vector mode as a character string.
Definition: vtkGlyph3D.h:536
void SetScaleModeToScaleByVectorComponents()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:286
int ScaleMode
Definition: vtkGlyph3D.h:473
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:383
void SetScaleModeToScaleByScalar()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:284
void SetColorModeToColorByScalar()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:301
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:474
const char * GetIndexModeAsString()
Return the index mode as a character string.
Definition: vtkGlyph3D.h:559
static vtkGlyph3D * New()
Construct object with scaling on, scaling mode is by scalar value, scale factor = 1....
vtkTypeBool Scaling
Definition: vtkGlyph3D.h:472
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:498
int VectorMode
Definition: vtkGlyph3D.h:478
void SetVectorModeToUseVector()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:347
void SetScaleModeToDataScalingOff()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:290
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:423
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
Definition: vtkGlyph3D.h:517
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:482
int IndexMode
Definition: vtkGlyph3D.h:483
void SetColorModeToColorByScale()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:300
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:302
vtkTypeBool FillCellData
Definition: vtkGlyph3D.h:485
vtkPolyData ** Source
Definition: vtkGlyph3D.h:471
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
Definition: vtkGlyph3D.h:258
~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:350
char * PointIdsName
Definition: vtkGlyph3D.h:486
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
double ScaleFactor
Definition: vtkGlyph3D.h:475
vtkTransform * SourceTransform
Definition: vtkGlyph3D.h:487
void SetIndexModeToVector()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:382
void SetSourceData(vtkPolyData *pd)
Set the source to use for the glyph.
Definition: vtkGlyph3D.h:241
void SetVectorModeToVectorRotationOff()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:349
vtkTypeBool GeneratePointIds
Definition: vtkGlyph3D.h:484
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:119
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:200
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:170
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:208
#define VTK_FOLLOW_CAMERA_DIRECTION
Definition: vtkGlyph3D.h:213
#define VTK_SCALE_BY_SCALAR
Definition: vtkGlyph3D.h:201
#define VTK_INDEXING_BY_SCALAR
Definition: vtkGlyph3D.h:216
#define VTK_DATA_SCALING_OFF
Definition: vtkGlyph3D.h:204
#define VTK_VECTOR_ROTATION_OFF
Definition: vtkGlyph3D.h:212
#define VTK_COLOR_BY_SCALAR
Definition: vtkGlyph3D.h:207
#define VTK_USE_VECTOR
Definition: vtkGlyph3D.h:210
#define VTK_USE_NORMAL
Definition: vtkGlyph3D.h:211
#define VTK_INDEXING_BY_VECTOR
Definition: vtkGlyph3D.h:217
#define VTK_SCALE_BY_VECTOR
Definition: vtkGlyph3D.h:202
#define VTK_INDEXING_OFF
Definition: vtkGlyph3D.h:215
#define VTK_COLOR_BY_SCALE
Definition: vtkGlyph3D.h:206
#define VTK_SCALE_BY_VECTORCOMPONENTS
Definition: vtkGlyph3D.h:203
int vtkIdType
Definition: vtkType.h:332
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287