VTK  9.3.0
vtkGlyph3DMapper.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
28#ifndef vtkGlyph3DMapper_h
29#define vtkGlyph3DMapper_h
30
31#include "vtkGlyph3D.h" // for the constants (VTK_SCALE_BY_SCALAR, ...).
32#include "vtkMapper.h"
33#include "vtkRenderingCoreModule.h" // For export macro
34#include "vtkWeakPointer.h" // needed for vtkWeakPointer.
35
36VTK_ABI_NAMESPACE_BEGIN
39
40class VTKRENDERINGCORE_EXPORT vtkGlyph3DMapper : public vtkMapper
41{
42public:
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
48 {
49 SCALE = 0,
50 SOURCE_INDEX = 1,
51 MASK = 2,
52 ORIENTATION = 3,
53 SELECTIONID = 4
54 };
55
61 void SetSourceConnection(int idx, vtkAlgorithmOutput* algOutput);
63 {
64 this->SetSourceConnection(0, algOutput);
65 }
66
73
77 void SetSourceData(int idx, vtkPolyData* pd);
78
88
96
100 vtkPolyData* GetSource(int idx = 0);
101
106
108
113 vtkSetMacro(Scaling, bool);
114 vtkBooleanMacro(Scaling, bool);
115 vtkGetMacro(Scaling, bool);
117
119
125 vtkSetMacro(ScaleMode, int);
126 vtkGetMacro(ScaleMode, int);
128
130
134 vtkSetMacro(ScaleFactor, double);
135 vtkGetMacro(ScaleFactor, double);
137
139 {
140 NO_DATA_SCALING = 0,
141 SCALE_BY_MAGNITUDE = 1,
142 SCALE_BY_COMPONENTS = 2
143 };
144
145 void SetScaleModeToScaleByMagnitude() { this->SetScaleMode(SCALE_BY_MAGNITUDE); }
146 void SetScaleModeToScaleByVectorComponents() { this->SetScaleMode(SCALE_BY_COMPONENTS); }
147 void SetScaleModeToNoDataScaling() { this->SetScaleMode(NO_DATA_SCALING); }
148 const char* GetScaleModeAsString();
149
151
154 vtkSetVector2Macro(Range, double);
155 vtkGetVectorMacro(Range, double, 2);
157
159
164 vtkSetMacro(Orient, bool);
165 vtkGetMacro(Orient, bool);
166 vtkBooleanMacro(Orient, bool);
168
170
175 vtkSetClampMacro(OrientationMode, int, DIRECTION, QUATERNION);
176 vtkGetMacro(OrientationMode, int);
177 void SetOrientationModeToDirection() { this->SetOrientationMode(vtkGlyph3DMapper::DIRECTION); }
178 void SetOrientationModeToRotation() { this->SetOrientationMode(vtkGlyph3DMapper::ROTATION); }
182
184 {
185 DIRECTION = 0,
186 ROTATION = 1,
187 QUATERNION = 2
188 };
189
191
194 vtkSetMacro(Clamping, bool);
195 vtkGetMacro(Clamping, bool);
196 vtkBooleanMacro(Clamping, bool);
198
200
206 vtkSetMacro(SourceIndexing, bool);
207 vtkGetMacro(SourceIndexing, bool);
208 vtkBooleanMacro(SourceIndexing, bool);
210
212
217 vtkSetMacro(UseSourceTableTree, bool);
218 vtkGetMacro(UseSourceTableTree, bool);
219 vtkBooleanMacro(UseSourceTableTree, bool);
220
222
226 vtkSetMacro(UseSelectionIds, bool);
227 vtkBooleanMacro(UseSelectionIds, bool);
228 vtkGetMacro(UseSelectionIds, bool);
230
234 double* GetBounds() override;
235
239 void GetBounds(double bounds[6]) override;
240
244 void Render(vtkRenderer* ren, vtkActor* act) override;
245
247
255 vtkSetMacro(Masking, bool);
256 vtkGetMacro(Masking, bool);
257 vtkBooleanMacro(Masking, bool);
259
266 void SetMaskArray(const char* maskarrayname);
267
280 void SetMaskArray(int fieldAttributeType);
281
297 void SetOrientationArray(const char* orientationarrayname);
298
320 void SetOrientationArray(int fieldAttributeType);
321
327 void SetScaleArray(const char* scalarsarrayname);
328
334 void SetScaleArray(int fieldAttributeType);
335
342 void SetSourceIndexArray(const char* arrayname);
343
350 void SetSourceIndexArray(int fieldAttributeType);
351
361 void SetSelectionIdArray(const char* selectionIdArrayName);
362
372 void SetSelectionIdArray(int fieldAttributeType);
373
375
380 vtkSetMacro(SelectionColorId, unsigned int);
381 vtkGetMacro(SelectionColorId, unsigned int);
383
385
395 vtkGetObjectMacro(BlockAttributes, vtkCompositeDataDisplayAttributes);
397
399
403 vtkSetMacro(CullingAndLOD, bool);
404 vtkGetMacro(CullingAndLOD, bool);
405
413
419 virtual void SetNumberOfLOD(vtkIdType vtkNotUsed(nb)) {}
420
432 vtkIdType vtkNotUsed(index), float vtkNotUsed(distance), float vtkNotUsed(targetReduction))
433 {
434 }
435
440 vtkSetMacro(LODColoring, bool);
441 vtkGetMacro(LODColoring, bool);
443
450 bool GetSupportsSelection() override { return true; }
451
452protected:
455
457 vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo);
458
459 int FillInputPortInformation(int port, vtkInformation* info) override;
460
463
465
475
477 bool Scaling; // Determine whether scaling of geometry is performed
478 double ScaleFactor; // Scale factor to use to scale geometry
479 int ScaleMode; // Scale by scalar value or vector magnitude
480
481 double Range[2]; // Range to use to perform scalar scaling
482 bool Orient; // boolean controls whether to "orient" data
483 bool Clamping; // whether to clamp scale factor
484 bool SourceIndexing; // Enable/disable indexing into the glyph table
485 bool UseSelectionIds; // Enable/disable custom pick ids
486 bool Masking; // Enable/disable masking.
488
489 bool UseSourceTableTree; // Map DataObjectTree glyph source into table
490
491 unsigned int SelectionColorId;
492
493 bool CullingAndLOD = false; // Disable culling
494 std::vector<std::pair<float, float>> LODs;
495 bool LODColoring = false;
496
497private:
498 vtkGlyph3DMapper(const vtkGlyph3DMapper&) = delete;
499 void operator=(const vtkGlyph3DMapper&) = delete;
500
504 bool GetBoundsInternal(vtkDataSet* ds, double ds_bounds[6]);
505};
506
507VTK_ABI_NAMESPACE_END
508#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:50
Proxy object to connect input/output ports.
Rendering attributes for a multi-block dataset.
abstract superclass for arrays of numeric data
provides implementation for most abstract methods in the superclass vtkCompositeDataSet
general representation of visualization data
abstract class to specify dataset behavior
Definition vtkDataSet.h:62
vtkGlyph3D on the GPU.
void SetOrientationModeToQuaternion()
Orientation mode indicates if the OrientationArray provides the direction vector for the orientation ...
vtkDataObjectTree * GetSourceTableTree()
Convenience method to get the source table tree, if it exists.
virtual vtkIdType GetMaxNumberOfLOD()
Get the maximum number of LOD.
void SetScaleModeToScaleByVectorComponents()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
~vtkGlyph3DMapper() override
void SetSourceData(vtkPolyData *pd)
Set the source to use for he glyph.
void SetSourceData(int idx, vtkPolyData *pd)
Specify a source object at a specified table location.
void SetMaskArray(const char *maskarrayname)
Set the name of the point array to use as a mask for generating the glyphs.
vtkPolyData * GetSource(int idx, vtkInformationVector *sourceInfo)
vtkDataArray * GetScaleArray(vtkDataSet *input)
Convenience methods to get each of the arrays.
void SetSourceConnection(int idx, vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
double * GetBounds() override
Redefined to take into account the bounds of the scaled glyphs.
void SetScaleModeToScaleByMagnitude()
virtual int RequestUpdateExtent(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
void SetScaleArray(int fieldAttributeType)
Convenience method to set the array to scale with.
vtkDataArray * GetSelectionIdArray(vtkDataSet *input)
Convenience methods to get each of the arrays.
void SetSourceIndexArray(const char *arrayname)
Convenience method to set the array to use as index within the sources.
vtkCompositeDataDisplayAttributes * BlockAttributes
vtkDataArray * GetOrientationArray(vtkDataSet *input)
Convenience methods to get each of the arrays.
void SetInputData(vtkDataObject *)
Assign a data object as input.
void SetScaleModeToNoDataScaling()
virtual void SetNumberOfLOD(vtkIdType vtkNotUsed(nb))
Set the number of LOD.
const char * GetScaleModeAsString()
void SetOrientationArray(int fieldAttributeType)
Tells the mapper to use an orientation array if Orient is true.
void SetOrientationArray(const char *orientationarrayname)
Tells the mapper to use an orientation array if Orient is true.
void SetSelectionIdArray(int fieldAttributeType)
Convenience method to set the array used for selection IDs.
unsigned int SelectionColorId
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
void SetOrientationModeToDirection()
Orientation mode indicates if the OrientationArray provides the direction vector for the orientation ...
vtkPolyData * GetSourceTable(int idx, vtkInformationVector *sourceInfo)
vtkUnsignedCharArray * GetColors(vtkDataSet *input)
Convenience methods to get each of the arrays.
const char * GetOrientationModeAsString()
Orientation mode indicates if the OrientationArray provides the direction vector for the orientation ...
virtual void SetBlockAttributes(vtkCompositeDataDisplayAttributes *attr)
When the input data object (not the source) is composite data, it is possible to control visibility a...
vtkDataArray * GetSourceIndexArray(vtkDataSet *input)
Convenience methods to get each of the arrays.
std::vector< std::pair< float, float > > LODs
void Render(vtkRenderer *ren, vtkActor *act) override
All the work is done is derived classes.
void SetMaskArray(int fieldAttributeType)
Set the point attribute to use as a mask for generating the glyphs.
vtkPolyData * GetSource(int idx=0)
Get a pointer to a source object at a specified table location.
bool GetSupportsSelection() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
void SetOrientationModeToRotation()
Orientation mode indicates if the OrientationArray provides the direction vector for the orientation ...
vtkDataArray * GetMaskArray(vtkDataSet *input)
Convenience methods to get each of the arrays.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void GetBounds(double bounds[6]) override
Same as superclass.
void SetSelectionIdArray(const char *selectionIdArrayName)
Convenience method to set the array used for selection IDs.
void SetSourceTableTree(vtkDataObjectTree *tree)
Specify a data object tree that will be used for the source table.
void SetScaleArray(const char *scalarsarrayname)
Convenience method to set the array to scale with.
void SetSourceIndexArray(int fieldAttributeType)
Convenience method to set the array to use as index within the sources.
virtual void SetLODDistanceAndTargetReduction(vtkIdType vtkNotUsed(index), float vtkNotUsed(distance), float vtkNotUsed(targetReduction))
Configure LODs.
static vtkGlyph3DMapper * New()
a simple class to control print indentation
Definition vtkIndent.h:38
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
abstract class specifies interface to map data to graphics primitives
Definition vtkMapper.h:86
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:89
abstract specification for renderers
Definition vtkRenderer.h:68
dynamic, self-adjusting array of unsigned char
int vtkIdType
Definition vtkType.h:315