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 =========================================================================*/
31 #ifndef vtkGlyph3DMapper_h
32 #define vtkGlyph3DMapper_h
33 
34 #include "vtkGlyph3D.h" // for the constants (VTK_SCALE_BY_SCALAR, ...).
35 #include "vtkMapper.h"
36 #include "vtkRenderingCoreModule.h" // For export macro
37 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
38 
40 class vtkDataObjectTree;
41 
42 class VTKRENDERINGCORE_EXPORT vtkGlyph3DMapper : public vtkMapper
43 {
44 public:
45  static vtkGlyph3DMapper* New();
46  vtkTypeMacro(vtkGlyph3DMapper, vtkMapper);
47  void PrintSelf(ostream& os, vtkIndent indent) override;
48 
50  {
51  SCALE = 0,
52  SOURCE_INDEX = 1,
53  MASK = 2,
54  ORIENTATION = 3,
55  SELECTIONID = 4
56  };
57 
63  void SetSourceConnection(int idx, vtkAlgorithmOutput* algOutput);
65  {
66  this->SetSourceConnection(0, algOutput);
67  }
68 
74  void SetInputData(vtkDataObject*);
75 
79  void SetSourceData(int idx, vtkPolyData* pd);
80 
89  void SetSourceTableTree(vtkDataObjectTree* tree);
90 
97  void SetSourceData(vtkPolyData* pd);
98 
102  vtkPolyData* GetSource(int idx = 0);
103 
107  vtkDataObjectTree* GetSourceTableTree();
108 
110 
115  vtkSetMacro(Scaling, bool);
116  vtkBooleanMacro(Scaling, bool);
117  vtkGetMacro(Scaling, bool);
119 
121 
127  vtkSetMacro(ScaleMode, int);
128  vtkGetMacro(ScaleMode, int);
130 
132 
136  vtkSetMacro(ScaleFactor, double);
137  vtkGetMacro(ScaleFactor, double);
139 
141  {
142  NO_DATA_SCALING = 0,
143  SCALE_BY_MAGNITUDE = 1,
144  SCALE_BY_COMPONENTS = 2
145  };
146 
147  void SetScaleModeToScaleByMagnitude() { this->SetScaleMode(SCALE_BY_MAGNITUDE); }
148  void SetScaleModeToScaleByVectorComponents() { this->SetScaleMode(SCALE_BY_COMPONENTS); }
149  void SetScaleModeToNoDataScaling() { this->SetScaleMode(NO_DATA_SCALING); }
150  const char* GetScaleModeAsString();
151 
153 
156  vtkSetVector2Macro(Range, double);
157  vtkGetVectorMacro(Range, double, 2);
159 
161 
166  vtkSetMacro(Orient, bool);
167  vtkGetMacro(Orient, bool);
168  vtkBooleanMacro(Orient, bool);
170 
172 
177  vtkSetClampMacro(OrientationMode, int, DIRECTION, QUATERNION);
178  vtkGetMacro(OrientationMode, int);
179  void SetOrientationModeToDirection() { this->SetOrientationMode(vtkGlyph3DMapper::DIRECTION); }
180  void SetOrientationModeToRotation() { this->SetOrientationMode(vtkGlyph3DMapper::ROTATION); }
181  void SetOrientationModeToQuaternion() { this->SetOrientationMode(vtkGlyph3DMapper::QUATERNION); }
182  const char* GetOrientationModeAsString();
184 
186  {
187  DIRECTION = 0,
188  ROTATION = 1,
189  QUATERNION = 2
190  };
191 
193 
196  vtkSetMacro(Clamping, bool);
197  vtkGetMacro(Clamping, bool);
198  vtkBooleanMacro(Clamping, bool);
200 
202 
208  vtkSetMacro(SourceIndexing, bool);
209  vtkGetMacro(SourceIndexing, bool);
210  vtkBooleanMacro(SourceIndexing, bool);
212 
214 
219  vtkSetMacro(UseSourceTableTree, bool);
220  vtkGetMacro(UseSourceTableTree, bool);
221  vtkBooleanMacro(UseSourceTableTree, bool);
222 
224 
228  vtkSetMacro(UseSelectionIds, bool);
229  vtkBooleanMacro(UseSelectionIds, bool);
230  vtkGetMacro(UseSelectionIds, bool);
232 
236  double* GetBounds() override;
237 
241  void GetBounds(double bounds[6]) override;
242 
246  void Render(vtkRenderer* ren, vtkActor* act) override;
247 
249 
257  vtkSetMacro(Masking, bool);
258  vtkGetMacro(Masking, bool);
259  vtkBooleanMacro(Masking, bool);
261 
268  void SetMaskArray(const char* maskarrayname);
269 
282  void SetMaskArray(int fieldAttributeType);
283 
299  void SetOrientationArray(const char* orientationarrayname);
300 
322  void SetOrientationArray(int fieldAttributeType);
323 
329  void SetScaleArray(const char* scalarsarrayname);
330 
336  void SetScaleArray(int fieldAttributeType);
337 
344  void SetSourceIndexArray(const char* arrayname);
345 
352  void SetSourceIndexArray(int fieldAttributeType);
353 
363  void SetSelectionIdArray(const char* selectionIdArrayName);
364 
374  void SetSelectionIdArray(int fieldAttributeType);
375 
377 
382  vtkSetMacro(SelectionColorId, unsigned int);
383  vtkGetMacro(SelectionColorId, unsigned int);
385 
387 
396  virtual void SetBlockAttributes(vtkCompositeDataDisplayAttributes* attr);
397  vtkGetObjectMacro(BlockAttributes, vtkCompositeDataDisplayAttributes);
399 
401 
405  vtkSetMacro(CullingAndLOD, bool);
406  vtkGetMacro(CullingAndLOD, bool);
407 
414  virtual vtkIdType GetMaxNumberOfLOD();
415 
421  virtual void SetNumberOfLOD(vtkIdType vtkNotUsed(nb)) {}
422 
434  vtkIdType vtkNotUsed(index), float vtkNotUsed(distance), float vtkNotUsed(targetReduction))
435  {
436  }
437 
442  vtkSetMacro(LODColoring, bool);
443  vtkGetMacro(LODColoring, bool);
445 
452  bool GetSupportsSelection() override { return true; }
453 
454 protected:
456  ~vtkGlyph3DMapper() override;
457 
458  virtual int RequestUpdateExtent(
459  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo);
460 
461  int FillInputPortInformation(int port, vtkInformation* info) override;
462 
463  vtkPolyData* GetSource(int idx, vtkInformationVector* sourceInfo);
464  vtkPolyData* GetSourceTable(int idx, vtkInformationVector* sourceInfo);
465 
467 
470  vtkDataArray* GetMaskArray(vtkDataSet* input);
471  vtkDataArray* GetSourceIndexArray(vtkDataSet* input);
472  vtkDataArray* GetOrientationArray(vtkDataSet* input);
473  vtkDataArray* GetScaleArray(vtkDataSet* input);
474  vtkDataArray* GetSelectionIdArray(vtkDataSet* input);
475  vtkUnsignedCharArray* GetColors(vtkDataSet* input);
477 
479  bool Scaling; // Determine whether scaling of geometry is performed
480  double ScaleFactor; // Scale factor to use to scale geometry
481  int ScaleMode; // Scale by scalar value or vector magnitude
482 
483  double Range[2]; // Range to use to perform scalar scaling
484  bool Orient; // boolean controls whether to "orient" data
485  bool Clamping; // whether to clamp scale factor
486  bool SourceIndexing; // Enable/disable indexing into the glyph table
487  bool UseSelectionIds; // Enable/disable custom pick ids
488  bool Masking; // Enable/disable masking.
490 
491  bool UseSourceTableTree; // Map DataObjectTree glyph source into table
492 
493  unsigned int SelectionColorId;
494 
495  bool CullingAndLOD = false; // Disable culling
496  std::vector<std::pair<float, float>> LODs;
497  bool LODColoring = false;
498 
499 private:
500  vtkGlyph3DMapper(const vtkGlyph3DMapper&) = delete;
501  void operator=(const vtkGlyph3DMapper&) = delete;
502 
506  bool GetBoundsInternal(vtkDataSet* ds, double ds_bounds[6]);
507 };
508 
509 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
provides implementation for most abstract methods in the superclass vtkCompositeDataSet ...
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
Rendering attributes for a multi-block dataset.
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
abstract specification for renderers
Definition: vtkRenderer.h:72
int vtkIdType
Definition: vtkType.h:332
vtkGlyph3D on the GPU.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
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:85
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:39
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
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:87
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:65
virtual void Render(vtkRenderer *ren, vtkActor *a)=0
Method initiates the mapping process.
std::vector< std::pair< float, float > > LODs