VTK  9.0.1
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 =========================================================================*/
28 #ifndef vtkGlyph3DMapper_h
29 #define vtkGlyph3DMapper_h
30 
31 #include "vtkGlyph3D.h" // for the constants (VTK_SCALE_BY_SCALAR, ...).
32 #include "vtkMapper.h"
33 #include "vtkRenderingCoreModule.h" // For export macro
34 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
35 
37 class vtkDataObjectTree;
38 
39 class VTKRENDERINGCORE_EXPORT vtkGlyph3DMapper : public vtkMapper
40 {
41 public:
42  static vtkGlyph3DMapper* New();
43  vtkTypeMacro(vtkGlyph3DMapper, vtkMapper);
44  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
47  {
48  SCALE = 0,
49  SOURCE_INDEX = 1,
50  MASK = 2,
51  ORIENTATION = 3,
52  SELECTIONID = 4
53  };
54 
60  void SetSourceConnection(int idx, vtkAlgorithmOutput* algOutput);
62  {
63  this->SetSourceConnection(0, algOutput);
64  }
65 
71  void SetInputData(vtkDataObject*);
72 
76  void SetSourceData(int idx, vtkPolyData* pd);
77 
86  void SetSourceTableTree(vtkDataObjectTree* tree);
87 
94  void SetSourceData(vtkPolyData* pd);
95 
99  vtkPolyData* GetSource(int idx = 0);
100 
104  vtkDataObjectTree* GetSourceTableTree();
105 
107 
112  vtkSetMacro(Scaling, bool);
113  vtkBooleanMacro(Scaling, bool);
114  vtkGetMacro(Scaling, bool);
116 
118 
124  vtkSetMacro(ScaleMode, int);
125  vtkGetMacro(ScaleMode, int);
127 
129 
133  vtkSetMacro(ScaleFactor, double);
134  vtkGetMacro(ScaleFactor, double);
136 
138  {
139  NO_DATA_SCALING = 0,
140  SCALE_BY_MAGNITUDE = 1,
141  SCALE_BY_COMPONENTS = 2
142  };
143 
144  void SetScaleModeToScaleByMagnitude() { this->SetScaleMode(SCALE_BY_MAGNITUDE); }
145  void SetScaleModeToScaleByVectorComponents() { this->SetScaleMode(SCALE_BY_COMPONENTS); }
146  void SetScaleModeToNoDataScaling() { this->SetScaleMode(NO_DATA_SCALING); }
147  const char* GetScaleModeAsString();
148 
150 
153  vtkSetVector2Macro(Range, double);
154  vtkGetVectorMacro(Range, double, 2);
156 
158 
163  vtkSetMacro(Orient, bool);
164  vtkGetMacro(Orient, bool);
165  vtkBooleanMacro(Orient, bool);
167 
169 
174  vtkSetClampMacro(OrientationMode, int, DIRECTION, QUATERNION);
175  vtkGetMacro(OrientationMode, int);
176  void SetOrientationModeToDirection() { this->SetOrientationMode(vtkGlyph3DMapper::DIRECTION); }
177  void SetOrientationModeToRotation() { this->SetOrientationMode(vtkGlyph3DMapper::ROTATION); }
178  void SetOrientationModeToQuaternion() { this->SetOrientationMode(vtkGlyph3DMapper::QUATERNION); }
179  const char* GetOrientationModeAsString();
181 
183  {
184  DIRECTION = 0,
185  ROTATION = 1,
186  QUATERNION = 2
187  };
188 
190 
193  vtkSetMacro(Clamping, bool);
194  vtkGetMacro(Clamping, bool);
195  vtkBooleanMacro(Clamping, bool);
197 
199 
205  vtkSetMacro(SourceIndexing, bool);
206  vtkGetMacro(SourceIndexing, bool);
207  vtkBooleanMacro(SourceIndexing, bool);
209 
211 
216  vtkSetMacro(UseSourceTableTree, bool);
217  vtkGetMacro(UseSourceTableTree, bool);
218  vtkBooleanMacro(UseSourceTableTree, bool);
219 
221 
225  vtkSetMacro(UseSelectionIds, bool);
226  vtkBooleanMacro(UseSelectionIds, bool);
227  vtkGetMacro(UseSelectionIds, bool);
229 
233  double* GetBounds() override;
234 
238  void GetBounds(double bounds[6]) override;
239 
243  void Render(vtkRenderer* ren, vtkActor* act) override;
244 
246 
254  vtkSetMacro(Masking, bool);
255  vtkGetMacro(Masking, bool);
256  vtkBooleanMacro(Masking, bool);
258 
265  void SetMaskArray(const char* maskarrayname);
266 
279  void SetMaskArray(int fieldAttributeType);
280 
296  void SetOrientationArray(const char* orientationarrayname);
297 
319  void SetOrientationArray(int fieldAttributeType);
320 
326  void SetScaleArray(const char* scalarsarrayname);
327 
333  void SetScaleArray(int fieldAttributeType);
334 
341  void SetSourceIndexArray(const char* arrayname);
342 
349  void SetSourceIndexArray(int fieldAttributeType);
350 
360  void SetSelectionIdArray(const char* selectionIdArrayName);
361 
371  void SetSelectionIdArray(int fieldAttributeType);
372 
374 
379  vtkSetMacro(SelectionColorId, unsigned int);
380  vtkGetMacro(SelectionColorId, unsigned int);
382 
384 
393  virtual void SetBlockAttributes(vtkCompositeDataDisplayAttributes* attr);
394  vtkGetObjectMacro(BlockAttributes, vtkCompositeDataDisplayAttributes);
396 
398 
402  vtkSetMacro(CullingAndLOD, bool);
403  vtkGetMacro(CullingAndLOD, bool);
404 
411  virtual vtkIdType GetMaxNumberOfLOD();
412 
418  virtual void SetNumberOfLOD(vtkIdType vtkNotUsed(nb)) {}
419 
431  vtkIdType vtkNotUsed(index), float vtkNotUsed(distance), float vtkNotUsed(targetReduction))
432  {
433  }
434 
439  vtkSetMacro(LODColoring, bool);
440  vtkGetMacro(LODColoring, bool);
442 
449  bool GetSupportsSelection() override { return true; }
450 
451 protected:
453  ~vtkGlyph3DMapper() override;
454 
455  virtual int RequestUpdateExtent(
456  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo);
457 
458  int FillInputPortInformation(int port, vtkInformation* info) override;
459 
460  vtkPolyData* GetSource(int idx, vtkInformationVector* sourceInfo);
461  vtkPolyData* GetSourceTable(int idx, vtkInformationVector* sourceInfo);
462 
464 
467  vtkDataArray* GetMaskArray(vtkDataSet* input);
468  vtkDataArray* GetSourceIndexArray(vtkDataSet* input);
469  vtkDataArray* GetOrientationArray(vtkDataSet* input);
470  vtkDataArray* GetScaleArray(vtkDataSet* input);
471  vtkDataArray* GetSelectionIdArray(vtkDataSet* input);
472  vtkUnsignedCharArray* GetColors(vtkDataSet* input);
474 
476  bool Scaling; // Determine whether scaling of geometry is performed
477  double ScaleFactor; // Scale factor to use to scale geometry
478  int ScaleMode; // Scale by scalar value or vector magnitude
479 
480  double Range[2]; // Range to use to perform scalar scaling
481  bool Orient; // boolean controls whether to "orient" data
482  bool Clamping; // whether to clamp scale factor
483  bool SourceIndexing; // Enable/disable indexing into the glyph table
484  bool UseSelectionIds; // Enable/disable custom pick ids
485  bool Masking; // Enable/disable masking.
487 
488  bool UseSourceTableTree; // Map DataObjectTree glyph source into table
489 
490  unsigned int SelectionColorId;
491 
492  bool CullingAndLOD = false; // Disable culling
493  std::vector<std::pair<float, float> > LODs;
494  bool LODColoring = false;
495 
496 private:
497  vtkGlyph3DMapper(const vtkGlyph3DMapper&) = delete;
498  void operator=(const vtkGlyph3DMapper&) = delete;
499 
503  bool GetBoundsInternal(vtkDataSet* ds, double ds_bounds[6]);
504 };
505 
506 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
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)
abstract specification for renderers
Definition: vtkRenderer.h:67
int vtkIdType
Definition: vtkType.h:338
vtkGlyph3D on the GPU.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
Proxy object to connect input/output ports.
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:33
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
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:80
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()
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 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:59
virtual void Render(vtkRenderer *ren, vtkActor *a)=0
Method initiates the mapping process.
std::vector< std::pair< float, float > > LODs