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 =========================================================================*/
86 #ifndef vtkGlyph3D_h
87 #define vtkGlyph3D_h
88 
89 #include "vtkFiltersCoreModule.h" // For export macro
90 #include "vtkPolyDataAlgorithm.h"
91 
92 #define VTK_SCALE_BY_SCALAR 0
93 #define VTK_SCALE_BY_VECTOR 1
94 #define VTK_SCALE_BY_VECTORCOMPONENTS 2
95 #define VTK_DATA_SCALING_OFF 3
96 
97 #define VTK_COLOR_BY_SCALE 0
98 #define VTK_COLOR_BY_SCALAR 1
99 #define VTK_COLOR_BY_VECTOR 2
100 
101 #define VTK_USE_VECTOR 0
102 #define VTK_USE_NORMAL 1
103 #define VTK_VECTOR_ROTATION_OFF 2
104 
105 #define VTK_INDEXING_OFF 0
106 #define VTK_INDEXING_BY_SCALAR 1
107 #define VTK_INDEXING_BY_VECTOR 2
108 
109 class vtkTransform;
110 
111 class VTKFILTERSCORE_EXPORT vtkGlyph3D : public vtkPolyDataAlgorithm
112 {
113 public:
115  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
116 
123  static vtkGlyph3D *New();
124 
131  void SetSourceData(vtkPolyData *pd) {this->SetSourceData(0,pd);};
132 
139  void SetSourceData(int id, vtkPolyData *pd);
140 
142 
147  void SetSourceConnection(int id, vtkAlgorithmOutput* algOutput);
149  {
150  this->SetSourceConnection(0, algOutput);
151  }
153 
157  vtkPolyData *GetSource(int id=0);
158 
160 
163  vtkSetMacro(Scaling,int);
164  vtkBooleanMacro(Scaling,int);
165  vtkGetMacro(Scaling,int);
167 
169 
172  vtkSetMacro(ScaleMode,int);
173  vtkGetMacro(ScaleMode,int);
175  {this->SetScaleMode(VTK_SCALE_BY_SCALAR);};
177  {this->SetScaleMode(VTK_SCALE_BY_VECTOR);};
179  {this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);};
181  {this->SetScaleMode(VTK_DATA_SCALING_OFF);};
182  const char *GetScaleModeAsString();
184 
186 
189  vtkSetMacro(ColorMode,int);
190  vtkGetMacro(ColorMode,int);
192  {this->SetColorMode(VTK_COLOR_BY_SCALE);};
194  {this->SetColorMode(VTK_COLOR_BY_SCALAR);};
196  {this->SetColorMode(VTK_COLOR_BY_VECTOR);};
197  const char *GetColorModeAsString();
199 
201 
204  vtkSetMacro(ScaleFactor,double);
205  vtkGetMacro(ScaleFactor,double);
207 
209 
212  vtkSetVector2Macro(Range,double);
213  vtkGetVectorMacro(Range,double,2);
215 
217 
220  vtkSetMacro(Orient,int);
221  vtkBooleanMacro(Orient,int);
222  vtkGetMacro(Orient,int);
224 
226 
230  vtkSetMacro(Clamping,int);
231  vtkBooleanMacro(Clamping,int);
232  vtkGetMacro(Clamping,int);
234 
236 
239  vtkSetMacro(VectorMode,int);
240  vtkGetMacro(VectorMode,int);
241  void SetVectorModeToUseVector() {this->SetVectorMode(VTK_USE_VECTOR);};
242  void SetVectorModeToUseNormal() {this->SetVectorMode(VTK_USE_NORMAL);};
244  {this->SetVectorMode(VTK_VECTOR_ROTATION_OFF);};
245  const char *GetVectorModeAsString();
247 
249 
256  vtkSetMacro(IndexMode,int);
257  vtkGetMacro(IndexMode,int);
258  void SetIndexModeToScalar() {this->SetIndexMode(VTK_INDEXING_BY_SCALAR);};
259  void SetIndexModeToVector() {this->SetIndexMode(VTK_INDEXING_BY_VECTOR);};
260  void SetIndexModeToOff() {this->SetIndexMode(VTK_INDEXING_OFF);};
261  const char *GetIndexModeAsString();
263 
265 
271  vtkSetMacro(GeneratePointIds,int);
272  vtkGetMacro(GeneratePointIds,int);
273  vtkBooleanMacro(GeneratePointIds,int);
275 
277 
281  vtkSetStringMacro(PointIdsName);
282  vtkGetStringMacro(PointIdsName);
284 
286 
291  vtkSetMacro(FillCellData,int);
292  vtkGetMacro(FillCellData,int);
293  vtkBooleanMacro(FillCellData,int);
295 
300  virtual int IsPointVisible(vtkDataSet*, vtkIdType) {return 1;};
301 
303 
308  void SetSourceTransform(vtkTransform*);
309  vtkGetObjectMacro(SourceTransform, vtkTransform);
311 
315  vtkMTimeType GetMTime() VTK_OVERRIDE;
316 
317 protected:
318  vtkGlyph3D();
319  ~vtkGlyph3D() VTK_OVERRIDE;
320 
323  int FillInputPortInformation(int, vtkInformation *) VTK_OVERRIDE;
324 
325  vtkPolyData* GetSource(int idx, vtkInformationVector *sourceInfo);
326 
328 
333  virtual bool Execute(vtkDataSet* input,
334  vtkInformationVector* sourceVector,
335  vtkPolyData* output);
336  virtual bool Execute(vtkDataSet* input,
337  vtkInformationVector* sourceVector,
338  vtkPolyData* output,
339  vtkDataArray *inSScalars,
340  vtkDataArray *inVectors);
342 
343  vtkPolyData **Source; // Geometry to copy to each point
344  int Scaling; // Determine whether scaling of geometry is performed
345  int ScaleMode; // Scale by scalar value or vector magnitude
346  int ColorMode; // new scalars based on scale, scalar or vector
347  double ScaleFactor; // Scale factor to use to scale geometry
348  double Range[2]; // Range to use to perform scalar scaling
349  int Orient; // boolean controls whether to "orient" data
350  int VectorMode; // Orient/scale via normal or via vector data
351  int Clamping; // whether to clamp scale factor
352  int IndexMode; // what to use to index into glyph table
353  int GeneratePointIds; // produce input points ids for each output point
354  int FillCellData; // whether to fill output cell data
357 
358 private:
359  vtkGlyph3D(const vtkGlyph3D&) VTK_DELETE_FUNCTION;
360  void operator=(const vtkGlyph3D&) VTK_DELETE_FUNCTION;
361 };
362 
364 
367 inline const char *vtkGlyph3D::GetScaleModeAsString(void)
368 {
369  if ( this->ScaleMode == VTK_SCALE_BY_SCALAR )
370  {
371  return "ScaleByScalar";
372  }
373  else if ( this->ScaleMode == VTK_SCALE_BY_VECTOR )
374  {
375  return "ScaleByVector";
376  }
377  else
378  {
379  return "DataScalingOff";
380  }
381 }
383 
385 
388 inline const char *vtkGlyph3D::GetColorModeAsString(void)
389 {
390  if ( this->ColorMode == VTK_COLOR_BY_SCALAR )
391  {
392  return "ColorByScalar";
393  }
394  else if ( this->ColorMode == VTK_COLOR_BY_VECTOR )
395  {
396  return "ColorByVector";
397  }
398  else
399  {
400  return "ColorByScale";
401  }
402 }
404 
406 
409 inline const char *vtkGlyph3D::GetVectorModeAsString(void)
410 {
411  if ( this->VectorMode == VTK_USE_VECTOR)
412  {
413  return "UseVector";
414  }
415  else if ( this->VectorMode == VTK_USE_NORMAL)
416  {
417  return "UseNormal";
418  }
419  else
420  {
421  return "VectorRotationOff";
422  }
423 }
425 
427 
430 inline const char *vtkGlyph3D::GetIndexModeAsString(void)
431 {
432  if ( this->IndexMode == VTK_INDEXING_OFF)
433  {
434  return "IndexingOff";
435  }
436  else if ( this->IndexMode == VTK_INDEXING_BY_SCALAR)
437  {
438  return "IndexingByScalar";
439  }
440  else
441  {
442  return "IndexingByVector";
443  }
444 }
446 
447 #endif
void SetScaleModeToScaleByVectorComponents()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:178
#define VTK_USE_NORMAL
Definition: vtkGlyph3D.h:102
const char * GetIndexModeAsString()
Return the index mode as a character string.
Definition: vtkGlyph3D.h:430
void SetSourceData(vtkPolyData *pd)
Set the source to use for the glyph.
Definition: vtkGlyph3D.h:131
void SetScaleModeToScaleByVector()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:176
void SetColorModeToColorByScale()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:191
void SetIndexModeToVector()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:259
vtkTransform * SourceTransform
Definition: vtkGlyph3D.h:356
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
#define VTK_SCALE_BY_VECTORCOMPONENTS
Definition: vtkGlyph3D.h:94
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
void SetScaleModeToScaleByScalar()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:174
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
int ScaleMode
Definition: vtkGlyph3D.h:345
int Clamping
Definition: vtkGlyph3D.h:351
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
Definition: vtkGlyph3D.h:388
#define VTK_COLOR_BY_VECTOR
Definition: vtkGlyph3D.h:99
#define VTK_SCALE_BY_SCALAR
Definition: vtkGlyph3D.h:92
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
int vtkIdType
Definition: vtkType.h:345
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
#define VTK_SCALE_BY_VECTOR
Definition: vtkGlyph3D.h:93
char * PointIdsName
Definition: vtkGlyph3D.h:355
#define VTK_USE_VECTOR
Definition: vtkGlyph3D.h:101
void SetColorModeToColorByVector()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:195
Proxy object to connect input/output ports.
#define VTK_COLOR_BY_SCALAR
Definition: vtkGlyph3D.h:98
#define VTK_DATA_SCALING_OFF
Definition: vtkGlyph3D.h:95
static vtkPolyDataAlgorithm * New()
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Superclass for algorithms that produce only polydata as output.
#define VTK_INDEXING_BY_SCALAR
Definition: vtkGlyph3D.h:106
void SetIndexModeToScalar()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:258
a simple class to control print indentation
Definition: vtkIndent.h:39
#define VTK_INDEXING_OFF
Definition: vtkGlyph3D.h:105
void SetColorModeToColorByScalar()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:193
void SetVectorModeToUseNormal()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:242
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:111
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
virtual vtkMTimeType GetMTime()
Return this object's modified time.
void SetVectorModeToVectorRotationOff()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:243
void SetScaleModeToDataScalingOff()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:180
#define VTK_VECTOR_ROTATION_OFF
Definition: vtkGlyph3D.h:103
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
const char * GetVectorModeAsString()
Return the vector mode as a character string.
Definition: vtkGlyph3D.h:409
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
virtual int IsPointVisible(vtkDataSet *, vtkIdType)
This can be overwritten by subclass to return 0 when a point is blanked.
Definition: vtkGlyph3D.h:300
int IndexMode
Definition: vtkGlyph3D.h:352
int GeneratePointIds
Definition: vtkGlyph3D.h:353
int ColorMode
Definition: vtkGlyph3D.h:346
void SetIndexModeToOff()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:260
int FillCellData
Definition: vtkGlyph3D.h:354
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
Store zero or more vtkInformation instances.
vtkPolyData ** Source
Definition: vtkGlyph3D.h:343
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
#define VTK_COLOR_BY_SCALE
Definition: vtkGlyph3D.h:97
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
Definition: vtkGlyph3D.h:148
int VectorMode
Definition: vtkGlyph3D.h:350
#define VTK_INDEXING_BY_VECTOR
Definition: vtkGlyph3D.h:107
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
double ScaleFactor
Definition: vtkGlyph3D.h:347
void SetVectorModeToUseVector()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:241