VTK  9.2.6
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=========================================================================*/
95#ifndef vtkGlyph3D_h
96#define vtkGlyph3D_h
97
98#include "vtkFiltersCoreModule.h" // For export macro
100
101#define VTK_SCALE_BY_SCALAR 0
102#define VTK_SCALE_BY_VECTOR 1
103#define VTK_SCALE_BY_VECTORCOMPONENTS 2
104#define VTK_DATA_SCALING_OFF 3
105
106#define VTK_COLOR_BY_SCALE 0
107#define VTK_COLOR_BY_SCALAR 1
108#define VTK_COLOR_BY_VECTOR 2
109
110#define VTK_USE_VECTOR 0
111#define VTK_USE_NORMAL 1
112#define VTK_VECTOR_ROTATION_OFF 2
113#define VTK_FOLLOW_CAMERA_DIRECTION 3
114
115#define VTK_INDEXING_OFF 0
116#define VTK_INDEXING_BY_SCALAR 1
117#define VTK_INDEXING_BY_VECTOR 2
118
119class vtkTransform;
120
121class VTKFILTERSCORE_EXPORT vtkGlyph3D : public vtkPolyDataAlgorithm
122{
123public:
125 void PrintSelf(ostream& os, vtkIndent indent) override;
126
133 static vtkGlyph3D* New();
134
141 void SetSourceData(vtkPolyData* pd) { this->SetSourceData(0, pd); }
142
149 void SetSourceData(int id, vtkPolyData* pd);
150
152
157 void SetSourceConnection(int id, vtkAlgorithmOutput* algOutput);
159 {
160 this->SetSourceConnection(0, algOutput);
161 }
163
167 vtkPolyData* GetSource(int id = 0);
168
170
173 vtkSetMacro(Scaling, vtkTypeBool);
174 vtkBooleanMacro(Scaling, vtkTypeBool);
175 vtkGetMacro(Scaling, vtkTypeBool);
177
179
182 vtkSetMacro(ScaleMode, int);
183 vtkGetMacro(ScaleMode, int);
184 void SetScaleModeToScaleByScalar() { this->SetScaleMode(VTK_SCALE_BY_SCALAR); }
185 void SetScaleModeToScaleByVector() { this->SetScaleMode(VTK_SCALE_BY_VECTOR); }
187 {
188 this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);
189 }
191 const char* GetScaleModeAsString();
193
195
198 vtkSetMacro(ColorMode, int);
199 vtkGetMacro(ColorMode, int);
200 void SetColorModeToColorByScale() { this->SetColorMode(VTK_COLOR_BY_SCALE); }
201 void SetColorModeToColorByScalar() { this->SetColorMode(VTK_COLOR_BY_SCALAR); }
202 void SetColorModeToColorByVector() { this->SetColorMode(VTK_COLOR_BY_VECTOR); }
203 const char* GetColorModeAsString();
205
207
210 vtkSetMacro(ScaleFactor, double);
211 vtkGetMacro(ScaleFactor, double);
213
215
218 vtkSetVector2Macro(Range, double);
219 vtkGetVectorMacro(Range, double, 2);
221
223
226 vtkSetMacro(Orient, vtkTypeBool);
227 vtkBooleanMacro(Orient, vtkTypeBool);
228 vtkGetMacro(Orient, vtkTypeBool);
230
232
236 vtkSetMacro(Clamping, vtkTypeBool);
237 vtkBooleanMacro(Clamping, vtkTypeBool);
238 vtkGetMacro(Clamping, vtkTypeBool);
240
242
245 vtkSetMacro(VectorMode, int);
246 vtkGetMacro(VectorMode, int);
247 void SetVectorModeToUseVector() { this->SetVectorMode(VTK_USE_VECTOR); }
248 void SetVectorModeToUseNormal() { this->SetVectorMode(VTK_USE_NORMAL); }
251 const char* GetVectorModeAsString();
253
255
259 vtkSetVectorMacro(FollowedCameraPosition, double, 3);
260 vtkGetVectorMacro(FollowedCameraPosition, double, 3);
262
264
267 vtkSetVectorMacro(FollowedCameraViewUp, double, 3);
268 vtkGetVectorMacro(FollowedCameraViewUp, double, 3);
270
272
279 vtkSetMacro(IndexMode, int);
280 vtkGetMacro(IndexMode, int);
281 void SetIndexModeToScalar() { this->SetIndexMode(VTK_INDEXING_BY_SCALAR); }
282 void SetIndexModeToVector() { this->SetIndexMode(VTK_INDEXING_BY_VECTOR); }
283 void SetIndexModeToOff() { this->SetIndexMode(VTK_INDEXING_OFF); }
284 const char* GetIndexModeAsString();
286
288
294 vtkSetMacro(GeneratePointIds, vtkTypeBool);
295 vtkGetMacro(GeneratePointIds, vtkTypeBool);
296 vtkBooleanMacro(GeneratePointIds, vtkTypeBool);
298
300
304 vtkSetStringMacro(PointIdsName);
305 vtkGetStringMacro(PointIdsName);
307
309
314 vtkSetMacro(FillCellData, vtkTypeBool);
315 vtkGetMacro(FillCellData, vtkTypeBool);
316 vtkBooleanMacro(FillCellData, vtkTypeBool);
318
323 virtual int IsPointVisible(vtkDataSet*, vtkIdType) { return 1; }
324
326
332 vtkGetObjectMacro(SourceTransform, vtkTransform);
334
339
341
346 vtkSetMacro(OutputPointsPrecision, int);
347 vtkGetMacro(OutputPointsPrecision, int);
349
350protected:
352 ~vtkGlyph3D() override;
353
357
359
361
366 virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output);
367 virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output,
368 vtkDataArray* inSScalars, vtkDataArray* inVectors);
370
371 vtkPolyData** Source; // Geometry to copy to each point
372 vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
373 int ScaleMode; // Scale by scalar value or vector magnitude
374 int ColorMode; // new scalars based on scale, scalar or vector
375 double ScaleFactor; // Scale factor to use to scale geometry
376 double Range[2]; // Range to use to perform scalar scaling
377 int Orient; // boolean controls whether to "orient" data
378 int VectorMode; // Orient/scale via normal or via vector data
379 double
380 FollowedCameraPosition[3]; // glyphs face towards this point in VTK_FOLLOW_CAMERA_DIRECTION mode
381 double FollowedCameraViewUp[3]; // glyph up direction in VTK_FOLLOW_CAMERA_DIRECTION mode
382 vtkTypeBool Clamping; // whether to clamp scale factor
383 int IndexMode; // what to use to index into glyph table
384 vtkTypeBool GeneratePointIds; // produce input points ids for each output point
385 vtkTypeBool FillCellData; // whether to fill output cell data
389
390private:
391 vtkGlyph3D(const vtkGlyph3D&) = delete;
392 void operator=(const vtkGlyph3D&) = delete;
393};
394
399{
400 if (this->ScaleMode == VTK_SCALE_BY_SCALAR)
401 {
402 return "ScaleByScalar";
403 }
404 else if (this->ScaleMode == VTK_SCALE_BY_VECTOR)
405 {
406 return "ScaleByVector";
407 }
408 else
409 {
410 return "DataScalingOff";
411 }
412}
413
418{
419 if (this->ColorMode == VTK_COLOR_BY_SCALAR)
420 {
421 return "ColorByScalar";
422 }
423 else if (this->ColorMode == VTK_COLOR_BY_VECTOR)
424 {
425 return "ColorByVector";
426 }
427 else
428 {
429 return "ColorByScale";
430 }
431}
432
437{
438 if (this->VectorMode == VTK_USE_VECTOR)
439 {
440 return "UseVector";
441 }
442 else if (this->VectorMode == VTK_USE_NORMAL)
443 {
444 return "UseNormal";
445 }
446 else if (this->VectorMode == VTK_FOLLOW_CAMERA_DIRECTION)
447 {
448 return "FollowCameraDirection";
449 }
450 else
451 {
452 return "VectorRotationOff";
453 }
454}
455
460{
461 if (this->IndexMode == VTK_INDEXING_OFF)
462 {
463 return "IndexingOff";
464 }
465 else if (this->IndexMode == VTK_INDEXING_BY_SCALAR)
466 {
467 return "IndexingByScalar";
468 }
469 else
470 {
471 return "IndexingByVector";
472 }
473}
474
475#endif
Proxy object to connect input/output ports.
abstract superclass for arrays of numeric data
abstract class to specify dataset behavior
Definition vtkDataSet.h:72
copy oriented and scaled glyph geometry to every input point
Definition vtkGlyph3D.h:122
void SetIndexModeToScalar()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition vtkGlyph3D.h:281
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:185
int OutputPointsPrecision
Definition vtkGlyph3D.h:388
void SetVectorModeToUseNormal()
Specify whether to use vector or normal to perform vector operations.
Definition vtkGlyph3D.h:248
const char * GetVectorModeAsString()
Return the vector mode as a character string.
Definition vtkGlyph3D.h:436
void SetScaleModeToScaleByVectorComponents()
Either scale by scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:186
void SetIndexModeToOff()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition vtkGlyph3D.h:283
void SetScaleModeToScaleByScalar()
Either scale by scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:184
void SetColorModeToColorByScalar()
Either color by scale, scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:201
void SetSourceTransform(vtkTransform *)
When set, this is use to transform the source polydata before using it to generate the glyph.
const char * GetIndexModeAsString()
Return the index mode as a character string.
Definition vtkGlyph3D.h:459
vtkTypeBool Scaling
Definition vtkGlyph3D.h:372
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:398
void SetVectorModeToUseVector()
Specify whether to use vector or normal to perform vector operations.
Definition vtkGlyph3D.h:247
void SetScaleModeToDataScalingOff()
Either scale by scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:190
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:323
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
Definition vtkGlyph3D.h:417
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:382
void SetColorModeToColorByScale()
Either color by scale, scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:200
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:202
vtkTypeBool FillCellData
Definition vtkGlyph3D.h:385
vtkPolyData ** Source
Definition vtkGlyph3D.h:371
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
Definition vtkGlyph3D.h:158
~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:250
char * PointIdsName
Definition vtkGlyph3D.h:386
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
double ScaleFactor
Definition vtkGlyph3D.h:375
vtkTransform * SourceTransform
Definition vtkGlyph3D.h:387
void SetIndexModeToVector()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition vtkGlyph3D.h:282
void SetSourceData(vtkPolyData *pd)
Set the source to use for the glyph.
Definition vtkGlyph3D.h:141
void SetVectorModeToVectorRotationOff()
Specify whether to use vector or normal to perform vector operations.
Definition vtkGlyph3D.h:249
vtkTypeBool GeneratePointIds
Definition vtkGlyph3D.h:384
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:49
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
describes linear transformations via a 4x4 matrix
int vtkTypeBool
Definition vtkABI.h:69
#define VTK_COLOR_BY_VECTOR
Definition vtkGlyph3D.h:108
#define VTK_FOLLOW_CAMERA_DIRECTION
Definition vtkGlyph3D.h:113
#define VTK_SCALE_BY_SCALAR
Definition vtkGlyph3D.h:101
#define VTK_INDEXING_BY_SCALAR
Definition vtkGlyph3D.h:116
#define VTK_DATA_SCALING_OFF
Definition vtkGlyph3D.h:104
#define VTK_VECTOR_ROTATION_OFF
Definition vtkGlyph3D.h:112
#define VTK_COLOR_BY_SCALAR
Definition vtkGlyph3D.h:107
#define VTK_USE_VECTOR
Definition vtkGlyph3D.h:110
#define VTK_USE_NORMAL
Definition vtkGlyph3D.h:111
#define VTK_INDEXING_BY_VECTOR
Definition vtkGlyph3D.h:117
#define VTK_SCALE_BY_VECTOR
Definition vtkGlyph3D.h:102
#define VTK_INDEXING_OFF
Definition vtkGlyph3D.h:115
#define VTK_COLOR_BY_SCALE
Definition vtkGlyph3D.h:106
#define VTK_SCALE_BY_VECTORCOMPONENTS
Definition vtkGlyph3D.h:103
int vtkIdType
Definition vtkType.h:332
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:287