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) 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,vtkTypeBool);
164  vtkBooleanMacro(Scaling,vtkTypeBool);
165  vtkGetMacro(Scaling,vtkTypeBool);
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,vtkTypeBool);
221  vtkBooleanMacro(Orient,vtkTypeBool);
222  vtkGetMacro(Orient,vtkTypeBool);
224 
226 
230  vtkSetMacro(Clamping,vtkTypeBool);
231  vtkBooleanMacro(Clamping,vtkTypeBool);
232  vtkGetMacro(Clamping,vtkTypeBool);
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,vtkTypeBool);
272  vtkGetMacro(GeneratePointIds,vtkTypeBool);
273  vtkBooleanMacro(GeneratePointIds,vtkTypeBool);
275 
277 
281  vtkSetStringMacro(PointIdsName);
282  vtkGetStringMacro(PointIdsName);
284 
286 
291  vtkSetMacro(FillCellData,vtkTypeBool);
292  vtkGetMacro(FillCellData,vtkTypeBool);
293  vtkBooleanMacro(FillCellData,vtkTypeBool);
295 
300  virtual int IsPointVisible(vtkDataSet*, vtkIdType) {return 1;};
301 
303 
308  void SetSourceTransform(vtkTransform*);
309  vtkGetObjectMacro(SourceTransform, vtkTransform);
311 
315  vtkMTimeType GetMTime() override;
316 
318 
323  vtkSetMacro(OutputPointsPrecision,int);
324  vtkGetMacro(OutputPointsPrecision,int);
326 
327 protected:
328  vtkGlyph3D();
329  ~vtkGlyph3D() override;
330 
333  int FillInputPortInformation(int, vtkInformation *) override;
334 
335  vtkPolyData* GetSource(int idx, vtkInformationVector *sourceInfo);
336 
338 
343  virtual bool Execute(vtkDataSet* input,
344  vtkInformationVector* sourceVector,
345  vtkPolyData* output);
346  virtual bool Execute(vtkDataSet* input,
347  vtkInformationVector* sourceVector,
348  vtkPolyData* output,
349  vtkDataArray *inSScalars,
350  vtkDataArray *inVectors);
352 
353  vtkPolyData **Source; // Geometry to copy to each point
354  vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
355  int ScaleMode; // Scale by scalar value or vector magnitude
356  int ColorMode; // new scalars based on scale, scalar or vector
357  double ScaleFactor; // Scale factor to use to scale geometry
358  double Range[2]; // Range to use to perform scalar scaling
359  int Orient; // boolean controls whether to "orient" data
360  int VectorMode; // Orient/scale via normal or via vector data
361  vtkTypeBool Clamping; // whether to clamp scale factor
362  int IndexMode; // what to use to index into glyph table
363  vtkTypeBool GeneratePointIds; // produce input points ids for each output point
364  vtkTypeBool FillCellData; // whether to fill output cell data
368 
369 private:
370  vtkGlyph3D(const vtkGlyph3D&) = delete;
371  void operator=(const vtkGlyph3D&) = delete;
372 };
373 
375 
378 inline const char *vtkGlyph3D::GetScaleModeAsString(void)
379 {
380  if ( this->ScaleMode == VTK_SCALE_BY_SCALAR )
381  {
382  return "ScaleByScalar";
383  }
384  else if ( this->ScaleMode == VTK_SCALE_BY_VECTOR )
385  {
386  return "ScaleByVector";
387  }
388  else
389  {
390  return "DataScalingOff";
391  }
392 }
394 
396 
399 inline const char *vtkGlyph3D::GetColorModeAsString(void)
400 {
401  if ( this->ColorMode == VTK_COLOR_BY_SCALAR )
402  {
403  return "ColorByScalar";
404  }
405  else if ( this->ColorMode == VTK_COLOR_BY_VECTOR )
406  {
407  return "ColorByVector";
408  }
409  else
410  {
411  return "ColorByScale";
412  }
413 }
415 
417 
420 inline const char *vtkGlyph3D::GetVectorModeAsString(void)
421 {
422  if ( this->VectorMode == VTK_USE_VECTOR)
423  {
424  return "UseVector";
425  }
426  else if ( this->VectorMode == VTK_USE_NORMAL)
427  {
428  return "UseNormal";
429  }
430  else
431  {
432  return "VectorRotationOff";
433  }
434 }
436 
438 
441 inline const char *vtkGlyph3D::GetIndexModeAsString(void)
442 {
443  if ( this->IndexMode == VTK_INDEXING_OFF)
444  {
445  return "IndexingOff";
446  }
447  else if ( this->IndexMode == VTK_INDEXING_BY_SCALAR)
448  {
449  return "IndexingByScalar";
450  }
451  else
452  {
453  return "IndexingByVector";
454  }
455 }
457 
458 #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:441
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:366
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
#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:355
int OutputPointsPrecision
Definition: vtkGlyph3D.h:367
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
Definition: vtkGlyph3D.h:399
#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:347
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:365
#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()
int vtkTypeBool
Definition: vtkABI.h:69
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
vtkTypeBool GeneratePointIds
Definition: vtkGlyph3D.h:363
const char * GetVectorModeAsString()
Return the vector mode as a character string.
Definition: vtkGlyph3D.h:420
const char * GetScaleModeAsString()
Return the method of scaling as a descriptive character string.
Definition: vtkGlyph3D.h:378
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:362
int ColorMode
Definition: vtkGlyph3D.h:356
void SetIndexModeToOff()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:260
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkTypeBool Clamping
Definition: vtkGlyph3D.h:361
Store zero or more vtkInformation instances.
vtkPolyData ** Source
Definition: vtkGlyph3D.h:353
#define VTK_COLOR_BY_SCALE
Definition: vtkGlyph3D.h:97
vtkTypeBool Scaling
Definition: vtkGlyph3D.h:354
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
Definition: vtkGlyph3D.h:148
vtkTypeBool FillCellData
Definition: vtkGlyph3D.h:364
int VectorMode
Definition: vtkGlyph3D.h:360
#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:357
void SetVectorModeToUseVector()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:241