VTK  9.0.1
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 
243  vtkSetVectorMacro(FollowedCameraPosition, double, 3);
244  vtkGetVectorMacro(FollowedCameraPosition, double, 3);
246 
250  vtkSetVectorMacro(FollowedCameraViewUp, double, 3);
251  vtkGetVectorMacro(FollowedCameraViewUp, double, 3);
253 
255 
262  vtkSetMacro(IndexMode, int);
263  vtkGetMacro(IndexMode, int);
264  void SetIndexModeToScalar() { this->SetIndexMode(VTK_INDEXING_BY_SCALAR); }
265  void SetIndexModeToVector() { this->SetIndexMode(VTK_INDEXING_BY_VECTOR); }
266  void SetIndexModeToOff() { this->SetIndexMode(VTK_INDEXING_OFF); }
267  const char* GetIndexModeAsString();
269 
271 
277  vtkSetMacro(GeneratePointIds, vtkTypeBool);
278  vtkGetMacro(GeneratePointIds, vtkTypeBool);
279  vtkBooleanMacro(GeneratePointIds, vtkTypeBool);
281 
283 
287  vtkSetStringMacro(PointIdsName);
288  vtkGetStringMacro(PointIdsName);
290 
292 
297  vtkSetMacro(FillCellData, vtkTypeBool);
298  vtkGetMacro(FillCellData, vtkTypeBool);
299  vtkBooleanMacro(FillCellData, vtkTypeBool);
301 
306  virtual int IsPointVisible(vtkDataSet*, vtkIdType) { return 1; }
307 
309 
314  void SetSourceTransform(vtkTransform*);
315  vtkGetObjectMacro(SourceTransform, vtkTransform);
317 
321  vtkMTimeType GetMTime() override;
322 
324 
329  vtkSetMacro(OutputPointsPrecision, int);
330  vtkGetMacro(OutputPointsPrecision, int);
332 
333 protected:
334  vtkGlyph3D();
335  ~vtkGlyph3D() override;
336 
339  int FillInputPortInformation(int, vtkInformation*) override;
340 
341  vtkPolyData* GetSource(int idx, vtkInformationVector* sourceInfo);
342 
344 
349  virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output);
350  virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output,
351  vtkDataArray* inSScalars, vtkDataArray* inVectors);
353 
354  vtkPolyData** Source; // Geometry to copy to each point
355  vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
356  int ScaleMode; // Scale by scalar value or vector magnitude
357  int ColorMode; // new scalars based on scale, scalar or vector
358  double ScaleFactor; // Scale factor to use to scale geometry
359  double Range[2]; // Range to use to perform scalar scaling
360  int Orient; // boolean controls whether to "orient" data
361  int VectorMode; // Orient/scale via normal or via vector data
362  double
363  FollowedCameraPosition[3]; // glyphs face towards this point in VTK_FOLLOW_CAMERA_DIRECTION mode
364  double FollowedCameraViewUp[3]; // glyph up direction in VTK_FOLLOW_CAMERA_DIRECTION mode
365  vtkTypeBool Clamping; // whether to clamp scale factor
366  int IndexMode; // what to use to index into glyph table
367  vtkTypeBool GeneratePointIds; // produce input points ids for each output point
368  vtkTypeBool FillCellData; // whether to fill output cell data
372 
373 private:
374  vtkGlyph3D(const vtkGlyph3D&) = delete;
375  void operator=(const vtkGlyph3D&) = delete;
376 };
377 
379 
382 inline const char* vtkGlyph3D::GetScaleModeAsString(void)
383 {
384  if (this->ScaleMode == VTK_SCALE_BY_SCALAR)
385  {
386  return "ScaleByScalar";
387  }
388  else if (this->ScaleMode == VTK_SCALE_BY_VECTOR)
389  {
390  return "ScaleByVector";
391  }
392  else
393  {
394  return "DataScalingOff";
395  }
396 }
398 
400 
403 inline const char* vtkGlyph3D::GetColorModeAsString(void)
404 {
405  if (this->ColorMode == VTK_COLOR_BY_SCALAR)
406  {
407  return "ColorByScalar";
408  }
409  else if (this->ColorMode == VTK_COLOR_BY_VECTOR)
410  {
411  return "ColorByVector";
412  }
413  else
414  {
415  return "ColorByScale";
416  }
417 }
419 
421 
424 inline const char* vtkGlyph3D::GetVectorModeAsString(void)
425 {
426  if (this->VectorMode == VTK_USE_VECTOR)
427  {
428  return "UseVector";
429  }
430  else if (this->VectorMode == VTK_USE_NORMAL)
431  {
432  return "UseNormal";
433  }
434  else if (this->VectorMode == VTK_FOLLOW_CAMERA_DIRECTION)
435  {
436  return "FollowCameraDirection";
437  }
438  else
439  {
440  return "VectorRotationOff";
441  }
442 }
444 
446 
449 inline const char* vtkGlyph3D::GetIndexModeAsString(void)
450 {
451  if (this->IndexMode == VTK_INDEXING_OFF)
452  {
453  return "IndexingOff";
454  }
455  else if (this->IndexMode == VTK_INDEXING_BY_SCALAR)
456  {
457  return "IndexingByScalar";
458  }
459  else
460  {
461  return "IndexingByVector";
462  }
463 }
465 
466 #endif
vtk::Range
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
vtkGlyph3D::SetIndexModeToOff
void SetIndexModeToOff()
Definition: vtkGlyph3D.h:266
vtkGlyph3D::GetColorModeAsString
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
Definition: vtkGlyph3D.h:403
vtkGlyph3D::IsPointVisible
virtual int IsPointVisible(vtkDataSet *, vtkIdType)
This can be overwritten by subclass to return 0 when a point is blanked.
Definition: vtkGlyph3D.h:306
vtkGlyph3D::SetScaleModeToScaleByVectorComponents
void SetScaleModeToScaleByVectorComponents()
Definition: vtkGlyph3D.h:171
VTK_VECTOR_ROTATION_OFF
#define VTK_VECTOR_ROTATION_OFF
Definition: vtkGlyph3D.h:97
vtkGlyph3D::ScaleFactor
double ScaleFactor
Definition: vtkGlyph3D.h:358
VTK_FOLLOW_CAMERA_DIRECTION
#define VTK_FOLLOW_CAMERA_DIRECTION
Definition: vtkGlyph3D.h:98
vtkGlyph3D::SetVectorModeToFollowCameraDirection
void SetVectorModeToFollowCameraDirection()
Definition: vtkGlyph3D.h:235
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkGlyph3D::SetSourceConnection
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Definition: vtkGlyph3D.h:143
vtkGlyph3D::SourceTransform
vtkTransform * SourceTransform
Definition: vtkGlyph3D.h:370
vtkGlyph3D::Orient
int Orient
Definition: vtkGlyph3D.h:360
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkPolyDataAlgorithm::RequestUpdateExtent
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
vtkGlyph3D::GetIndexModeAsString
const char * GetIndexModeAsString()
Return the index mode as a character string.
Definition: vtkGlyph3D.h:449
vtkGlyph3D::SetIndexModeToScalar
void SetIndexModeToScalar()
Definition: vtkGlyph3D.h:264
vtkGlyph3D::PointIdsName
char * PointIdsName
Definition: vtkGlyph3D.h:369
vtkGlyph3D::GetVectorModeAsString
const char * GetVectorModeAsString()
Return the vector mode as a character string.
Definition: vtkGlyph3D.h:424
VTK_SCALE_BY_SCALAR
#define VTK_SCALE_BY_SCALAR
Definition: vtkGlyph3D.h:86
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
VTK_SCALE_BY_VECTOR
#define VTK_SCALE_BY_VECTOR
Definition: vtkGlyph3D.h:87
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
vtkPolyDataAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkGlyph3D::SetColorModeToColorByVector
void SetColorModeToColorByVector()
Definition: vtkGlyph3D.h:187
vtkGlyph3D::ColorMode
int ColorMode
Definition: vtkGlyph3D.h:357
vtkGlyph3D::SetScaleModeToDataScalingOff
void SetScaleModeToDataScalingOff()
Definition: vtkGlyph3D.h:175
vtkGlyph3D::SetIndexModeToVector
void SetIndexModeToVector()
Definition: vtkGlyph3D.h:265
vtkGlyph3D::FillCellData
vtkTypeBool FillCellData
Definition: vtkGlyph3D.h:368
VTK_INDEXING_BY_VECTOR
#define VTK_INDEXING_BY_VECTOR
Definition: vtkGlyph3D.h:102
vtkPolyDataAlgorithm.h
vtkGlyph3D::Source
vtkPolyData ** Source
Definition: vtkGlyph3D.h:354
VTK_COLOR_BY_SCALAR
#define VTK_COLOR_BY_SCALAR
Definition: vtkGlyph3D.h:92
vtkGlyph3D::OutputPointsPrecision
int OutputPointsPrecision
Definition: vtkGlyph3D.h:371
vtkPolyDataAlgorithm::RequestData
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkObject::GetMTime
virtual vtkMTimeType GetMTime()
Return this object's modified time.
vtkGlyph3D::IndexMode
int IndexMode
Definition: vtkGlyph3D.h:366
vtkGlyph3D::SetColorModeToColorByScalar
void SetColorModeToColorByScalar()
Definition: vtkGlyph3D.h:186
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkGlyph3D::SetVectorModeToUseNormal
void SetVectorModeToUseNormal()
Definition: vtkGlyph3D.h:233
vtkGlyph3D::SetScaleModeToScaleByVector
void SetScaleModeToScaleByVector()
Definition: vtkGlyph3D.h:170
vtkPolyDataAlgorithm::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkGlyph3D::GetScaleModeAsString
const char * GetScaleModeAsString()
Return the method of scaling as a descriptive character string.
Definition: vtkGlyph3D.h:382
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkGlyph3D
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:106
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
VTK_COLOR_BY_VECTOR
#define VTK_COLOR_BY_VECTOR
Definition: vtkGlyph3D.h:93
vtkGlyph3D::Scaling
vtkTypeBool Scaling
Definition: vtkGlyph3D.h:355
VTK_COLOR_BY_SCALE
#define VTK_COLOR_BY_SCALE
Definition: vtkGlyph3D.h:91
vtkGlyph3D::SetColorModeToColorByScale
void SetColorModeToColorByScale()
Definition: vtkGlyph3D.h:185
VTK_SCALE_BY_VECTORCOMPONENTS
#define VTK_SCALE_BY_VECTORCOMPONENTS
Definition: vtkGlyph3D.h:88
vtkGlyph3D::Clamping
vtkTypeBool Clamping
Definition: vtkGlyph3D.h:365
vtkGlyph3D::SetVectorModeToVectorRotationOff
void SetVectorModeToVectorRotationOff()
Definition: vtkGlyph3D.h:234
vtkGlyph3D::SetVectorModeToUseVector
void SetVectorModeToUseVector()
Definition: vtkGlyph3D.h:232
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:36
vtkGlyph3D::SetSourceData
void SetSourceData(vtkPolyData *pd)
Set the source to use for the glyph.
Definition: vtkGlyph3D.h:126
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
vtkGlyph3D::SetScaleModeToScaleByScalar
void SetScaleModeToScaleByScalar()
Definition: vtkGlyph3D.h:169
VTK_USE_NORMAL
#define VTK_USE_NORMAL
Definition: vtkGlyph3D.h:96
VTK_USE_VECTOR
#define VTK_USE_VECTOR
Definition: vtkGlyph3D.h:95
vtkGlyph3D::GeneratePointIds
vtkTypeBool GeneratePointIds
Definition: vtkGlyph3D.h:367
VTK_INDEXING_BY_SCALAR
#define VTK_INDEXING_BY_SCALAR
Definition: vtkGlyph3D.h:101
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkPolyDataAlgorithm::New
static vtkPolyDataAlgorithm * New()
VTK_DATA_SCALING_OFF
#define VTK_DATA_SCALING_OFF
Definition: vtkGlyph3D.h:89
vtkGlyph3D::ScaleMode
int ScaleMode
Definition: vtkGlyph3D.h:356
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293
vtkGlyph3D::VectorMode
int VectorMode
Definition: vtkGlyph3D.h:361
VTK_INDEXING_OFF
#define VTK_INDEXING_OFF
Definition: vtkGlyph3D.h:100
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:41