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=========================================================================*/
189#ifndef vtkGlyph3D_h
190#define vtkGlyph3D_h
191
192#include "vtkFiltersCoreModule.h" // For export macro
193#include "vtkPolyDataAlgorithm.h"
194
195#define VTK_SCALE_BY_SCALAR 0
196#define VTK_SCALE_BY_VECTOR 1
197#define VTK_SCALE_BY_VECTORCOMPONENTS 2
198#define VTK_DATA_SCALING_OFF 3
199
200#define VTK_COLOR_BY_SCALE 0
201#define VTK_COLOR_BY_SCALAR 1
202#define VTK_COLOR_BY_VECTOR 2
203
204#define VTK_USE_VECTOR 0
205#define VTK_USE_NORMAL 1
206#define VTK_VECTOR_ROTATION_OFF 2
207#define VTK_FOLLOW_CAMERA_DIRECTION 3
208
209#define VTK_INDEXING_OFF 0
210#define VTK_INDEXING_BY_SCALAR 1
211#define VTK_INDEXING_BY_VECTOR 2
212
213class vtkTransform;
214
215class VTKFILTERSCORE_EXPORT vtkGlyph3D : public vtkPolyDataAlgorithm
216{
217public:
219 void PrintSelf(ostream& os, vtkIndent indent) override;
220
227 static vtkGlyph3D* New();
228
235 void SetSourceData(vtkPolyData* pd) { this->SetSourceData(0, pd); }
236
243 void SetSourceData(int id, vtkPolyData* pd);
244
246
251 void SetSourceConnection(int id, vtkAlgorithmOutput* algOutput);
253 {
254 this->SetSourceConnection(0, algOutput);
255 }
257
261 vtkPolyData* GetSource(int id = 0);
262
264
267 vtkSetMacro(Scaling, vtkTypeBool);
268 vtkBooleanMacro(Scaling, vtkTypeBool);
269 vtkGetMacro(Scaling, vtkTypeBool);
271
273
276 vtkSetMacro(ScaleMode, int);
277 vtkGetMacro(ScaleMode, int);
278 void SetScaleModeToScaleByScalar() { this->SetScaleMode(VTK_SCALE_BY_SCALAR); }
279 void SetScaleModeToScaleByVector() { this->SetScaleMode(VTK_SCALE_BY_VECTOR); }
281 {
282 this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);
283 }
285 const char* GetScaleModeAsString();
287
289
292 vtkSetMacro(ColorMode, int);
293 vtkGetMacro(ColorMode, int);
294 void SetColorModeToColorByScale() { this->SetColorMode(VTK_COLOR_BY_SCALE); }
295 void SetColorModeToColorByScalar() { this->SetColorMode(VTK_COLOR_BY_SCALAR); }
296 void SetColorModeToColorByVector() { this->SetColorMode(VTK_COLOR_BY_VECTOR); }
297 const char* GetColorModeAsString();
299
301
304 vtkSetMacro(ScaleFactor, double);
305 vtkGetMacro(ScaleFactor, double);
307
309
312 vtkSetVector2Macro(Range, double);
313 vtkGetVectorMacro(Range, double, 2);
315
317
320 vtkSetMacro(Orient, vtkTypeBool);
321 vtkBooleanMacro(Orient, vtkTypeBool);
322 vtkGetMacro(Orient, vtkTypeBool);
324
326
330 vtkSetMacro(Clamping, vtkTypeBool);
331 vtkBooleanMacro(Clamping, vtkTypeBool);
332 vtkGetMacro(Clamping, vtkTypeBool);
334
336
339 vtkSetMacro(VectorMode, int);
340 vtkGetMacro(VectorMode, int);
341 void SetVectorModeToUseVector() { this->SetVectorMode(VTK_USE_VECTOR); }
342 void SetVectorModeToUseNormal() { this->SetVectorMode(VTK_USE_NORMAL); }
345 const char* GetVectorModeAsString();
347
349
353 vtkSetVectorMacro(FollowedCameraPosition, double, 3);
354 vtkGetVectorMacro(FollowedCameraPosition, double, 3);
356
358
361 vtkSetVectorMacro(FollowedCameraViewUp, double, 3);
362 vtkGetVectorMacro(FollowedCameraViewUp, double, 3);
364
366
373 vtkSetMacro(IndexMode, int);
374 vtkGetMacro(IndexMode, int);
375 void SetIndexModeToScalar() { this->SetIndexMode(VTK_INDEXING_BY_SCALAR); }
376 void SetIndexModeToVector() { this->SetIndexMode(VTK_INDEXING_BY_VECTOR); }
377 void SetIndexModeToOff() { this->SetIndexMode(VTK_INDEXING_OFF); }
378 const char* GetIndexModeAsString();
380
382
388 vtkSetMacro(GeneratePointIds, vtkTypeBool);
389 vtkGetMacro(GeneratePointIds, vtkTypeBool);
390 vtkBooleanMacro(GeneratePointIds, vtkTypeBool);
392
394
398 vtkSetStringMacro(PointIdsName);
399 vtkGetStringMacro(PointIdsName);
401
403
408 vtkSetMacro(FillCellData, vtkTypeBool);
409 vtkGetMacro(FillCellData, vtkTypeBool);
410 vtkBooleanMacro(FillCellData, vtkTypeBool);
412
417 virtual int IsPointVisible(vtkDataSet*, vtkIdType) { return 1; }
418
420
426 vtkGetObjectMacro(SourceTransform, vtkTransform);
428
433
435
440 vtkSetMacro(OutputPointsPrecision, int);
441 vtkGetMacro(OutputPointsPrecision, int);
443
444protected:
446 ~vtkGlyph3D() override;
447
451
453
455
460 virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output);
461 virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output,
462 vtkDataArray* inSScalars, vtkDataArray* inVectors);
464
465 vtkPolyData** Source; // Geometry to copy to each point
466 vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
467 int ScaleMode; // Scale by scalar value or vector magnitude
468 int ColorMode; // new scalars based on scale, scalar or vector
469 double ScaleFactor; // Scale factor to use to scale geometry
470 double Range[2]; // Range to use to perform scalar scaling
471 int Orient; // boolean controls whether to "orient" data
472 int VectorMode; // Orient/scale via normal or via vector data
473 double
474 FollowedCameraPosition[3]; // glyphs face towards this point in VTK_FOLLOW_CAMERA_DIRECTION mode
475 double FollowedCameraViewUp[3]; // glyph up direction in VTK_FOLLOW_CAMERA_DIRECTION mode
476 vtkTypeBool Clamping; // whether to clamp scale factor
477 int IndexMode; // what to use to index into glyph table
478 vtkTypeBool GeneratePointIds; // produce input points ids for each output point
479 vtkTypeBool FillCellData; // whether to fill output cell data
483
484private:
485 vtkGlyph3D(const vtkGlyph3D&) = delete;
486 void operator=(const vtkGlyph3D&) = delete;
487};
488
493{
494 if (this->ScaleMode == VTK_SCALE_BY_SCALAR)
495 {
496 return "ScaleByScalar";
497 }
498 else if (this->ScaleMode == VTK_SCALE_BY_VECTOR)
499 {
500 return "ScaleByVector";
501 }
502 else
503 {
504 return "DataScalingOff";
505 }
506}
507
512{
513 if (this->ColorMode == VTK_COLOR_BY_SCALAR)
514 {
515 return "ColorByScalar";
516 }
517 else if (this->ColorMode == VTK_COLOR_BY_VECTOR)
518 {
519 return "ColorByVector";
520 }
521 else
522 {
523 return "ColorByScale";
524 }
525}
526
531{
532 if (this->VectorMode == VTK_USE_VECTOR)
533 {
534 return "UseVector";
535 }
536 else if (this->VectorMode == VTK_USE_NORMAL)
537 {
538 return "UseNormal";
539 }
540 else if (this->VectorMode == VTK_FOLLOW_CAMERA_DIRECTION)
541 {
542 return "FollowCameraDirection";
543 }
544 else
545 {
546 return "VectorRotationOff";
547 }
548}
549
554{
555 if (this->IndexMode == VTK_INDEXING_OFF)
556 {
557 return "IndexingOff";
558 }
559 else if (this->IndexMode == VTK_INDEXING_BY_SCALAR)
560 {
561 return "IndexingByScalar";
562 }
563 else
564 {
565 return "IndexingByVector";
566 }
567}
568
569#endif
Proxy object to connect input/output ports.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
abstract class to specify dataset behavior
Definition: vtkDataSet.h:166
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:216
void SetIndexModeToScalar()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:375
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:279
int OutputPointsPrecision
Definition: vtkGlyph3D.h:482
void SetVectorModeToUseNormal()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:342
const char * GetVectorModeAsString()
Return the vector mode as a character string.
Definition: vtkGlyph3D.h:530
void SetScaleModeToScaleByVectorComponents()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:280
int ScaleMode
Definition: vtkGlyph3D.h:467
void SetIndexModeToOff()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:377
void SetScaleModeToScaleByScalar()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:278
void SetColorModeToColorByScalar()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:295
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:468
const char * GetIndexModeAsString()
Return the index mode as a character string.
Definition: vtkGlyph3D.h:553
vtkTypeBool Scaling
Definition: vtkGlyph3D.h:466
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:492
int VectorMode
Definition: vtkGlyph3D.h:472
void SetVectorModeToUseVector()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:341
void SetScaleModeToDataScalingOff()
Either scale by scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:284
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:417
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
Definition: vtkGlyph3D.h:511
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:476
int IndexMode
Definition: vtkGlyph3D.h:477
void SetColorModeToColorByScale()
Either color by scale, scalar or by vector/normal magnitude.
Definition: vtkGlyph3D.h:294
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:296
vtkTypeBool FillCellData
Definition: vtkGlyph3D.h:479
vtkPolyData ** Source
Definition: vtkGlyph3D.h:465
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
Definition: vtkGlyph3D.h:252
~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:344
char * PointIdsName
Definition: vtkGlyph3D.h:480
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
double ScaleFactor
Definition: vtkGlyph3D.h:469
vtkTransform * SourceTransform
Definition: vtkGlyph3D.h:481
void SetIndexModeToVector()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition: vtkGlyph3D.h:376
void SetSourceData(vtkPolyData *pd)
Set the source to use for the glyph.
Definition: vtkGlyph3D.h:235
void SetVectorModeToVectorRotationOff()
Specify whether to use vector or normal to perform vector operations.
Definition: vtkGlyph3D.h:343
vtkTypeBool GeneratePointIds
Definition: vtkGlyph3D.h:478
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:113
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:195
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:164
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_COLOR_BY_VECTOR
Definition: vtkGlyph3D.h:202
#define VTK_FOLLOW_CAMERA_DIRECTION
Definition: vtkGlyph3D.h:207
#define VTK_SCALE_BY_SCALAR
Definition: vtkGlyph3D.h:195
#define VTK_INDEXING_BY_SCALAR
Definition: vtkGlyph3D.h:210
#define VTK_DATA_SCALING_OFF
Definition: vtkGlyph3D.h:198
#define VTK_VECTOR_ROTATION_OFF
Definition: vtkGlyph3D.h:206
#define VTK_COLOR_BY_SCALAR
Definition: vtkGlyph3D.h:201
#define VTK_USE_VECTOR
Definition: vtkGlyph3D.h:204
#define VTK_USE_NORMAL
Definition: vtkGlyph3D.h:205
#define VTK_INDEXING_BY_VECTOR
Definition: vtkGlyph3D.h:211
#define VTK_SCALE_BY_VECTOR
Definition: vtkGlyph3D.h:196
#define VTK_INDEXING_OFF
Definition: vtkGlyph3D.h:209
#define VTK_COLOR_BY_SCALE
Definition: vtkGlyph3D.h:200
#define VTK_SCALE_BY_VECTORCOMPONENTS
Definition: vtkGlyph3D.h:197
int vtkIdType
Definition: vtkType.h:332
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287