VTK  9.1.0
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=========================================================================*/
89#ifndef vtkGlyph3D_h
90#define vtkGlyph3D_h
91
92#include "vtkFiltersCoreModule.h" // For export macro
94
95#define VTK_SCALE_BY_SCALAR 0
96#define VTK_SCALE_BY_VECTOR 1
97#define VTK_SCALE_BY_VECTORCOMPONENTS 2
98#define VTK_DATA_SCALING_OFF 3
99
100#define VTK_COLOR_BY_SCALE 0
101#define VTK_COLOR_BY_SCALAR 1
102#define VTK_COLOR_BY_VECTOR 2
103
104#define VTK_USE_VECTOR 0
105#define VTK_USE_NORMAL 1
106#define VTK_VECTOR_ROTATION_OFF 2
107#define VTK_FOLLOW_CAMERA_DIRECTION 3
108
109#define VTK_INDEXING_OFF 0
110#define VTK_INDEXING_BY_SCALAR 1
111#define VTK_INDEXING_BY_VECTOR 2
112
113class vtkTransform;
114
115class VTKFILTERSCORE_EXPORT vtkGlyph3D : public vtkPolyDataAlgorithm
116{
117public:
119 void PrintSelf(ostream& os, vtkIndent indent) override;
120
127 static vtkGlyph3D* New();
128
135 void SetSourceData(vtkPolyData* pd) { this->SetSourceData(0, pd); }
136
143 void SetSourceData(int id, vtkPolyData* pd);
144
146
151 void SetSourceConnection(int id, vtkAlgorithmOutput* algOutput);
153 {
154 this->SetSourceConnection(0, algOutput);
155 }
157
161 vtkPolyData* GetSource(int id = 0);
162
164
167 vtkSetMacro(Scaling, vtkTypeBool);
168 vtkBooleanMacro(Scaling, vtkTypeBool);
169 vtkGetMacro(Scaling, vtkTypeBool);
171
173
176 vtkSetMacro(ScaleMode, int);
177 vtkGetMacro(ScaleMode, int);
178 void SetScaleModeToScaleByScalar() { this->SetScaleMode(VTK_SCALE_BY_SCALAR); }
179 void SetScaleModeToScaleByVector() { this->SetScaleMode(VTK_SCALE_BY_VECTOR); }
181 {
182 this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);
183 }
185 const char* GetScaleModeAsString();
187
189
192 vtkSetMacro(ColorMode, int);
193 vtkGetMacro(ColorMode, int);
194 void SetColorModeToColorByScale() { this->SetColorMode(VTK_COLOR_BY_SCALE); }
195 void SetColorModeToColorByScalar() { this->SetColorMode(VTK_COLOR_BY_SCALAR); }
196 void SetColorModeToColorByVector() { 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); }
245 const char* GetVectorModeAsString();
247
249
253 vtkSetVectorMacro(FollowedCameraPosition, double, 3);
254 vtkGetVectorMacro(FollowedCameraPosition, double, 3);
256
258
261 vtkSetVectorMacro(FollowedCameraViewUp, double, 3);
262 vtkGetVectorMacro(FollowedCameraViewUp, double, 3);
264
266
273 vtkSetMacro(IndexMode, int);
274 vtkGetMacro(IndexMode, int);
275 void SetIndexModeToScalar() { this->SetIndexMode(VTK_INDEXING_BY_SCALAR); }
276 void SetIndexModeToVector() { this->SetIndexMode(VTK_INDEXING_BY_VECTOR); }
277 void SetIndexModeToOff() { this->SetIndexMode(VTK_INDEXING_OFF); }
278 const char* GetIndexModeAsString();
280
282
288 vtkSetMacro(GeneratePointIds, vtkTypeBool);
289 vtkGetMacro(GeneratePointIds, vtkTypeBool);
290 vtkBooleanMacro(GeneratePointIds, vtkTypeBool);
292
294
298 vtkSetStringMacro(PointIdsName);
299 vtkGetStringMacro(PointIdsName);
301
303
308 vtkSetMacro(FillCellData, vtkTypeBool);
309 vtkGetMacro(FillCellData, vtkTypeBool);
310 vtkBooleanMacro(FillCellData, vtkTypeBool);
312
317 virtual int IsPointVisible(vtkDataSet*, vtkIdType) { return 1; }
318
320
326 vtkGetObjectMacro(SourceTransform, vtkTransform);
328
333
335
340 vtkSetMacro(OutputPointsPrecision, int);
341 vtkGetMacro(OutputPointsPrecision, int);
343
344protected:
346 ~vtkGlyph3D() override;
347
351
353
355
360 virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output);
361 virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output,
362 vtkDataArray* inSScalars, vtkDataArray* inVectors);
364
365 vtkPolyData** Source; // Geometry to copy to each point
366 vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
367 int ScaleMode; // Scale by scalar value or vector magnitude
368 int ColorMode; // new scalars based on scale, scalar or vector
369 double ScaleFactor; // Scale factor to use to scale geometry
370 double Range[2]; // Range to use to perform scalar scaling
371 int Orient; // boolean controls whether to "orient" data
372 int VectorMode; // Orient/scale via normal or via vector data
373 double
374 FollowedCameraPosition[3]; // glyphs face towards this point in VTK_FOLLOW_CAMERA_DIRECTION mode
375 double FollowedCameraViewUp[3]; // glyph up direction in VTK_FOLLOW_CAMERA_DIRECTION mode
376 vtkTypeBool Clamping; // whether to clamp scale factor
377 int IndexMode; // what to use to index into glyph table
378 vtkTypeBool GeneratePointIds; // produce input points ids for each output point
379 vtkTypeBool FillCellData; // whether to fill output cell data
383
384private:
385 vtkGlyph3D(const vtkGlyph3D&) = delete;
386 void operator=(const vtkGlyph3D&) = delete;
387};
388
393{
394 if (this->ScaleMode == VTK_SCALE_BY_SCALAR)
395 {
396 return "ScaleByScalar";
397 }
398 else if (this->ScaleMode == VTK_SCALE_BY_VECTOR)
399 {
400 return "ScaleByVector";
401 }
402 else
403 {
404 return "DataScalingOff";
405 }
406}
407
412{
413 if (this->ColorMode == VTK_COLOR_BY_SCALAR)
414 {
415 return "ColorByScalar";
416 }
417 else if (this->ColorMode == VTK_COLOR_BY_VECTOR)
418 {
419 return "ColorByVector";
420 }
421 else
422 {
423 return "ColorByScale";
424 }
425}
426
431{
432 if (this->VectorMode == VTK_USE_VECTOR)
433 {
434 return "UseVector";
435 }
436 else if (this->VectorMode == VTK_USE_NORMAL)
437 {
438 return "UseNormal";
439 }
440 else if (this->VectorMode == VTK_FOLLOW_CAMERA_DIRECTION)
441 {
442 return "FollowCameraDirection";
443 }
444 else
445 {
446 return "VectorRotationOff";
447 }
448}
449
454{
455 if (this->IndexMode == VTK_INDEXING_OFF)
456 {
457 return "IndexingOff";
458 }
459 else if (this->IndexMode == VTK_INDEXING_BY_SCALAR)
460 {
461 return "IndexingByScalar";
462 }
463 else
464 {
465 return "IndexingByVector";
466 }
467}
468
469#endif
Proxy object to connect input/output ports.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:59
abstract class to specify dataset behavior
Definition: vtkDataSet.h:66
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:116
void SetIndexModeToScalar()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:275
void SetSourceData(int id, vtkPolyData *pd)
Specify a source object at a specified table location.
void SetScaleModeToScaleByVector()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:179
int OutputPointsPrecision
Definition: vtkGlyph3D.h:382
void SetVectorModeToUseNormal()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:242
const char * GetVectorModeAsString()
Return the vector mode as a character string.
Definition: vtkGlyph3D.h:430
void SetScaleModeToScaleByVectorComponents()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:180
int ScaleMode
Definition: vtkGlyph3D.h:367
void SetIndexModeToOff()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:277
void SetScaleModeToScaleByScalar()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:178
void SetColorModeToColorByScalar()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:195
void SetSourceTransform(vtkTransform *)
When set, this is use to transform the source polydata before using it to generate the glyph.
int ColorMode
Definition: vtkGlyph3D.h:368
const char * GetIndexModeAsString()
Return the index mode as a character string.
Definition: vtkGlyph3D.h:453
vtkTypeBool Scaling
Definition: vtkGlyph3D.h:366
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
const char * GetScaleModeAsString()
Return the method of scaling as a descriptive character string.
Definition: vtkGlyph3D.h:392
int VectorMode
Definition: vtkGlyph3D.h:372
void SetVectorModeToUseVector()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:241
void SetScaleModeToDataScalingOff()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:184
vtkMTimeType GetMTime() override
Overridden to include SourceTransform's MTime.
virtual int IsPointVisible(vtkDataSet *, vtkIdType)
This can be overwritten by subclass to return 0 when a point is blanked.
Definition: vtkGlyph3D.h:317
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
Definition: vtkGlyph3D.h:411
void SetSourceConnection(int id, vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkPolyData * GetSource(int id=0)
Get a pointer to a source object at a specified table location.
vtkTypeBool Clamping
Definition: vtkGlyph3D.h:376
int IndexMode
Definition: vtkGlyph3D.h:377
void SetColorModeToColorByScale()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:194
virtual bool Execute(vtkDataSet *input, vtkInformationVector *sourceVector, vtkPolyData *output, vtkDataArray *inSScalars, vtkDataArray *inVectors)
Method called in RequestData() to do the actual data processing.
void SetColorModeToColorByVector()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:196
vtkTypeBool FillCellData
Definition: vtkGlyph3D.h:379
vtkPolyData ** Source
Definition: vtkGlyph3D.h:365
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
Definition: vtkGlyph3D.h:152
~vtkGlyph3D() override
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
vtkPolyData * GetSource(int idx, vtkInformationVector *sourceInfo)
void SetVectorModeToFollowCameraDirection()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:244
char * PointIdsName
Definition: vtkGlyph3D.h:380
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
double ScaleFactor
Definition: vtkGlyph3D.h:369
vtkTransform * SourceTransform
Definition: vtkGlyph3D.h:381
void SetIndexModeToVector()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:276
void SetSourceData(vtkPolyData *pd)
Set the source to use for the glyph.
Definition: vtkGlyph3D.h:135
void SetVectorModeToVectorRotationOff()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:243
vtkTypeBool GeneratePointIds
Definition: vtkGlyph3D.h:378
virtual bool Execute(vtkDataSet *input, vtkInformationVector *sourceVector, vtkPolyData *output)
Method called in RequestData() to do the actual data processing.
static vtkGlyph3D * New()
Construct object with scaling on, scaling mode is by scalar value, scale factor = 1....
a simple class to control print indentation
Definition: vtkIndent.h:43
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:95
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:64
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
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_COLOR_BY_VECTOR
Definition: vtkGlyph3D.h:102
#define VTK_FOLLOW_CAMERA_DIRECTION
Definition: vtkGlyph3D.h:107
#define VTK_SCALE_BY_SCALAR
Definition: vtkGlyph3D.h:95
#define VTK_INDEXING_BY_SCALAR
Definition: vtkGlyph3D.h:110
#define VTK_DATA_SCALING_OFF
Definition: vtkGlyph3D.h:98
#define VTK_VECTOR_ROTATION_OFF
Definition: vtkGlyph3D.h:106
#define VTK_COLOR_BY_SCALAR
Definition: vtkGlyph3D.h:101
#define VTK_USE_VECTOR
Definition: vtkGlyph3D.h:104
#define VTK_USE_NORMAL
Definition: vtkGlyph3D.h:105
#define VTK_INDEXING_BY_VECTOR
Definition: vtkGlyph3D.h:111
#define VTK_SCALE_BY_VECTOR
Definition: vtkGlyph3D.h:96
#define VTK_INDEXING_OFF
Definition: vtkGlyph3D.h:109
#define VTK_COLOR_BY_SCALE
Definition: vtkGlyph3D.h:100
#define VTK_SCALE_BY_VECTORCOMPONENTS
Definition: vtkGlyph3D.h:97
int vtkIdType
Definition: vtkType.h:332
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287