VTK  9.1.0
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 =========================================================================*/
137 #ifndef vtkGlyph3DMapper_h
138 #define vtkGlyph3DMapper_h
139 
140 #include "vtkGlyph3D.h" // for the constants (VTK_SCALE_BY_SCALAR, ...).
141 #include "vtkMapper.h"
142 #include "vtkRenderingCoreModule.h" // For export macro
143 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
144 
146 class vtkDataObjectTree;
147 
148 class VTKRENDERINGCORE_EXPORT vtkGlyph3DMapper : public vtkMapper
149 {
150 public:
152  vtkTypeMacro(vtkGlyph3DMapper, vtkMapper);
153  void PrintSelf(ostream& os, vtkIndent indent) override;
154 
156  {
157  SCALE = 0,
158  SOURCE_INDEX = 1,
159  MASK = 2,
160  ORIENTATION = 3,
161  SELECTIONID = 4
162  };
163 
169  void SetSourceConnection(int idx, vtkAlgorithmOutput* algOutput);
171  {
172  this->SetSourceConnection(0, algOutput);
173  }
174 
181 
185  void SetSourceData(int idx, vtkPolyData* pd);
186 
196 
204 
208  vtkPolyData* GetSource(int idx = 0);
209 
214 
216 
221  vtkSetMacro(Scaling, bool);
222  vtkBooleanMacro(Scaling, bool);
223  vtkGetMacro(Scaling, bool);
225 
227 
233  vtkSetMacro(ScaleMode, int);
234  vtkGetMacro(ScaleMode, int);
236 
238 
242  vtkSetMacro(ScaleFactor, double);
243  vtkGetMacro(ScaleFactor, double);
245 
247  {
248  NO_DATA_SCALING = 0,
249  SCALE_BY_MAGNITUDE = 1,
250  SCALE_BY_COMPONENTS = 2
251  };
252 
253  void SetScaleModeToScaleByMagnitude() { this->SetScaleMode(SCALE_BY_MAGNITUDE); }
254  void SetScaleModeToScaleByVectorComponents() { this->SetScaleMode(SCALE_BY_COMPONENTS); }
255  void SetScaleModeToNoDataScaling() { this->SetScaleMode(NO_DATA_SCALING); }
256  const char* GetScaleModeAsString();
257 
259 
262  vtkSetVector2Macro(Range, double);
263  vtkGetVectorMacro(Range, double, 2);
265 
267 
272  vtkSetMacro(Orient, bool);
273  vtkGetMacro(Orient, bool);
274  vtkBooleanMacro(Orient, bool);
276 
278 
283  vtkSetClampMacro(OrientationMode, int, DIRECTION, QUATERNION);
284  vtkGetMacro(OrientationMode, int);
285  void SetOrientationModeToDirection() { this->SetOrientationMode(vtkGlyph3DMapper::DIRECTION); }
286  void SetOrientationModeToRotation() { this->SetOrientationMode(vtkGlyph3DMapper::ROTATION); }
287  void SetOrientationModeToQuaternion() { this->SetOrientationMode(vtkGlyph3DMapper::QUATERNION); }
290 
292  {
293  DIRECTION = 0,
294  ROTATION = 1,
295  QUATERNION = 2
296  };
297 
299 
302  vtkSetMacro(Clamping, bool);
303  vtkGetMacro(Clamping, bool);
304  vtkBooleanMacro(Clamping, bool);
306 
308 
314  vtkSetMacro(SourceIndexing, bool);
315  vtkGetMacro(SourceIndexing, bool);
316  vtkBooleanMacro(SourceIndexing, bool);
318 
320 
325  vtkSetMacro(UseSourceTableTree, bool);
326  vtkGetMacro(UseSourceTableTree, bool);
327  vtkBooleanMacro(UseSourceTableTree, bool);
328 
330 
334  vtkSetMacro(UseSelectionIds, bool);
335  vtkBooleanMacro(UseSelectionIds, bool);
336  vtkGetMacro(UseSelectionIds, bool);
338 
342  double* GetBounds() override;
343 
347  void GetBounds(double bounds[6]) override;
348 
352  void Render(vtkRenderer* ren, vtkActor* act) override;
353 
355 
363  vtkSetMacro(Masking, bool);
364  vtkGetMacro(Masking, bool);
365  vtkBooleanMacro(Masking, bool);
367 
374  void SetMaskArray(const char* maskarrayname);
375 
388  void SetMaskArray(int fieldAttributeType);
389 
405  void SetOrientationArray(const char* orientationarrayname);
406 
428  void SetOrientationArray(int fieldAttributeType);
429 
435  void SetScaleArray(const char* scalarsarrayname);
436 
442  void SetScaleArray(int fieldAttributeType);
443 
450  void SetSourceIndexArray(const char* arrayname);
451 
458  void SetSourceIndexArray(int fieldAttributeType);
459 
469  void SetSelectionIdArray(const char* selectionIdArrayName);
470 
480  void SetSelectionIdArray(int fieldAttributeType);
481 
483 
488  vtkSetMacro(SelectionColorId, unsigned int);
489  vtkGetMacro(SelectionColorId, unsigned int);
491 
493 
503  vtkGetObjectMacro(BlockAttributes, vtkCompositeDataDisplayAttributes);
505 
507 
511  vtkSetMacro(CullingAndLOD, bool);
512  vtkGetMacro(CullingAndLOD, bool);
513 
521 
527  virtual void SetNumberOfLOD(vtkIdType vtkNotUsed(nb)) {}
528 
540  vtkIdType vtkNotUsed(index), float vtkNotUsed(distance), float vtkNotUsed(targetReduction))
541  {
542  }
543 
548  vtkSetMacro(LODColoring, bool);
549  vtkGetMacro(LODColoring, bool);
551 
558  bool GetSupportsSelection() override { return true; }
559 
560 protected:
562  ~vtkGlyph3DMapper() override;
563 
564  virtual int RequestUpdateExtent(
565  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo);
566 
568 
571 
573 
583 
585  bool Scaling; // Determine whether scaling of geometry is performed
586  double ScaleFactor; // Scale factor to use to scale geometry
587  int ScaleMode; // Scale by scalar value or vector magnitude
588 
589  double Range[2]; // Range to use to perform scalar scaling
590  bool Orient; // boolean controls whether to "orient" data
591  bool Clamping; // whether to clamp scale factor
592  bool SourceIndexing; // Enable/disable indexing into the glyph table
593  bool UseSelectionIds; // Enable/disable custom pick ids
594  bool Masking; // Enable/disable masking.
596 
597  bool UseSourceTableTree; // Map DataObjectTree glyph source into table
598 
599  unsigned int SelectionColorId;
600 
601  bool CullingAndLOD = false; // Disable culling
602  std::vector<std::pair<float, float>> LODs;
603  bool LODColoring = false;
604 
605 private:
606  vtkGlyph3DMapper(const vtkGlyph3DMapper&) = delete;
607  void operator=(const vtkGlyph3DMapper&) = delete;
608 
612  bool GetBoundsInternal(vtkDataSet* ds, double ds_bounds[6]);
613 };
614 
615 #endif
vtkGlyph3DMapper::SetMaskArray
void SetMaskArray(int fieldAttributeType)
Set the point attribute to use as a mask for generating the glyphs.
vtk::Range
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
vtkGlyph3DMapper::ROTATION
@ ROTATION
Definition: vtkGlyph3DMapper.h:294
vtkGlyph3DMapper::SetScaleModeToScaleByVectorComponents
void SetScaleModeToScaleByVectorComponents()
Definition: vtkGlyph3DMapper.h:254
vtkGlyph3DMapper::SetSourceConnection
void SetSourceConnection(int idx, vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
vtkGlyph3DMapper::RequestUpdateExtent
virtual int RequestUpdateExtent(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
vtkDataObjectTree
provides implementation for most abstract methods in the superclass vtkCompositeDataSet
Definition: vtkDataObjectTree.h:47
vtkGlyph3DMapper::ScaleMode
int ScaleMode
Definition: vtkGlyph3DMapper.h:587
vtkGlyph3DMapper::GetOrientationArray
vtkDataArray * GetOrientationArray(vtkDataSet *input)
Convenience methods to get each of the arrays.
vtkGlyph3DMapper::OrientationMode
int OrientationMode
Definition: vtkGlyph3DMapper.h:595
vtkGlyph3DMapper::GetMaxNumberOfLOD
virtual vtkIdType GetMaxNumberOfLOD()
Get the maximum number of LOD.
vtkGlyph3DMapper::ScaleFactor
double ScaleFactor
Definition: vtkGlyph3DMapper.h:586
vtkGlyph3DMapper::GetOrientationModeAsString
const char * GetOrientationModeAsString()
Orientation mode indicates if the OrientationArray provides the direction vector for the orientation ...
vtkIdType
int vtkIdType
Definition: vtkType.h:332
vtkGlyph3DMapper::SetSourceData
void SetSourceData(int idx, vtkPolyData *pd)
Specify a source object at a specified table location.
vtkGlyph3DMapper::SetMaskArray
void SetMaskArray(const char *maskarrayname)
Set the name of the point array to use as a mask for generating the glyphs.
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:145
vtkGlyph3DMapper::GetSource
vtkPolyData * GetSource(int idx=0)
Get a pointer to a source object at a specified table location.
vtkGlyph3DMapper::GetSupportsSelection
bool GetSupportsSelection() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
Definition: vtkGlyph3DMapper.h:558
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:145
vtkGlyph3DMapper::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkGlyph3DMapper::GetSourceIndexArray
vtkDataArray * GetSourceIndexArray(vtkDataSet *input)
Convenience methods to get each of the arrays.
vtkGlyph3DMapper::Clamping
bool Clamping
Definition: vtkGlyph3DMapper.h:591
vtkGlyph3DMapper::SetInputData
void SetInputData(vtkDataObject *)
Assign a data object as input.
vtkGlyph3DMapper::GetBounds
double * GetBounds() override
Redefined to take into account the bounds of the scaled glyphs.
vtkGlyph3DMapper::GetSource
vtkPolyData * GetSource(int idx, vtkInformationVector *sourceInfo)
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
vtkGlyph3DMapper::SetSelectionIdArray
void SetSelectionIdArray(int fieldAttributeType)
Convenience method to set the array used for selection IDs.
vtkGlyph3DMapper::SetSourceData
void SetSourceData(vtkPolyData *pd)
Set the source to use for he glyph.
vtkGlyph3DMapper::BlockAttributes
vtkCompositeDataDisplayAttributes * BlockAttributes
Definition: vtkGlyph3DMapper.h:584
vtkGlyph3DMapper::SetOrientationArray
void SetOrientationArray(const char *orientationarrayname)
Tells the mapper to use an orientation array if Orient is true.
vtkGlyph3DMapper::GetColors
vtkUnsignedCharArray * GetColors(vtkDataSet *input)
Convenience methods to get each of the arrays.
vtkGlyph3DMapper::OrientationModes
OrientationModes
Definition: vtkGlyph3DMapper.h:292
vtkGlyph3DMapper::SetScaleModeToScaleByMagnitude
void SetScaleModeToScaleByMagnitude()
Definition: vtkGlyph3DMapper.h:253
vtkCompositeDataDisplayAttributes
Rendering attributes for a multi-block dataset.
Definition: vtkCompositeDataDisplayAttributes.h:59
vtkGlyph3DMapper::GetSelectionIdArray
vtkDataArray * GetSelectionIdArray(vtkDataSet *input)
Convenience methods to get each of the arrays.
vtkMapper.h
vtkX3D::port
@ port
Definition: vtkX3D.h:453
vtkGlyph3DMapper::SetScaleArray
void SetScaleArray(const char *scalarsarrayname)
Convenience method to set the array to scale with.
vtkGlyph3DMapper::SetScaleModeToNoDataScaling
void SetScaleModeToNoDataScaling()
Definition: vtkGlyph3DMapper.h:255
vtkGlyph3DMapper::SetScaleArray
void SetScaleArray(int fieldAttributeType)
Convenience method to set the array to scale with.
vtkGlyph3DMapper::SetOrientationModeToQuaternion
void SetOrientationModeToQuaternion()
Orientation mode indicates if the OrientationArray provides the direction vector for the orientation ...
Definition: vtkGlyph3DMapper.h:287
vtkMapper
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:171
vtkGlyph3DMapper::SelectionColorId
unsigned int SelectionColorId
Definition: vtkGlyph3DMapper.h:599
vtkGlyph3DMapper
vtkGlyph3D on the GPU.
Definition: vtkGlyph3DMapper.h:149
vtkGlyph3DMapper::SetLODDistanceAndTargetReduction
virtual void SetLODDistanceAndTargetReduction(vtkIdType vtkNotUsed(index), float vtkNotUsed(distance), float vtkNotUsed(targetReduction))
Configure LODs.
Definition: vtkGlyph3DMapper.h:539
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkGlyph3DMapper::Scaling
bool Scaling
Definition: vtkGlyph3DMapper.h:585
vtkGlyph3DMapper::GetScaleArray
vtkDataArray * GetScaleArray(vtkDataSet *input)
Convenience methods to get each of the arrays.
vtkGlyph3DMapper::UseSelectionIds
bool UseSelectionIds
Definition: vtkGlyph3DMapper.h:593
vtkGlyph3DMapper::SetSelectionIdArray
void SetSelectionIdArray(const char *selectionIdArrayName)
Convenience method to set the array used for selection IDs.
vtkGlyph3DMapper::LODs
std::vector< std::pair< float, float > > LODs
Definition: vtkGlyph3DMapper.h:602
vtkWeakPointer.h
vtkGlyph3DMapper::SourceIndexing
bool SourceIndexing
Definition: vtkGlyph3DMapper.h:592
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:166
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:183
vtkGlyph3DMapper::New
static vtkGlyph3DMapper * New()
vtkGlyph3DMapper::DIRECTION
@ DIRECTION
Definition: vtkGlyph3DMapper.h:293
vtkX3D::info
@ info
Definition: vtkX3D.h:382
vtkGlyph3DMapper::ScaleModes
ScaleModes
Definition: vtkGlyph3DMapper.h:247
vtkGlyph3DMapper::GetBounds
void GetBounds(double bounds[6]) override
Same as superclass.
vtkGlyph3DMapper::Render
void Render(vtkRenderer *ren, vtkActor *act) override
All the work is done is derived classes.
vtkGlyph3DMapper::SetSourceIndexArray
void SetSourceIndexArray(int fieldAttributeType)
Convenience method to set the array to use as index within the sources.
vtkGlyph3DMapper::Orient
bool Orient
Definition: vtkGlyph3DMapper.h:590
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:66
vtkGlyph3DMapper::GetSourceTableTree
vtkDataObjectTree * GetSourceTableTree()
Convenience method to get the source table tree, if it exists.
vtkGlyph3DMapper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:182
vtkGlyph3DMapper::SetOrientationArray
void SetOrientationArray(int fieldAttributeType)
Tells the mapper to use an orientation array if Orient is true.
vtkGlyph3DMapper::~vtkGlyph3DMapper
~vtkGlyph3DMapper() override
vtkGlyph3DMapper::SetSourceTableTree
void SetSourceTableTree(vtkDataObjectTree *tree)
Specify a data object tree that will be used for the source table.
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
vtkGlyph3DMapper::vtkGlyph3DMapper
vtkGlyph3DMapper()
vtkGlyph3DMapper::GetSourceTable
vtkPolyData * GetSourceTable(int idx, vtkInformationVector *sourceInfo)
vtkGlyph3DMapper::SetOrientationModeToRotation
void SetOrientationModeToRotation()
Orientation mode indicates if the OrientationArray provides the direction vector for the orientation ...
Definition: vtkGlyph3DMapper.h:286
vtkGlyph3DMapper::SetSourceConnection
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Definition: vtkGlyph3DMapper.h:170
vtkGlyph3DMapper::SetOrientationModeToDirection
void SetOrientationModeToDirection()
Orientation mode indicates if the OrientationArray provides the direction vector for the orientation ...
Definition: vtkGlyph3DMapper.h:285
vtkGlyph3DMapper::QUATERNION
@ QUATERNION
Definition: vtkGlyph3DMapper.h:295
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:169
vtkGlyph3DMapper::GetMaskArray
vtkDataArray * GetMaskArray(vtkDataSet *input)
Convenience methods to get each of the arrays.
vtkGlyph3DMapper::SetBlockAttributes
virtual void SetBlockAttributes(vtkCompositeDataDisplayAttributes *attr)
When the input data object (not the source) is composite data, it is possible to control visibility a...
vtkX3D::index
@ index
Definition: vtkX3D.h:252
vtkGlyph3DMapper::Masking
bool Masking
Definition: vtkGlyph3DMapper.h:594
vtkGlyph3DMapper::ArrayIndexes
ArrayIndexes
Definition: vtkGlyph3DMapper.h:156
vtkGlyph3D.h
vtkGlyph3DMapper::GetScaleModeAsString
const char * GetScaleModeAsString()
vtkGlyph3DMapper::SetNumberOfLOD
virtual void SetNumberOfLOD(vtkIdType vtkNotUsed(nb))
Set the number of LOD.
Definition: vtkGlyph3DMapper.h:527
vtkGlyph3DMapper::SetSourceIndexArray
void SetSourceIndexArray(const char *arrayname)
Convenience method to set the array to use as index within the sources.
vtkGlyph3DMapper::UseSourceTableTree
bool UseSourceTableTree
Definition: vtkGlyph3DMapper.h:597