VTK  9.3.1
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
19 #ifndef vtkGlyph3DMapper_h
20 #define vtkGlyph3DMapper_h
21 
22 #include "vtkGlyph3D.h" // for the constants (VTK_SCALE_BY_SCALAR, ...).
23 #include "vtkMapper.h"
24 #include "vtkRenderingCoreModule.h" // For export macro
25 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
26 
27 VTK_ABI_NAMESPACE_BEGIN
29 class vtkDataObjectTree;
30 
31 class VTKRENDERINGCORE_EXPORT vtkGlyph3DMapper : public vtkMapper
32 {
33 public:
34  static vtkGlyph3DMapper* New();
35  vtkTypeMacro(vtkGlyph3DMapper, vtkMapper);
36  void PrintSelf(ostream& os, vtkIndent indent) override;
37 
39  {
40  SCALE = 0,
41  SOURCE_INDEX = 1,
42  MASK = 2,
43  ORIENTATION = 3,
44  SELECTIONID = 4
45  };
46 
52  void SetSourceConnection(int idx, vtkAlgorithmOutput* algOutput);
54  {
55  this->SetSourceConnection(0, algOutput);
56  }
57 
63  void SetInputData(vtkDataObject*);
64 
68  void SetSourceData(int idx, vtkPolyData* pd);
69 
78  void SetSourceTableTree(vtkDataObjectTree* tree);
79 
86  void SetSourceData(vtkPolyData* pd);
87 
91  vtkPolyData* GetSource(int idx = 0);
92 
96  vtkDataObjectTree* GetSourceTableTree();
97 
99 
104  vtkSetMacro(Scaling, bool);
105  vtkBooleanMacro(Scaling, bool);
106  vtkGetMacro(Scaling, bool);
108 
110 
116  vtkSetMacro(ScaleMode, int);
117  vtkGetMacro(ScaleMode, int);
119 
121 
125  vtkSetMacro(ScaleFactor, double);
126  vtkGetMacro(ScaleFactor, double);
128 
130  {
131  NO_DATA_SCALING = 0,
132  SCALE_BY_MAGNITUDE = 1,
133  SCALE_BY_COMPONENTS = 2
134  };
135 
136  void SetScaleModeToScaleByMagnitude() { this->SetScaleMode(SCALE_BY_MAGNITUDE); }
137  void SetScaleModeToScaleByVectorComponents() { this->SetScaleMode(SCALE_BY_COMPONENTS); }
138  void SetScaleModeToNoDataScaling() { this->SetScaleMode(NO_DATA_SCALING); }
139  const char* GetScaleModeAsString();
140 
142 
145  vtkSetVector2Macro(Range, double);
146  vtkGetVectorMacro(Range, double, 2);
148 
150 
155  vtkSetMacro(Orient, bool);
156  vtkGetMacro(Orient, bool);
157  vtkBooleanMacro(Orient, bool);
159 
161 
166  vtkSetClampMacro(OrientationMode, int, DIRECTION, QUATERNION);
167  vtkGetMacro(OrientationMode, int);
168  void SetOrientationModeToDirection() { this->SetOrientationMode(vtkGlyph3DMapper::DIRECTION); }
169  void SetOrientationModeToRotation() { this->SetOrientationMode(vtkGlyph3DMapper::ROTATION); }
170  void SetOrientationModeToQuaternion() { this->SetOrientationMode(vtkGlyph3DMapper::QUATERNION); }
171  const char* GetOrientationModeAsString();
173 
175  {
176  DIRECTION = 0,
177  ROTATION = 1,
178  QUATERNION = 2
179  };
180 
182 
185  vtkSetMacro(Clamping, bool);
186  vtkGetMacro(Clamping, bool);
187  vtkBooleanMacro(Clamping, bool);
189 
191 
197  vtkSetMacro(SourceIndexing, bool);
198  vtkGetMacro(SourceIndexing, bool);
199  vtkBooleanMacro(SourceIndexing, bool);
201 
203 
208  vtkSetMacro(UseSourceTableTree, bool);
209  vtkGetMacro(UseSourceTableTree, bool);
210  vtkBooleanMacro(UseSourceTableTree, bool);
211 
213 
217  vtkSetMacro(UseSelectionIds, bool);
218  vtkBooleanMacro(UseSelectionIds, bool);
219  vtkGetMacro(UseSelectionIds, bool);
221 
225  double* GetBounds() override;
226 
230  void GetBounds(double bounds[6]) override;
231 
235  void Render(vtkRenderer* ren, vtkActor* act) override;
236 
238 
246  vtkSetMacro(Masking, bool);
247  vtkGetMacro(Masking, bool);
248  vtkBooleanMacro(Masking, bool);
250 
257  void SetMaskArray(const char* maskarrayname);
258 
271  void SetMaskArray(int fieldAttributeType);
272 
288  void SetOrientationArray(const char* orientationarrayname);
289 
311  void SetOrientationArray(int fieldAttributeType);
312 
318  void SetScaleArray(const char* scalarsarrayname);
319 
325  void SetScaleArray(int fieldAttributeType);
326 
333  void SetSourceIndexArray(const char* arrayname);
334 
341  void SetSourceIndexArray(int fieldAttributeType);
342 
352  void SetSelectionIdArray(const char* selectionIdArrayName);
353 
363  void SetSelectionIdArray(int fieldAttributeType);
364 
366 
371  vtkSetMacro(SelectionColorId, unsigned int);
372  vtkGetMacro(SelectionColorId, unsigned int);
374 
376 
385  virtual void SetBlockAttributes(vtkCompositeDataDisplayAttributes* attr);
386  vtkGetObjectMacro(BlockAttributes, vtkCompositeDataDisplayAttributes);
388 
390 
394  vtkSetMacro(CullingAndLOD, bool);
395  vtkGetMacro(CullingAndLOD, bool);
396 
403  virtual vtkIdType GetMaxNumberOfLOD();
404 
410  virtual void SetNumberOfLOD(vtkIdType vtkNotUsed(nb)) {}
411 
423  vtkIdType vtkNotUsed(index), float vtkNotUsed(distance), float vtkNotUsed(targetReduction))
424  {
425  }
426 
431  vtkSetMacro(LODColoring, bool);
432  vtkGetMacro(LODColoring, bool);
434 
441  bool GetSupportsSelection() override { return true; }
442 
443 protected:
445  ~vtkGlyph3DMapper() override;
446 
447  virtual int RequestUpdateExtent(
448  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo);
449 
450  int FillInputPortInformation(int port, vtkInformation* info) override;
451 
452  vtkPolyData* GetSource(int idx, vtkInformationVector* sourceInfo);
453  vtkPolyData* GetSourceTable(int idx, vtkInformationVector* sourceInfo);
454 
456 
459  vtkDataArray* GetMaskArray(vtkDataSet* input);
460  vtkDataArray* GetSourceIndexArray(vtkDataSet* input);
461  vtkDataArray* GetOrientationArray(vtkDataSet* input);
462  vtkDataArray* GetScaleArray(vtkDataSet* input);
463  vtkDataArray* GetSelectionIdArray(vtkDataSet* input);
464  vtkUnsignedCharArray* GetColors(vtkDataSet* input);
466 
468  bool Scaling; // Determine whether scaling of geometry is performed
469  double ScaleFactor; // Scale factor to use to scale geometry
470  int ScaleMode; // Scale by scalar value or vector magnitude
471 
472  double Range[2]; // Range to use to perform scalar scaling
473  bool Orient; // boolean controls whether to "orient" data
474  bool Clamping; // whether to clamp scale factor
475  bool SourceIndexing; // Enable/disable indexing into the glyph table
476  bool UseSelectionIds; // Enable/disable custom pick ids
477  bool Masking; // Enable/disable masking.
479 
480  bool UseSourceTableTree; // Map DataObjectTree glyph source into table
481 
482  unsigned int SelectionColorId;
483 
484  bool CullingAndLOD = false; // Disable culling
485  std::vector<std::pair<float, float>> LODs;
486  bool LODColoring = false;
487 
488 private:
489  vtkGlyph3DMapper(const vtkGlyph3DMapper&) = delete;
490  void operator=(const vtkGlyph3DMapper&) = delete;
491 
495  bool GetBoundsInternal(vtkDataSet* ds, double ds_bounds[6]);
496 };
497 
498 VTK_ABI_NAMESPACE_END
499 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:40
provides implementation for most abstract methods in the superclass vtkCompositeDataSet ...
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:52
Rendering attributes for a multi-block dataset.
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
abstract specification for renderers
Definition: vtkRenderer.h:61
int vtkIdType
Definition: vtkType.h:315
vtkGlyph3D on the GPU.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
Proxy object to connect input/output ports.
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:74
void SetOrientationModeToDirection()
Orientation mode indicates if the OrientationArray provides the direction vector for the orientation ...
void SetOrientationModeToRotation()
Orientation mode indicates if the OrientationArray provides the direction vector for the orientation ...
void SetScaleModeToScaleByVectorComponents()
a simple class to control print indentation
Definition: vtkIndent.h:28
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void SetNumberOfLOD(vtkIdType vtkNotUsed(nb))
Set the number of LOD.
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:76
bool GetSupportsSelection() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
dynamic, self-adjusting array of unsigned char
vtkCompositeDataDisplayAttributes * BlockAttributes
void SetScaleModeToNoDataScaling()
void SetScaleModeToScaleByMagnitude()
Store zero or more vtkInformation instances.
static vtkAlgorithm * New()
double * GetBounds() override
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax, zmin,zmax).
unsigned int SelectionColorId
void SetOrientationModeToQuaternion()
Orientation mode indicates if the OrientationArray provides the direction vector for the orientation ...
virtual void SetLODDistanceAndTargetReduction(vtkIdType vtkNotUsed(index), float vtkNotUsed(distance), float vtkNotUsed(targetReduction))
Configure LODs.
general representation of visualization data
Definition: vtkDataObject.h:54
virtual void Render(vtkRenderer *ren, vtkActor *a)=0
Method initiates the mapping process.
std::vector< std::pair< float, float > > LODs