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) VTK_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,int);
158  vtkBooleanMacro(Scaling,int);
159  vtkGetMacro(Scaling,int);
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,int);
215  vtkBooleanMacro(Orient,int);
216  vtkGetMacro(Orient,int);
218 
220 
224  vtkSetMacro(Clamping,int);
225  vtkBooleanMacro(Clamping,int);
226  vtkGetMacro(Clamping,int);
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,int);
266  vtkGetMacro(GeneratePointIds,int);
267  vtkBooleanMacro(GeneratePointIds,int);
269 
271 
275  vtkSetStringMacro(PointIdsName);
276  vtkGetStringMacro(PointIdsName);
278 
280 
285  vtkSetMacro(FillCellData,int);
286  vtkGetMacro(FillCellData,int);
287  vtkBooleanMacro(FillCellData,int);
289 
294  virtual int IsPointVisible(vtkDataSet*, vtkIdType) {return 1;};
295 
297 
302  void SetSourceTransform(vtkTransform*);
303  vtkGetObjectMacro(SourceTransform, vtkTransform);
305 
309  vtkMTimeType GetMTime() VTK_OVERRIDE;
310 
311 protected:
312  vtkGlyph3D();
313  ~vtkGlyph3D() VTK_OVERRIDE;
314 
317  int FillInputPortInformation(int, vtkInformation *) VTK_OVERRIDE;
318 
319  vtkPolyData* GetSource(int idx, vtkInformationVector *sourceInfo);
320 
322 
327  virtual bool Execute(vtkDataSet* input,
328  vtkInformationVector* sourceVector,
329  vtkPolyData* output);
330  virtual bool Execute(vtkDataSet* input,
331  vtkInformationVector* sourceVector,
332  vtkPolyData* output,
333  vtkDataArray *inSScalars,
334  vtkDataArray *inVectors);
336 
337  vtkPolyData **Source; // Geometry to copy to each point
338  int Scaling; // Determine whether scaling of geometry is performed
339  int ScaleMode; // Scale by scalar value or vector magnitude
340  int ColorMode; // new scalars based on scale, scalar or vector
341  double ScaleFactor; // Scale factor to use to scale geometry
342  double Range[2]; // Range to use to perform scalar scaling
343  int Orient; // boolean controls whether to "orient" data
344  int VectorMode; // Orient/scale via normal or via vector data
345  int Clamping; // whether to clamp scale factor
346  int IndexMode; // what to use to index into glyph table
347  int GeneratePointIds; // produce input points ids for each output point
348  int FillCellData; // whether to fill output cell data
351 
352 private:
353  vtkGlyph3D(const vtkGlyph3D&) VTK_DELETE_FUNCTION;
354  void operator=(const vtkGlyph3D&) VTK_DELETE_FUNCTION;
355 };
356 
358 
361 inline const char *vtkGlyph3D::GetScaleModeAsString(void)
362 {
363  if ( this->ScaleMode == VTK_SCALE_BY_SCALAR )
364  {
365  return "ScaleByScalar";
366  }
367  else if ( this->ScaleMode == VTK_SCALE_BY_VECTOR )
368  {
369  return "ScaleByVector";
370  }
371  else
372  {
373  return "DataScalingOff";
374  }
375 }
377 
379 
382 inline const char *vtkGlyph3D::GetColorModeAsString(void)
383 {
384  if ( this->ColorMode == VTK_COLOR_BY_SCALAR )
385  {
386  return "ColorByScalar";
387  }
388  else if ( this->ColorMode == VTK_COLOR_BY_VECTOR )
389  {
390  return "ColorByVector";
391  }
392  else
393  {
394  return "ColorByScale";
395  }
396 }
398 
400 
403 inline const char *vtkGlyph3D::GetVectorModeAsString(void)
404 {
405  if ( this->VectorMode == VTK_USE_VECTOR)
406  {
407  return "UseVector";
408  }
409  else if ( this->VectorMode == VTK_USE_NORMAL)
410  {
411  return "UseNormal";
412  }
413  else
414  {
415  return "VectorRotationOff";
416  }
417 }
419 
421 
424 inline const char *vtkGlyph3D::GetIndexModeAsString(void)
425 {
426  if ( this->IndexMode == VTK_INDEXING_OFF)
427  {
428  return "IndexingOff";
429  }
430  else if ( this->IndexMode == VTK_INDEXING_BY_SCALAR)
431  {
432  return "IndexingByScalar";
433  }
434  else
435  {
436  return "IndexingByVector";
437  }
438 }
440 
441 #endif
void SetScaleModeToScaleByVectorComponents()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:172
#define VTK_USE_NORMAL
Definition: vtkGlyph3D.h:96
const char * GetIndexModeAsString()
Return the index mode as a character string.
Definition: vtkGlyph3D.h:424
void SetSourceData(vtkPolyData *pd)
Set the source to use for the glyph.
Definition: vtkGlyph3D.h:125
void SetScaleModeToScaleByVector()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:170
void SetColorModeToColorByScale()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:185
void SetIndexModeToVector()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:253
vtkTransform * SourceTransform
Definition: vtkGlyph3D.h:350
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
#define VTK_SCALE_BY_VECTORCOMPONENTS
Definition: vtkGlyph3D.h:88
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
void SetScaleModeToScaleByScalar()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:168
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
int ScaleMode
Definition: vtkGlyph3D.h:339
int Clamping
Definition: vtkGlyph3D.h:345
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
Definition: vtkGlyph3D.h:382
#define VTK_COLOR_BY_VECTOR
Definition: vtkGlyph3D.h:93
#define VTK_SCALE_BY_SCALAR
Definition: vtkGlyph3D.h:86
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
int vtkIdType
Definition: vtkType.h:345
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
#define VTK_SCALE_BY_VECTOR
Definition: vtkGlyph3D.h:87
char * PointIdsName
Definition: vtkGlyph3D.h:349
#define VTK_USE_VECTOR
Definition: vtkGlyph3D.h:95
void SetColorModeToColorByVector()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:189
Proxy object to connect input/output ports.
#define VTK_COLOR_BY_SCALAR
Definition: vtkGlyph3D.h:92
#define VTK_DATA_SCALING_OFF
Definition: vtkGlyph3D.h:89
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:100
void SetIndexModeToScalar()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:252
a simple class to control print indentation
Definition: vtkIndent.h:33
#define VTK_INDEXING_OFF
Definition: vtkGlyph3D.h:99
void SetColorModeToColorByScalar()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:187
void SetVectorModeToUseNormal()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:236
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:105
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
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:237
void SetScaleModeToDataScalingOff()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:174
#define VTK_VECTOR_ROTATION_OFF
Definition: vtkGlyph3D.h:97
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
const char * GetVectorModeAsString()
Return the vector mode as a character string.
Definition: vtkGlyph3D.h:403
const char * GetScaleModeAsString()
Return the method of scaling as a descriptive character string.
Definition: vtkGlyph3D.h:361
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:294
int IndexMode
Definition: vtkGlyph3D.h:346
int GeneratePointIds
Definition: vtkGlyph3D.h:347
int ColorMode
Definition: vtkGlyph3D.h:340
void SetIndexModeToOff()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:254
int FillCellData
Definition: vtkGlyph3D.h:348
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:337
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
#define VTK_COLOR_BY_SCALE
Definition: vtkGlyph3D.h:91
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
Definition: vtkGlyph3D.h:142
int VectorMode
Definition: vtkGlyph3D.h:344
#define VTK_INDEXING_BY_VECTOR
Definition: vtkGlyph3D.h:101
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
double ScaleFactor
Definition: vtkGlyph3D.h:341
void SetVectorModeToUseVector()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:235