VTK  9.7.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
22 #ifndef vtkGlyph3DMapper_h
23 #define vtkGlyph3DMapper_h
24 
25 #include "vtkGlyph3D.h" // for the constants (VTK_SCALE_BY_SCALAR, ...).
26 #include "vtkMapper.h"
27 #include "vtkRenderingCoreModule.h" // For export macro
28 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
29 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
30 
31 VTK_ABI_NAMESPACE_BEGIN
33 class vtkDataObjectTree;
34 
35 class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkGlyph3DMapper : public vtkMapper
36 {
37 public:
38  static vtkGlyph3DMapper* New();
39  vtkTypeMacro(vtkGlyph3DMapper, vtkMapper);
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
43  {
44  SCALE = 0,
45  SOURCE_INDEX = 1,
46  MASK = 2,
47  ORIENTATION = 3,
48  SELECTIONID = 4
49  };
50 
56  void SetSourceConnection(int idx, vtkAlgorithmOutput* algOutput);
58  {
59  this->SetSourceConnection(0, algOutput);
60  }
61 
67  void SetInputData(vtkDataObject*);
68 
72  void SetSourceData(int idx, vtkPolyData* pd);
73 
83  void SetSourceTableTree(vtkDataObjectTree* tree);
84 
91  void SetSourceData(vtkPolyData* pd);
92 
96  vtkPolyData* GetSource(int idx = 0);
97 
102  vtkDataObjectTree* GetSourceTableTree();
103 
105 
110  vtkSetMacro(Scaling, bool);
111  vtkBooleanMacro(Scaling, bool);
112  vtkGetMacro(Scaling, bool);
114 
116 
122  vtkSetMacro(ScaleMode, int);
123  vtkGetMacro(ScaleMode, int);
125 
127 
131  vtkSetMacro(ScaleFactor, double);
132  vtkGetMacro(ScaleFactor, double);
134 
136  {
137  NO_DATA_SCALING = 0,
138  SCALE_BY_MAGNITUDE = 1,
139  SCALE_BY_COMPONENTS = 2
140  };
141 
142  void SetScaleModeToScaleByMagnitude() { this->SetScaleMode(SCALE_BY_MAGNITUDE); }
143  void SetScaleModeToScaleByVectorComponents() { this->SetScaleMode(SCALE_BY_COMPONENTS); }
144  void SetScaleModeToNoDataScaling() { this->SetScaleMode(NO_DATA_SCALING); }
145  const char* GetScaleModeAsString();
146 
148 
151  vtkSetVector2Macro(Range, double);
152  vtkGetVectorMacro(Range, double, 2);
154 
156 
161  vtkSetMacro(Orient, bool);
162  vtkGetMacro(Orient, bool);
163  vtkBooleanMacro(Orient, bool);
165 
167 
172  vtkSetClampMacro(OrientationMode, int, DIRECTION, QUATERNION);
173  vtkGetMacro(OrientationMode, int);
174  void SetOrientationModeToDirection() { this->SetOrientationMode(vtkGlyph3DMapper::DIRECTION); }
175  void SetOrientationModeToRotation() { this->SetOrientationMode(vtkGlyph3DMapper::ROTATION); }
176  void SetOrientationModeToQuaternion() { this->SetOrientationMode(vtkGlyph3DMapper::QUATERNION); }
177  const char* GetOrientationModeAsString();
179 
181  {
182  DIRECTION = 0,
183  ROTATION = 1,
184  QUATERNION = 2
185  };
186 
188 
191  vtkSetMacro(Clamping, bool);
192  vtkGetMacro(Clamping, bool);
193  vtkBooleanMacro(Clamping, bool);
195 
197 
203  vtkSetMacro(SourceIndexing, bool);
204  vtkGetMacro(SourceIndexing, bool);
205  vtkBooleanMacro(SourceIndexing, bool);
207 
209 
214  vtkSetMacro(UseSourceTableTree, bool);
215  vtkGetMacro(UseSourceTableTree, bool);
216  vtkBooleanMacro(UseSourceTableTree, bool);
217 
219 
223  vtkSetMacro(UseSelectionIds, bool);
224  vtkBooleanMacro(UseSelectionIds, bool);
225  vtkGetMacro(UseSelectionIds, bool);
227 
231  double* GetBounds() override;
232 
236  void GetBounds(double bounds[6]) override;
237 
241  void Render(vtkRenderer* ren, vtkActor* act) override;
242 
244 
252  vtkSetMacro(Masking, bool);
253  vtkGetMacro(Masking, bool);
254  vtkBooleanMacro(Masking, bool);
256 
263  void SetMaskArray(const char* maskarrayname);
264 
277  void SetMaskArray(int fieldAttributeType);
278 
294  void SetOrientationArray(const char* orientationarrayname);
295 
317  void SetOrientationArray(int fieldAttributeType);
318 
324  void SetScaleArray(const char* scalarsarrayname);
325 
331  void SetScaleArray(int fieldAttributeType);
332 
339  void SetSourceIndexArray(const char* arrayname);
340 
347  void SetSourceIndexArray(int fieldAttributeType);
348 
358  void SetSelectionIdArray(const char* selectionIdArrayName);
359 
369  void SetSelectionIdArray(int fieldAttributeType);
370 
372 
377  vtkSetMacro(SelectionColorId, unsigned int);
378  vtkGetMacro(SelectionColorId, unsigned int);
380 
382 
391  virtual void SetBlockAttributes(vtkCompositeDataDisplayAttributes* attr);
392  vtkGetObjectMacro(BlockAttributes, vtkCompositeDataDisplayAttributes);
394 
396 
400  vtkSetMacro(CullingAndLOD, bool);
401  vtkGetMacro(CullingAndLOD, bool);
402 
409  virtual vtkIdType GetMaxNumberOfLOD();
410 
416  virtual void SetNumberOfLOD(vtkIdType vtkNotUsed(nb)) {}
417 
429  vtkIdType vtkNotUsed(index), float vtkNotUsed(distance), float vtkNotUsed(targetReduction))
430  {
431  }
432 
437  vtkSetMacro(LODColoring, bool);
438  vtkGetMacro(LODColoring, bool);
440 
447  bool GetSupportsSelection() override { return true; }
448 
449 protected:
451  ~vtkGlyph3DMapper() override;
452 
453  virtual int RequestUpdateExtent(
454  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo);
455 
456  int FillInputPortInformation(int port, vtkInformation* info) override;
457 
458  vtkPolyData* GetSource(int idx, vtkInformationVector* sourceInfo);
459  vtkPolyData* GetSourceTable(int idx, vtkInformationVector* sourceInfo);
460 
462 
465  vtkDataArray* GetMaskArray(vtkDataSet* input);
466  vtkDataArray* GetSourceIndexArray(vtkDataSet* input);
467  vtkDataArray* GetOrientationArray(vtkDataSet* input);
468  vtkDataArray* GetScaleArray(vtkDataSet* input);
469  vtkDataArray* GetSelectionIdArray(vtkDataSet* input);
470  vtkUnsignedCharArray* GetColors(vtkDataSet* input);
472 
474  bool Scaling; // Determine whether scaling of geometry is performed
475  double ScaleFactor; // Scale factor to use to scale geometry
476  int ScaleMode; // Scale by scalar value or vector magnitude
477 
478  double Range[2]; // Range to use to perform scalar scaling
479  bool Orient; // boolean controls whether to "orient" data
480  bool Clamping; // whether to clamp scale factor
481  bool SourceIndexing; // Enable/disable indexing into the glyph table
482  bool UseSelectionIds; // Enable/disable custom pick ids
483  bool Masking; // Enable/disable masking.
485 
486  bool UseSourceTableTree; // Map DataObjectTree glyph source into table
487 
488  unsigned int SelectionColorId;
489 
490  bool CullingAndLOD = false; // Disable culling
491  std::vector<std::pair<float, float>> LODs;
492  bool LODColoring = false;
493 
494 private:
495  vtkGlyph3DMapper(const vtkGlyph3DMapper&) = delete;
496  void operator=(const vtkGlyph3DMapper&) = delete;
497 
501  bool GetBoundsInternal(vtkDataSet* ds, double ds_bounds[6]);
502 };
503 
504 VTK_ABI_NAMESPACE_END
505 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:41
provides implementation for most abstract methods in the superclass vtkCompositeDataSet ...
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
Rendering attributes for a multi-block dataset.
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
#define VTK_MARSHAL_EXCLUDE_REASON_IS_REDUNDANT
virtual void SetLODDistanceAndTargetReduction(vtkIdType index, float distance, float targetReduction)
Configure LODs.
abstract specification for renderers
Definition: vtkRenderer.h:63
int vtkIdType
Definition: vtkType.h:363
vtkGlyph3D on the GPU.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
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
virtual void SetNumberOfLOD(vtkIdType nb)
Set the number of LOD.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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:77
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
#define VTK_MARSHALEXCLUDE(reason)
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).
#define VTK_MARSHALAUTO
unsigned int SelectionColorId
void SetOrientationModeToQuaternion()
Orientation mode indicates if the OrientationArray provides the direction vector for the orientation ...
general representation of visualization data
Definition: vtkDataObject.h:55
virtual void Render(vtkRenderer *ren, vtkActor *a)=0
Method initiates the mapping process.
std::vector< std::pair< float, float > > LODs