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 =========================================================================*/
28 #ifndef vtkGlyph3DMapper_h
29 #define vtkGlyph3DMapper_h
30 
31 #include "vtkRenderingCoreModule.h" // For export macro
32 #include "vtkMapper.h"
33 #include "vtkGlyph3D.h" // for the constants (VTK_SCALE_BY_SCALAR, ...).
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  { this->SetSourceConnection(0, algOutput); }
63 
69  void SetInputData(vtkDataObject *);
70 
74  void SetSourceData(int idx, vtkPolyData *pd);
75 
84  void SetSourceTableTree(vtkDataObjectTree *tree);
85 
92  void SetSourceData(vtkPolyData *pd);
93 
97  vtkPolyData *GetSource(int idx = 0);
98 
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 
143  { this->SetScaleMode(SCALE_BY_MAGNITUDE); }
145  { this->SetScaleMode(SCALE_BY_COMPONENTS); }
147  { this->SetScaleMode(NO_DATA_SCALING); }
148  const char *GetScaleModeAsString();
149 
151 
154  vtkSetVector2Macro(Range, double);
155  vtkGetVectorMacro(Range, double, 2);
157 
159 
164  vtkSetMacro(Orient, bool);
165  vtkGetMacro(Orient, bool);
166  vtkBooleanMacro(Orient, bool);
168 
170 
175  vtkSetClampMacro(OrientationMode, int, DIRECTION, QUATERNION);
176  vtkGetMacro(OrientationMode, int);
178  { this->SetOrientationMode(vtkGlyph3DMapper::DIRECTION); }
180  { this->SetOrientationMode(vtkGlyph3DMapper::ROTATION); }
182  { this->SetOrientationMode(vtkGlyph3DMapper::QUATERNION); }
183  const char* GetOrientationModeAsString();
185 
187  {
188  DIRECTION=0,
189  ROTATION=1,
190  QUATERNION=2
191  };
192 
194 
197  vtkSetMacro(Clamping, bool);
198  vtkGetMacro(Clamping, bool);
199  vtkBooleanMacro(Clamping, bool);
201 
203 
209  vtkSetMacro(SourceIndexing, bool);
210  vtkGetMacro(SourceIndexing, bool);
211  vtkBooleanMacro(SourceIndexing, bool);
213 
215 
220  vtkSetMacro(UseSourceTableTree, bool)
221  vtkGetMacro(UseSourceTableTree, bool)
222  vtkBooleanMacro(UseSourceTableTree, bool)
223 
224  //@{
229  vtkSetMacro(UseSelectionIds, bool);
230  vtkBooleanMacro(UseSelectionIds, bool);
231  vtkGetMacro(UseSelectionIds, bool);
233 
237  double *GetBounds() override;
238 
242  void GetBounds(double bounds[6]) override;
243 
247  void Render(vtkRenderer *ren, vtkActor *act) override;
248 
250 
258  vtkSetMacro(Masking, bool);
259  vtkGetMacro(Masking, bool);
260  vtkBooleanMacro(Masking, bool);
262 
269  void SetMaskArray(const char* maskarrayname);
270 
283  void SetMaskArray(int fieldAttributeType);
284 
300  void SetOrientationArray(const char* orientationarrayname);
301 
323  void SetOrientationArray(int fieldAttributeType);
324 
330  void SetScaleArray(const char* scalarsarrayname);
331 
337  void SetScaleArray(int fieldAttributeType);
338 
345  void SetSourceIndexArray(const char* arrayname);
346 
353  void SetSourceIndexArray(int fieldAttributeType);
354 
364  void SetSelectionIdArray(const char* selectionIdArrayName);
365 
375  void SetSelectionIdArray(int fieldAttributeType);
376 
378 
383  vtkSetMacro(SelectionColorId, unsigned int);
384  vtkGetMacro(SelectionColorId, unsigned int);
386 
388 
397  virtual void SetBlockAttributes(vtkCompositeDataDisplayAttributes* attr);
398  vtkGetObjectMacro(BlockAttributes, vtkCompositeDataDisplayAttributes);
400 
402 
406  vtkSetMacro(CullingAndLOD, bool);
407  vtkGetMacro(CullingAndLOD, bool);
408 
415  virtual vtkIdType GetMaxNumberOfLOD();
416 
422  virtual void SetNumberOfLOD(vtkIdType vtkNotUsed(nb)) {}
423 
435  vtkIdType vtkNotUsed(index),
436  float vtkNotUsed(distance),
437  float vtkNotUsed(targetReduction)) {}
438 
443  vtkSetMacro(LODColoring, bool);
444  vtkGetMacro(LODColoring, bool);
446 
453  bool GetSupportsSelection() override
454  { return true; }
455 
456 protected:
458  ~vtkGlyph3DMapper() override;
459 
460  virtual int RequestUpdateExtent(vtkInformation *request,
461  vtkInformationVector **inInfo,
462  vtkInformationVector *outInfo);
463 
464  int FillInputPortInformation(int port, vtkInformation *info) override;
465 
466  vtkPolyData *GetSource(int idx, vtkInformationVector *sourceInfo);
467  vtkPolyData *GetSourceTable(int idx, vtkInformationVector *sourceInfo);
468 
470 
473  vtkDataArray* GetMaskArray(vtkDataSet* input);
474  vtkDataArray* GetSourceIndexArray(vtkDataSet* input);
475  vtkDataArray* GetOrientationArray(vtkDataSet* input);
476  vtkDataArray* GetScaleArray(vtkDataSet* input);
477  vtkDataArray* GetSelectionIdArray(vtkDataSet* input);
478  vtkUnsignedCharArray* GetColors(vtkDataSet* input);
480 
482  bool Scaling; // Determine whether scaling of geometry is performed
483  double ScaleFactor; // Scale factor to use to scale geometry
484  int ScaleMode; // Scale by scalar value or vector magnitude
485 
486  double Range[2]; // Range to use to perform scalar scaling
487  bool Orient; // boolean controls whether to "orient" data
488  bool Clamping; // whether to clamp scale factor
489  bool SourceIndexing; // Enable/disable indexing into the glyph table
490  bool UseSelectionIds; // Enable/disable custom pick ids
491  bool Masking; // Enable/disable masking.
493 
494  bool UseSourceTableTree; // Map DataObjectTree glyph source into table
495 
496  unsigned int SelectionColorId;
497 
498  bool CullingAndLOD = false; // Disable culling
499  std::vector<std::pair<float, float> > LODs;
500  bool LODColoring = false;
501 
502 private:
503  vtkGlyph3DMapper(const vtkGlyph3DMapper&) = delete;
504  void operator=(const vtkGlyph3DMapper&) = delete;
505 
509  bool GetBoundsInternal(vtkDataSet* ds, double ds_bounds[6]);
510 
511 };
512 
513 #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:57
int vtkIdType
Definition: vtkType.h:345
vtkGlyph3D on the GPU.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
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:48
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: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
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:58
virtual void Render(vtkRenderer *ren, vtkActor *a)=0
Method initiates the mapping process.
std::vector< std::pair< float, float > > LODs