VTK
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);
169  {this->SetScaleMode(VTK_SCALE_BY_SCALAR);};
171  {this->SetScaleMode(VTK_SCALE_BY_VECTOR);};
173  {this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);};
175  {this->SetScaleMode(VTK_DATA_SCALING_OFF);};
176  const char *GetScaleModeAsString();
178 
180 
183  vtkSetMacro(ColorMode,int);
184  vtkGetMacro(ColorMode,int);
186  {this->SetColorMode(VTK_COLOR_BY_SCALE);};
188  {this->SetColorMode(VTK_COLOR_BY_SCALAR);};
190  {this->SetColorMode(VTK_COLOR_BY_VECTOR);};
191  const char *GetColorModeAsString();
193 
195 
198  vtkSetMacro(ScaleFactor,double);
199  vtkGetMacro(ScaleFactor,double);
201 
203 
206  vtkSetVector2Macro(Range,double);
207  vtkGetVectorMacro(Range,double,2);
209 
211 
214  vtkSetMacro(Orient,vtkTypeBool);
215  vtkBooleanMacro(Orient,vtkTypeBool);
216  vtkGetMacro(Orient,vtkTypeBool);
218 
220 
224  vtkSetMacro(Clamping,vtkTypeBool);
225  vtkBooleanMacro(Clamping,vtkTypeBool);
226  vtkGetMacro(Clamping,vtkTypeBool);
228 
230 
233  vtkSetMacro(VectorMode,int);
234  vtkGetMacro(VectorMode,int);
235  void SetVectorModeToUseVector() {this->SetVectorMode(VTK_USE_VECTOR);};
236  void SetVectorModeToUseNormal() {this->SetVectorMode(VTK_USE_NORMAL);};
238  {this->SetVectorMode(VTK_VECTOR_ROTATION_OFF);};
239  const char *GetVectorModeAsString();
241 
243 
250  vtkSetMacro(IndexMode,int);
251  vtkGetMacro(IndexMode,int);
252  void SetIndexModeToScalar() {this->SetIndexMode(VTK_INDEXING_BY_SCALAR);};
253  void SetIndexModeToVector() {this->SetIndexMode(VTK_INDEXING_BY_VECTOR);};
254  void SetIndexModeToOff() {this->SetIndexMode(VTK_INDEXING_OFF);};
255  const char *GetIndexModeAsString();
257 
259 
265  vtkSetMacro(GeneratePointIds,vtkTypeBool);
266  vtkGetMacro(GeneratePointIds,vtkTypeBool);
267  vtkBooleanMacro(GeneratePointIds,vtkTypeBool);
269 
271 
275  vtkSetStringMacro(PointIdsName);
276  vtkGetStringMacro(PointIdsName);
278 
280 
285  vtkSetMacro(FillCellData,vtkTypeBool);
286  vtkGetMacro(FillCellData,vtkTypeBool);
287  vtkBooleanMacro(FillCellData,vtkTypeBool);
289 
294  virtual int IsPointVisible(vtkDataSet*, vtkIdType) {return 1;};
295 
297 
302  void SetSourceTransform(vtkTransform*);
303  vtkGetObjectMacro(SourceTransform, vtkTransform);
305 
309  vtkMTimeType GetMTime() override;
310 
312 
317  vtkSetMacro(OutputPointsPrecision,int);
318  vtkGetMacro(OutputPointsPrecision,int);
320 
321 protected:
322  vtkGlyph3D();
323  ~vtkGlyph3D() override;
324 
327  int FillInputPortInformation(int, vtkInformation *) override;
328 
329  vtkPolyData* GetSource(int idx, vtkInformationVector *sourceInfo);
330 
332 
337  virtual bool Execute(vtkDataSet* input,
338  vtkInformationVector* sourceVector,
339  vtkPolyData* output);
340  virtual bool Execute(vtkDataSet* input,
341  vtkInformationVector* sourceVector,
342  vtkPolyData* output,
343  vtkDataArray *inSScalars,
344  vtkDataArray *inVectors);
346 
347  vtkPolyData **Source; // Geometry to copy to each point
348  vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
349  vtkTypeBool ScaleMode; // Scale by scalar value or vector magnitude
350  int ColorMode; // new scalars based on scale, scalar or vector
351  double ScaleFactor; // Scale factor to use to scale geometry
352  double Range[2]; // Range to use to perform scalar scaling
353  int Orient; // boolean controls whether to "orient" data
354  int VectorMode; // Orient/scale via normal or via vector data
355  vtkTypeBool Clamping; // whether to clamp scale factor
356  int IndexMode; // what to use to index into glyph table
357  vtkTypeBool GeneratePointIds; // produce input points ids for each output point
358  vtkTypeBool FillCellData; // whether to fill output cell data
362 
363 private:
364  vtkGlyph3D(const vtkGlyph3D&) = delete;
365  void operator=(const vtkGlyph3D&) = delete;
366 };
367 
369 
372 inline const char *vtkGlyph3D::GetScaleModeAsString(void)
373 {
374  if ( this->ScaleMode == VTK_SCALE_BY_SCALAR )
375  {
376  return "ScaleByScalar";
377  }
378  else if ( this->ScaleMode == VTK_SCALE_BY_VECTOR )
379  {
380  return "ScaleByVector";
381  }
382  else
383  {
384  return "DataScalingOff";
385  }
386 }
388 
390 
393 inline const char *vtkGlyph3D::GetColorModeAsString(void)
394 {
395  if ( this->ColorMode == VTK_COLOR_BY_SCALAR )
396  {
397  return "ColorByScalar";
398  }
399  else if ( this->ColorMode == VTK_COLOR_BY_VECTOR )
400  {
401  return "ColorByVector";
402  }
403  else
404  {
405  return "ColorByScale";
406  }
407 }
409 
411 
414 inline const char *vtkGlyph3D::GetVectorModeAsString(void)
415 {
416  if ( this->VectorMode == VTK_USE_VECTOR)
417  {
418  return "UseVector";
419  }
420  else if ( this->VectorMode == VTK_USE_NORMAL)
421  {
422  return "UseNormal";
423  }
424  else
425  {
426  return "VectorRotationOff";
427  }
428 }
430 
432 
435 inline const char *vtkGlyph3D::GetIndexModeAsString(void)
436 {
437  if ( this->IndexMode == VTK_INDEXING_OFF)
438  {
439  return "IndexingOff";
440  }
441  else if ( this->IndexMode == VTK_INDEXING_BY_SCALAR)
442  {
443  return "IndexingByScalar";
444  }
445  else
446  {
447  return "IndexingByVector";
448  }
449 }
451 
452 #endif
vtkGlyph3D::SetIndexModeToOff
void SetIndexModeToOff()
Definition: vtkGlyph3D.h:254
vtkGlyph3D::GetColorModeAsString
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
Definition: vtkGlyph3D.h:393
vtkGlyph3D::IsPointVisible
virtual int IsPointVisible(vtkDataSet *, vtkIdType)
This can be overwritten by subclass to return 0 when a point is blanked.
Definition: vtkGlyph3D.h:294
vtkGlyph3D::SetScaleModeToScaleByVectorComponents
void SetScaleModeToScaleByVectorComponents()
Definition: vtkGlyph3D.h:172
VTK_VECTOR_ROTATION_OFF
#define VTK_VECTOR_ROTATION_OFF
Definition: vtkGlyph3D.h:97
vtkGlyph3D::ScaleFactor
double ScaleFactor
Definition: vtkGlyph3D.h:351
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkGlyph3D::SetSourceConnection
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Definition: vtkGlyph3D.h:142
vtkGlyph3D::SourceTransform
vtkTransform * SourceTransform
Definition: vtkGlyph3D.h:360
vtkGlyph3D::Orient
int Orient
Definition: vtkGlyph3D.h:353
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:435
vtkGlyph3D::SetIndexModeToScalar
void SetIndexModeToScalar()
Definition: vtkGlyph3D.h:252
vtkGlyph3D::PointIdsName
char * PointIdsName
Definition: vtkGlyph3D.h:359
vtkGlyph3D::GetVectorModeAsString
const char * GetVectorModeAsString()
Return the vector mode as a character string.
Definition: vtkGlyph3D.h:414
VTK_SCALE_BY_SCALAR
#define VTK_SCALE_BY_SCALAR
Definition: vtkGlyph3D.h:86
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
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:189
vtkGlyph3D::ColorMode
int ColorMode
Definition: vtkGlyph3D.h:350
vtkGlyph3D::SetScaleModeToDataScalingOff
void SetScaleModeToDataScalingOff()
Definition: vtkGlyph3D.h:174
vtkGlyph3D::SetIndexModeToVector
void SetIndexModeToVector()
Definition: vtkGlyph3D.h:253
vtkGlyph3D::FillCellData
vtkTypeBool FillCellData
Definition: vtkGlyph3D.h:358
VTK_INDEXING_BY_VECTOR
#define VTK_INDEXING_BY_VECTOR
Definition: vtkGlyph3D.h:101
vtkPolyDataAlgorithm.h
vtkGlyph3D::Source
vtkPolyData ** Source
Definition: vtkGlyph3D.h:347
VTK_COLOR_BY_SCALAR
#define VTK_COLOR_BY_SCALAR
Definition: vtkGlyph3D.h:92
vtkGlyph3D::OutputPointsPrecision
int OutputPointsPrecision
Definition: vtkGlyph3D.h:361
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:356
vtkGlyph3D::SetColorModeToColorByScalar
void SetColorModeToColorByScalar()
Definition: vtkGlyph3D.h:187
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkGlyph3D::SetVectorModeToUseNormal
void SetVectorModeToUseNormal()
Definition: vtkGlyph3D.h:236
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:372
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:105
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:80
VTK_COLOR_BY_VECTOR
#define VTK_COLOR_BY_VECTOR
Definition: vtkGlyph3D.h:93
vtkGlyph3D::Scaling
vtkTypeBool Scaling
Definition: vtkGlyph3D.h:348
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:355
vtkGlyph3D::SetVectorModeToVectorRotationOff
void SetVectorModeToVectorRotationOff()
Definition: vtkGlyph3D.h:237
vtkGlyph3D::SetVectorModeToUseVector
void SetVectorModeToUseVector()
Definition: vtkGlyph3D.h:235
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:125
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
vtkGlyph3D::SetScaleModeToScaleByScalar
void SetScaleModeToScaleByScalar()
Definition: vtkGlyph3D.h:168
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:357
VTK_INDEXING_BY_SCALAR
#define VTK_INDEXING_BY_SCALAR
Definition: vtkGlyph3D.h:100
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkPolyDataAlgorithm::New
static vtkPolyDataAlgorithm * New()
vtkGlyph3D::ScaleMode
vtkTypeBool ScaleMode
Definition: vtkGlyph3D.h:349
VTK_DATA_SCALING_OFF
#define VTK_DATA_SCALING_OFF
Definition: vtkGlyph3D.h:89
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
vtkGlyph3D::VectorMode
int VectorMode
Definition: vtkGlyph3D.h:354
VTK_INDEXING_OFF
#define VTK_INDEXING_OFF
Definition: vtkGlyph3D.h:99
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:41