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 =========================================================================*/
30 #ifndef __vtkGlyph3DMapper_h
31 #define __vtkGlyph3DMapper_h
32 
33 #include "vtkRenderingCoreModule.h" // For export macro
34 #include "vtkMapper.h"
35 #include "vtkGlyph3D.h" // for the constants (VTK_SCALE_BY_SCALAR, ...).
36 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
37 
38 class VTKRENDERINGCORE_EXPORT vtkGlyph3DMapper : public vtkMapper
39 {
40 public:
41  static vtkGlyph3DMapper* New();
42  vtkTypeMacro(vtkGlyph3DMapper, vtkMapper);
43  void PrintSelf(ostream& os, vtkIndent indent);
44  //BTX
46  {
47  SCALE = 0,
48  SOURCE_INDEX = 1,
49  MASK = 2,
50  ORIENTATION = 3,
51  SELECTIONID = 4
52  };
53  //ETX
54 
56 
59  void SetSourceConnection(int idx, vtkAlgorithmOutput* algOutput);
60  void SetSourceConnection(vtkAlgorithmOutput* algOutput)
61  {
62  this->SetSourceConnection(0, algOutput);
63  }
65 
69  void SetInputData(vtkDataObject *);
70 
72  void SetSourceData(int idx, vtkPolyData *pd);
73 
76  void SetSourceData(vtkPolyData *pd);
77 
79  vtkPolyData *GetSource(int idx=0);
80 
82 
85  vtkSetMacro(Scaling, bool);
86  vtkBooleanMacro(Scaling, bool);
87  vtkGetMacro(Scaling, bool);
89 
91 
95  vtkSetMacro(ScaleMode, int);
96  vtkGetMacro(ScaleMode, int);
98 
100 
102  vtkSetMacro(ScaleFactor,double);
103  vtkGetMacro(ScaleFactor,double);
105 
106  //BTX
108  {
109  NO_DATA_SCALING = 0,
110  SCALE_BY_MAGNITUDE = 1,
111  SCALE_BY_COMPONENTS = 2
112  };
113  //ETX
114  void SetScaleModeToScaleByMagnitude()
115  { this->SetScaleMode(SCALE_BY_MAGNITUDE); }
116  void SetScaleModeToScaleByVectorComponents()
117  { this->SetScaleMode(SCALE_BY_COMPONENTS); }
118  void SetScaleModeToNoDataScaling()
119  { this->SetScaleMode(NO_DATA_SCALING); }
120  const char *GetScaleModeAsString();
121 
123 
124  vtkSetVector2Macro(Range,double);
125  vtkGetVectorMacro(Range,double,2);
127 
129 
131  vtkSetMacro(Orient, bool);
132  vtkGetMacro(Orient, bool);
133  vtkBooleanMacro(Orient, bool);
135 
137 
140  vtkSetClampMacro(OrientationMode, int, DIRECTION, ROTATION);
141  vtkGetMacro(OrientationMode, int);
142  void SetOrientationModeToDirection()
143  { this->SetOrientationMode(vtkGlyph3DMapper::DIRECTION); }
144  void SetOrientationModeToRotation()
145  { this->SetOrientationMode(vtkGlyph3DMapper::ROTATION); }
146  const char* GetOrientationModeAsString();
147  //BTX
149  {
150  DIRECTION=0,
151  ROTATION=1
152  };
153  //ETX
155 
157 
159  vtkSetMacro(Clamping, bool);
160  vtkGetMacro(Clamping, bool);
161  vtkBooleanMacro(Clamping, bool);
163 
165 
170  vtkSetMacro(SourceIndexing, bool);
171  vtkGetMacro(SourceIndexing, bool);
172  vtkBooleanMacro(SourceIndexing, bool);
174 
176 
178  vtkSetMacro(UseSelectionIds, bool);
179  vtkBooleanMacro(UseSelectionIds, bool);
180  vtkGetMacro(UseSelectionIds, bool);
182 
184  virtual double *GetBounds();
185 
188  virtual void GetBounds(double bounds[6]);
189 
191  virtual void Render(vtkRenderer *ren, vtkActor *act);
192 
194 
199  vtkSetMacro(NestedDisplayLists, bool);
200  vtkGetMacro(NestedDisplayLists, bool);
201  vtkBooleanMacro(NestedDisplayLists, bool);
203 
205 
210  vtkSetMacro(Masking, bool);
211  vtkGetMacro(Masking, bool);
212  vtkBooleanMacro(Masking, bool);
214 
219  void SetMaskArray(const char* maskarrayname);
220 
229  void SetMaskArray(int fieldAttributeType);
230 
244  void SetOrientationArray(const char* orientationarrayname);
245 
262  void SetOrientationArray(int fieldAttributeType);
263 
267  void SetScaleArray(const char* scalarsarrayname);
268 
272  void SetScaleArray(int fieldAttributeType);
273 
278  void SetSourceIndexArray(const char* arrayname);
279 
284  void SetSourceIndexArray(int fieldAttributeType);
285 
291  void SetSelectionIdArray(const char* selectionIdArrayName);
292 
298  void SetSelectionIdArray(int fieldAttributeType);
299 
301 
304  vtkSetMacro(SelectionColorId,unsigned int);
305  vtkGetMacro(SelectionColorId,unsigned int);
307 
309 
310  vtkSetMacro(SelectMode, int);
312 
314 
318  virtual bool GetSupportsSelection()
319  { return true; }
320  //BTX
321 protected:
323  ~vtkGlyph3DMapper();
325 
326  virtual int RequestUpdateExtent(vtkInformation *request,
327  vtkInformationVector **inInfo,
328  vtkInformationVector *outInfo);
329 
330  virtual int FillInputPortInformation(int port,
332 
333  vtkPolyData *GetSource(int idx, vtkInformationVector *sourceInfo);
334 
336 
337  vtkDataArray* GetMaskArray(vtkDataSet* input);
338  vtkDataArray* GetSourceIndexArray(vtkDataSet* input);
339  vtkDataArray* GetOrientationArray(vtkDataSet* input);
340  vtkDataArray* GetScaleArray(vtkDataSet* input);
341  vtkDataArray* GetSelectionIdArray(vtkDataSet* input);
342  vtkUnsignedCharArray* GetColors(vtkDataSet* input);
344 
345  bool Scaling; // Determine whether scaling of geometry is performed
346  double ScaleFactor; // Scale factor to use to scale geometry
347  int ScaleMode; // Scale by scalar value or vector magnitude
348 
349  double Range[2]; // Range to use to perform scalar scaling
350  bool Orient; // boolean controls whether to "orient" data
351  bool Clamping; // whether to clamp scale factor
352  bool SourceIndexing; // Enable/disable indexing into the glyph table
353  bool UseSelectionIds; // Enable/disable custom pick ids
354  bool Masking; // Enable/disable masking.
356  bool NestedDisplayLists; // boolean
357 
358  unsigned int SelectionColorId;
360 
361 private:
362  vtkGlyph3DMapper(const vtkGlyph3DMapper&); // Not implemented.
363  void operator=(const vtkGlyph3DMapper&); // Not implemented.
364 
366 
367  bool GetBoundsInternal(vtkDataSet* ds, double ds_bounds[6]);
368  //ETX
369 };
371 
372 #endif