VTK  9.2.5
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 =========================================================================*/
140 #ifndef vtkGlyph3DMapper_h
141 #define vtkGlyph3DMapper_h
142 
143 #include "vtkGlyph3D.h" // for the constants (VTK_SCALE_BY_SCALAR, ...).
144 #include "vtkMapper.h"
145 #include "vtkRenderingCoreModule.h" // For export macro
146 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
147 
149 class vtkDataObjectTree;
150 
151 class VTKRENDERINGCORE_EXPORT vtkGlyph3DMapper : public vtkMapper
152 {
153 public:
155  vtkTypeMacro(vtkGlyph3DMapper, vtkMapper);
156  void PrintSelf(ostream& os, vtkIndent indent) override;
157 
159  {
160  SCALE = 0,
161  SOURCE_INDEX = 1,
162  MASK = 2,
163  ORIENTATION = 3,
164  SELECTIONID = 4
165  };
166 
172  void SetSourceConnection(int idx, vtkAlgorithmOutput* algOutput);
174  {
175  this->SetSourceConnection(0, algOutput);
176  }
177 
184 
188  void SetSourceData(int idx, vtkPolyData* pd);
189 
199 
207 
211  vtkPolyData* GetSource(int idx = 0);
212 
217 
219 
224  vtkSetMacro(Scaling, bool);
225  vtkBooleanMacro(Scaling, bool);
226  vtkGetMacro(Scaling, bool);
228 
230 
236  vtkSetMacro(ScaleMode, int);
237  vtkGetMacro(ScaleMode, int);
239 
241 
245  vtkSetMacro(ScaleFactor, double);
246  vtkGetMacro(ScaleFactor, double);
248 
250  {
251  NO_DATA_SCALING = 0,
252  SCALE_BY_MAGNITUDE = 1,
253  SCALE_BY_COMPONENTS = 2
254  };
255 
256  void SetScaleModeToScaleByMagnitude() { this->SetScaleMode(SCALE_BY_MAGNITUDE); }
257  void SetScaleModeToScaleByVectorComponents() { this->SetScaleMode(SCALE_BY_COMPONENTS); }
258  void SetScaleModeToNoDataScaling() { this->SetScaleMode(NO_DATA_SCALING); }
259  const char* GetScaleModeAsString();
260 
262 
265  vtkSetVector2Macro(Range, double);
266  vtkGetVectorMacro(Range, double, 2);
268 
270 
275  vtkSetMacro(Orient, bool);
276  vtkGetMacro(Orient, bool);
277  vtkBooleanMacro(Orient, bool);
279 
281 
286  vtkSetClampMacro(OrientationMode, int, DIRECTION, QUATERNION);
287  vtkGetMacro(OrientationMode, int);
288  void SetOrientationModeToDirection() { this->SetOrientationMode(vtkGlyph3DMapper::DIRECTION); }
289  void SetOrientationModeToRotation() { this->SetOrientationMode(vtkGlyph3DMapper::ROTATION); }
290  void SetOrientationModeToQuaternion() { this->SetOrientationMode(vtkGlyph3DMapper::QUATERNION); }
293 
295  {
296  DIRECTION = 0,
297  ROTATION = 1,
298  QUATERNION = 2
299  };
300 
302 
305  vtkSetMacro(Clamping, bool);
306  vtkGetMacro(Clamping, bool);
307  vtkBooleanMacro(Clamping, bool);
309 
311 
317  vtkSetMacro(SourceIndexing, bool);
318  vtkGetMacro(SourceIndexing, bool);
319  vtkBooleanMacro(SourceIndexing, bool);
321 
323 
328  vtkSetMacro(UseSourceTableTree, bool);
329  vtkGetMacro(UseSourceTableTree, bool);
330  vtkBooleanMacro(UseSourceTableTree, bool);
331 
333 
337  vtkSetMacro(UseSelectionIds, bool);
338  vtkBooleanMacro(UseSelectionIds, bool);
339  vtkGetMacro(UseSelectionIds, bool);
341 
345  double* GetBounds() override;
346 
350  void GetBounds(double bounds[6]) override;
351 
355  void Render(vtkRenderer* ren, vtkActor* act) override;
356 
358 
366  vtkSetMacro(Masking, bool);
367  vtkGetMacro(Masking, bool);
368  vtkBooleanMacro(Masking, bool);
370 
377  void SetMaskArray(const char* maskarrayname);
378 
391  void SetMaskArray(int fieldAttributeType);
392 
408  void SetOrientationArray(const char* orientationarrayname);
409 
431  void SetOrientationArray(int fieldAttributeType);
432 
438  void SetScaleArray(const char* scalarsarrayname);
439 
445  void SetScaleArray(int fieldAttributeType);
446 
453  void SetSourceIndexArray(const char* arrayname);
454 
461  void SetSourceIndexArray(int fieldAttributeType);
462 
472  void SetSelectionIdArray(const char* selectionIdArrayName);
473 
483  void SetSelectionIdArray(int fieldAttributeType);
484 
486 
491  vtkSetMacro(SelectionColorId, unsigned int);
492  vtkGetMacro(SelectionColorId, unsigned int);
494 
496 
506  vtkGetObjectMacro(BlockAttributes, vtkCompositeDataDisplayAttributes);
508 
510 
514  vtkSetMacro(CullingAndLOD, bool);
515  vtkGetMacro(CullingAndLOD, bool);
516 
524 
530  virtual void SetNumberOfLOD(vtkIdType vtkNotUsed(nb)) {}
531 
543  vtkIdType vtkNotUsed(index), float vtkNotUsed(distance), float vtkNotUsed(targetReduction))
544  {
545  }
546 
551  vtkSetMacro(LODColoring, bool);
552  vtkGetMacro(LODColoring, bool);
554 
561  bool GetSupportsSelection() override { return true; }
562 
563 protected:
565  ~vtkGlyph3DMapper() override;
566 
567  virtual int RequestUpdateExtent(
568  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo);
569 
571 
574 
576 
586 
588  bool Scaling; // Determine whether scaling of geometry is performed
589  double ScaleFactor; // Scale factor to use to scale geometry
590  int ScaleMode; // Scale by scalar value or vector magnitude
591 
592  double Range[2]; // Range to use to perform scalar scaling
593  bool Orient; // boolean controls whether to "orient" data
594  bool Clamping; // whether to clamp scale factor
595  bool SourceIndexing; // Enable/disable indexing into the glyph table
596  bool UseSelectionIds; // Enable/disable custom pick ids
597  bool Masking; // Enable/disable masking.
599 
600  bool UseSourceTableTree; // Map DataObjectTree glyph source into table
601 
602  unsigned int SelectionColorId;
603 
604  bool CullingAndLOD = false; // Disable culling
605  std::vector<std::pair<float, float>> LODs;
606  bool LODColoring = false;
607 
608 private:
609  vtkGlyph3DMapper(const vtkGlyph3DMapper&) = delete;
610  void operator=(const vtkGlyph3DMapper&) = delete;
611 
615  bool GetBoundsInternal(vtkDataSet* ds, double ds_bounds[6]);
616 };
617 
618 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:161
Proxy object to connect input/output ports.
Rendering attributes for a multi-block dataset.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:165
provides implementation for most abstract methods in the superclass vtkCompositeDataSet
general representation of visualization data
abstract class to specify dataset behavior
Definition: vtkDataSet.h:172
vtkGlyph3D on the GPU.
void SetOrientationModeToQuaternion()
Orientation mode indicates if the OrientationArray provides the direction vector for the orientation ...
vtkDataArray * GetSourceIndexArray(vtkDataSet *input)
Convenience methods to get each of the arrays.
vtkPolyData * GetSource(int idx, vtkInformationVector *sourceInfo)
virtual vtkIdType GetMaxNumberOfLOD()
Get the maximum number of LOD.
void SetScaleModeToScaleByVectorComponents()
vtkPolyData * GetSource(int idx=0)
Get a pointer to a source object at a specified table location.
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.
vtkDataArray * GetMaskArray(vtkDataSet *input)
Convenience methods to get each of the arrays.
void SetMaskArray(const char *maskarrayname)
Set the name of the point array to use as a mask for generating the glyphs.
void SetSourceConnection(int idx, vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
void SetScaleModeToScaleByMagnitude()
virtual int RequestUpdateExtent(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
void SetScaleArray(int fieldAttributeType)
Convenience method to set the array to scale with.
void SetSourceIndexArray(const char *arrayname)
Convenience method to set the array to use as index within the sources.
vtkCompositeDataDisplayAttributes * BlockAttributes
void SetInputData(vtkDataObject *)
Assign a data object as input.
vtkDataArray * GetScaleArray(vtkDataSet *input)
Convenience methods to get each of the arrays.
void SetScaleModeToNoDataScaling()
virtual void SetNumberOfLOD(vtkIdType vtkNotUsed(nb))
Set the number of LOD.
vtkDataArray * GetSelectionIdArray(vtkDataSet *input)
Convenience methods to get each of the arrays.
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)
vtkDataArray * GetOrientationArray(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 ...
void SetOrientationModeToDirection()
Orientation mode indicates if the OrientationArray provides the direction vector for the orientation ...
const char * GetScaleModeAsString()
virtual void SetBlockAttributes(vtkCompositeDataDisplayAttributes *attr)
When the input data object (not the source) is composite data, it is possible to control visibility a...
double * GetBounds() override
Redefined to take into account the bounds of the scaled glyphs.
std::vector< std::pair< float, float > > LODs
static vtkGlyph3DMapper * New()
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.
vtkUnsignedCharArray * GetColors(vtkDataSet *input)
Convenience methods to get each of the arrays.
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 ...
vtkPolyData * GetSourceTable(int idx, vtkInformationVector *sourceInfo)
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.
vtkDataObjectTree * GetSourceTableTree()
Convenience method to get the source table tree, if it exists.
virtual void SetLODDistanceAndTargetReduction(vtkIdType vtkNotUsed(index), float vtkNotUsed(distance), float vtkNotUsed(targetReduction))
Configure LODs.
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:177
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
abstract specification for renderers
Definition: vtkRenderer.h:182
dynamic, self-adjusting array of unsigned char
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
@ index
Definition: vtkX3D.h:252
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
int vtkIdType
Definition: vtkType.h:332