VTK
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 "vtkRenderingCoreModule.h" // For export macro
35 #include "vtkMapper.h"
36 #include "vtkGlyph3D.h" // for the constants (VTK_SCALE_BY_SCALAR, ...).
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  { this->SetSourceConnection(0, algOutput); }
66 
72  void SetInputData(vtkDataObject *);
73 
77  void SetSourceData(int idx, vtkPolyData *pd);
78 
87  void SetSourceTableTree(vtkDataObjectTree *tree);
88 
95  void SetSourceData(vtkPolyData *pd);
96 
100  vtkPolyData *GetSource(int idx = 0);
101 
105  vtkDataObjectTree* GetSourceTableTree();
106 
108 
113  vtkSetMacro(Scaling, bool);
114  vtkBooleanMacro(Scaling, bool);
115  vtkGetMacro(Scaling, bool);
117 
119 
125  vtkSetMacro(ScaleMode, int);
126  vtkGetMacro(ScaleMode, int);
128 
130 
134  vtkSetMacro(ScaleFactor, double);
135  vtkGetMacro(ScaleFactor, double);
137 
139  {
140  NO_DATA_SCALING = 0,
141  SCALE_BY_MAGNITUDE = 1,
142  SCALE_BY_COMPONENTS = 2
143  };
144 
146  { this->SetScaleMode(SCALE_BY_MAGNITUDE); }
148  { this->SetScaleMode(SCALE_BY_COMPONENTS); }
150  { this->SetScaleMode(NO_DATA_SCALING); }
151  const char *GetScaleModeAsString();
152 
154 
157  vtkSetVector2Macro(Range, double);
158  vtkGetVectorMacro(Range, double, 2);
160 
162 
167  vtkSetMacro(Orient, bool);
168  vtkGetMacro(Orient, bool);
169  vtkBooleanMacro(Orient, bool);
171 
173 
178  vtkSetClampMacro(OrientationMode, int, DIRECTION, QUATERNION);
179  vtkGetMacro(OrientationMode, int);
181  { this->SetOrientationMode(vtkGlyph3DMapper::DIRECTION); }
183  { this->SetOrientationMode(vtkGlyph3DMapper::ROTATION); }
185  { this->SetOrientationMode(vtkGlyph3DMapper::QUATERNION); }
186  const char* GetOrientationModeAsString();
188 
190  {
191  DIRECTION=0,
192  ROTATION=1,
193  QUATERNION=2
194  };
195 
197 
200  vtkSetMacro(Clamping, bool);
201  vtkGetMacro(Clamping, bool);
202  vtkBooleanMacro(Clamping, bool);
204 
206 
212  vtkSetMacro(SourceIndexing, bool);
213  vtkGetMacro(SourceIndexing, bool);
214  vtkBooleanMacro(SourceIndexing, bool);
216 
218 
223  vtkSetMacro(UseSourceTableTree, bool)
224  vtkGetMacro(UseSourceTableTree, bool)
225  vtkBooleanMacro(UseSourceTableTree, bool)
226 
228 
232  vtkSetMacro(UseSelectionIds, bool);
233  vtkBooleanMacro(UseSelectionIds, bool);
234  vtkGetMacro(UseSelectionIds, bool);
236 
240  double *GetBounds() override;
241 
245  void GetBounds(double bounds[6]) override;
246 
250  void Render(vtkRenderer *ren, vtkActor *act) override;
251 
253 
261  vtkSetMacro(Masking, bool);
262  vtkGetMacro(Masking, bool);
263  vtkBooleanMacro(Masking, bool);
265 
272  void SetMaskArray(const char* maskarrayname);
273 
286  void SetMaskArray(int fieldAttributeType);
287 
303  void SetOrientationArray(const char* orientationarrayname);
304 
326  void SetOrientationArray(int fieldAttributeType);
327 
333  void SetScaleArray(const char* scalarsarrayname);
334 
340  void SetScaleArray(int fieldAttributeType);
341 
348  void SetSourceIndexArray(const char* arrayname);
349 
356  void SetSourceIndexArray(int fieldAttributeType);
357 
367  void SetSelectionIdArray(const char* selectionIdArrayName);
368 
378  void SetSelectionIdArray(int fieldAttributeType);
379 
381 
386  vtkSetMacro(SelectionColorId, unsigned int);
387  vtkGetMacro(SelectionColorId, unsigned int);
389 
391 
400  virtual void SetBlockAttributes(vtkCompositeDataDisplayAttributes* attr);
401  vtkGetObjectMacro(BlockAttributes, vtkCompositeDataDisplayAttributes);
403 
405 
409  vtkSetMacro(CullingAndLOD, bool);
410  vtkGetMacro(CullingAndLOD, bool);
411 
418  virtual vtkIdType GetMaxNumberOfLOD();
419 
425  virtual void SetNumberOfLOD(vtkIdType vtkNotUsed(nb)) {}
426 
438  vtkIdType vtkNotUsed(index),
439  float vtkNotUsed(distance),
440  float vtkNotUsed(targetReduction)) {}
441 
446  vtkSetMacro(LODColoring, bool);
447  vtkGetMacro(LODColoring, bool);
449 
456  bool GetSupportsSelection() override
457  { return true; }
458 
459 protected:
461  ~vtkGlyph3DMapper() override;
462 
463  virtual int RequestUpdateExtent(vtkInformation *request,
464  vtkInformationVector **inInfo,
465  vtkInformationVector *outInfo);
466 
467  int FillInputPortInformation(int port, vtkInformation *info) override;
468 
469  vtkPolyData *GetSource(int idx, vtkInformationVector *sourceInfo);
470  vtkPolyData *GetSourceTable(int idx, vtkInformationVector *sourceInfo);
471 
473 
476  vtkDataArray* GetMaskArray(vtkDataSet* input);
477  vtkDataArray* GetSourceIndexArray(vtkDataSet* input);
478  vtkDataArray* GetOrientationArray(vtkDataSet* input);
479  vtkDataArray* GetScaleArray(vtkDataSet* input);
480  vtkDataArray* GetSelectionIdArray(vtkDataSet* input);
481  vtkUnsignedCharArray* GetColors(vtkDataSet* input);
483 
485  bool Scaling; // Determine whether scaling of geometry is performed
486  double ScaleFactor; // Scale factor to use to scale geometry
487  int ScaleMode; // Scale by scalar value or vector magnitude
488 
489  double Range[2]; // Range to use to perform scalar scaling
490  bool Orient; // boolean controls whether to "orient" data
491  bool Clamping; // whether to clamp scale factor
492  bool SourceIndexing; // Enable/disable indexing into the glyph table
493  bool UseSelectionIds; // Enable/disable custom pick ids
494  bool Masking; // Enable/disable masking.
496 
497  bool UseSourceTableTree; // Map DataObjectTree glyph source into table
498 
499  unsigned int SelectionColorId;
500 
501  bool CullingAndLOD = false; // Disable culling
502  std::vector<std::pair<float, float> > LODs;
503  bool LODColoring = false;
504 
505 private:
506  vtkGlyph3DMapper(const vtkGlyph3DMapper&) = delete;
507  void operator=(const vtkGlyph3DMapper&) = delete;
508 
512  bool GetBoundsInternal(vtkDataSet* ds, double ds_bounds[6]);
513 
514 };
515 
516 #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:63
int vtkIdType
Definition: vtkType.h:347
vtkGlyph3D on the GPU.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
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:39
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
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:86
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()
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:64
std::vector< std::pair< float, float > > LODs