VTK  9.2.6
vtkGlyph3DMapper.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkGlyph3DMapper.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=========================================================================*/
40#ifndef vtkGlyph3DMapper_h
41#define vtkGlyph3DMapper_h
42
43#include "vtkGlyph3D.h" // for the constants (VTK_SCALE_BY_SCALAR, ...).
44#include "vtkMapper.h"
45#include "vtkRenderingCoreModule.h" // For export macro
46#include "vtkWeakPointer.h" // needed for vtkWeakPointer.
47
50
51class VTKRENDERINGCORE_EXPORT vtkGlyph3DMapper : public vtkMapper
52{
53public:
56 void PrintSelf(ostream& os, vtkIndent indent) override;
57
59 {
60 SCALE = 0,
61 SOURCE_INDEX = 1,
62 MASK = 2,
63 ORIENTATION = 3,
64 SELECTIONID = 4
65 };
66
72 void SetSourceConnection(int idx, vtkAlgorithmOutput* algOutput);
74 {
75 this->SetSourceConnection(0, algOutput);
76 }
77
84
88 void SetSourceData(int idx, vtkPolyData* pd);
89
99
107
111 vtkPolyData* GetSource(int idx = 0);
112
117
119
124 vtkSetMacro(Scaling, bool);
125 vtkBooleanMacro(Scaling, bool);
126 vtkGetMacro(Scaling, bool);
128
130
136 vtkSetMacro(ScaleMode, int);
137 vtkGetMacro(ScaleMode, int);
139
141
145 vtkSetMacro(ScaleFactor, double);
146 vtkGetMacro(ScaleFactor, double);
148
150 {
151 NO_DATA_SCALING = 0,
152 SCALE_BY_MAGNITUDE = 1,
153 SCALE_BY_COMPONENTS = 2
154 };
155
156 void SetScaleModeToScaleByMagnitude() { this->SetScaleMode(SCALE_BY_MAGNITUDE); }
157 void SetScaleModeToScaleByVectorComponents() { this->SetScaleMode(SCALE_BY_COMPONENTS); }
158 void SetScaleModeToNoDataScaling() { this->SetScaleMode(NO_DATA_SCALING); }
159 const char* GetScaleModeAsString();
160
162
165 vtkSetVector2Macro(Range, double);
166 vtkGetVectorMacro(Range, double, 2);
168
170
175 vtkSetMacro(Orient, bool);
176 vtkGetMacro(Orient, bool);
177 vtkBooleanMacro(Orient, bool);
179
181
186 vtkSetClampMacro(OrientationMode, int, DIRECTION, QUATERNION);
187 vtkGetMacro(OrientationMode, int);
188 void SetOrientationModeToDirection() { this->SetOrientationMode(vtkGlyph3DMapper::DIRECTION); }
189 void SetOrientationModeToRotation() { this->SetOrientationMode(vtkGlyph3DMapper::ROTATION); }
193
195 {
196 DIRECTION = 0,
197 ROTATION = 1,
198 QUATERNION = 2
199 };
200
202
205 vtkSetMacro(Clamping, bool);
206 vtkGetMacro(Clamping, bool);
207 vtkBooleanMacro(Clamping, bool);
209
211
217 vtkSetMacro(SourceIndexing, bool);
218 vtkGetMacro(SourceIndexing, bool);
219 vtkBooleanMacro(SourceIndexing, bool);
221
223
228 vtkSetMacro(UseSourceTableTree, bool);
229 vtkGetMacro(UseSourceTableTree, bool);
230 vtkBooleanMacro(UseSourceTableTree, bool);
231
233
237 vtkSetMacro(UseSelectionIds, bool);
238 vtkBooleanMacro(UseSelectionIds, bool);
239 vtkGetMacro(UseSelectionIds, bool);
241
245 double* GetBounds() override;
246
250 void GetBounds(double bounds[6]) override;
251
255 void Render(vtkRenderer* ren, vtkActor* act) override;
256
258
266 vtkSetMacro(Masking, bool);
267 vtkGetMacro(Masking, bool);
268 vtkBooleanMacro(Masking, bool);
270
277 void SetMaskArray(const char* maskarrayname);
278
291 void SetMaskArray(int fieldAttributeType);
292
308 void SetOrientationArray(const char* orientationarrayname);
309
331 void SetOrientationArray(int fieldAttributeType);
332
338 void SetScaleArray(const char* scalarsarrayname);
339
345 void SetScaleArray(int fieldAttributeType);
346
353 void SetSourceIndexArray(const char* arrayname);
354
361 void SetSourceIndexArray(int fieldAttributeType);
362
372 void SetSelectionIdArray(const char* selectionIdArrayName);
373
383 void SetSelectionIdArray(int fieldAttributeType);
384
386
391 vtkSetMacro(SelectionColorId, unsigned int);
392 vtkGetMacro(SelectionColorId, unsigned int);
394
396
406 vtkGetObjectMacro(BlockAttributes, vtkCompositeDataDisplayAttributes);
408
410
414 vtkSetMacro(CullingAndLOD, bool);
415 vtkGetMacro(CullingAndLOD, bool);
416
424
430 virtual void SetNumberOfLOD(vtkIdType vtkNotUsed(nb)) {}
431
443 vtkIdType vtkNotUsed(index), float vtkNotUsed(distance), float vtkNotUsed(targetReduction))
444 {
445 }
446
451 vtkSetMacro(LODColoring, bool);
452 vtkGetMacro(LODColoring, bool);
454
461 bool GetSupportsSelection() override { return true; }
462
463protected:
466
468 vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo);
469
470 int FillInputPortInformation(int port, vtkInformation* info) override;
471
474
476
486
488 bool Scaling; // Determine whether scaling of geometry is performed
489 double ScaleFactor; // Scale factor to use to scale geometry
490 int ScaleMode; // Scale by scalar value or vector magnitude
491
492 double Range[2]; // Range to use to perform scalar scaling
493 bool Orient; // boolean controls whether to "orient" data
494 bool Clamping; // whether to clamp scale factor
495 bool SourceIndexing; // Enable/disable indexing into the glyph table
496 bool UseSelectionIds; // Enable/disable custom pick ids
497 bool Masking; // Enable/disable masking.
499
500 bool UseSourceTableTree; // Map DataObjectTree glyph source into table
501
502 unsigned int SelectionColorId;
503
504 bool CullingAndLOD = false; // Disable culling
505 std::vector<std::pair<float, float>> LODs;
506 bool LODColoring = false;
507
508private:
509 vtkGlyph3DMapper(const vtkGlyph3DMapper&) = delete;
510 void operator=(const vtkGlyph3DMapper&) = delete;
511
515 bool GetBoundsInternal(vtkDataSet* ds, double ds_bounds[6]);
516};
517
518#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:61
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:72
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:49
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
abstract class specifies interface to map data to graphics primitives
Definition vtkMapper.h:97
concrete dataset represents vertices, lines, polygons, and triangle strips
abstract specification for renderers
Definition vtkRenderer.h:82
dynamic, self-adjusting array of unsigned char
int vtkIdType
Definition vtkType.h:332