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 "vtkMapper.h"
34 #include "vtkGlyph3D.h" // for the constants (VTK_SCALE_BY_SCALAR, ...).
35 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
36 
38 {
39 public:
40  static vtkGlyph3DMapper* New();
41  vtkTypeMacro(vtkGlyph3DMapper, vtkMapper);
42  void PrintSelf(ostream& os, vtkIndent indent);
43  //BTX
45  {
46  SCALE = 0,
47  SOURCE_INDEX = 1,
48  MASK = 2,
49  ORIENTATION = 3
50  };
51  //ETX
52 
54 
57  void SetSourceConnection(int idx, vtkAlgorithmOutput* algOutput);
59  {
60  this->SetSourceConnection(0, algOutput);
61  }
63 
65  void SetSource(int idx, vtkPolyData *pd);
66 
69  void SetSource(vtkPolyData *pd);
70 
72  vtkPolyData *GetSource(int idx=0);
73 
75 
78  vtkSetMacro(Scaling, bool);
79  vtkBooleanMacro(Scaling, bool);
80  vtkGetMacro(Scaling, bool);
82 
84 
88  vtkSetMacro(ScaleMode, int);
89  vtkGetMacro(ScaleMode, int);
91 
93 
95  vtkSetMacro(ScaleFactor,double);
96  vtkGetMacro(ScaleFactor,double);
98 
99  //BTX
101  {
102  NO_DATA_SCALING = 0,
103  SCALE_BY_MAGNITUDE = 1,
104  SCALE_BY_COMPONENTS = 2
105  };
106  //ETX
108  { this->SetScaleMode(SCALE_BY_MAGNITUDE); }
110  { this->SetScaleMode(SCALE_BY_COMPONENTS); }
112  { this->SetScaleMode(NO_DATA_SCALING); }
113  const char *GetScaleModeAsString();
114 
116 
117  vtkSetVector2Macro(Range,double);
118  vtkGetVectorMacro(Range,double,2);
120 
122 
124  vtkSetMacro(Orient, bool);
125  vtkGetMacro(Orient, bool);
126  vtkBooleanMacro(Orient, bool);
128 
130 
133  vtkSetClampMacro(OrientationMode, int, DIRECTION, ROTATION);
134  vtkGetMacro(OrientationMode, int);
136  { this->SetOrientationMode(vtkGlyph3DMapper::DIRECTION); }
138  { this->SetOrientationMode(vtkGlyph3DMapper::ROTATION); }
139  const char* GetOrientationModeAsString();
140  //BTX
142  {
143  DIRECTION=0,
144  ROTATION=1
145  };
146  //ETX
148 
150 
152  vtkSetMacro(Clamping, bool);
153  vtkGetMacro(Clamping, bool);
154  vtkBooleanMacro(Clamping, bool);
156 
158 
163  vtkSetMacro(SourceIndexing, bool);
164  vtkGetMacro(SourceIndexing, bool);
165  vtkBooleanMacro(SourceIndexing, bool);
167 
169  virtual double *GetBounds();
170 
173  virtual void GetBounds(double bounds[6]);
174 
176  virtual void Render(vtkRenderer *ren, vtkActor *act);
177 
179 
184  vtkSetMacro(NestedDisplayLists, bool);
185  vtkGetMacro(NestedDisplayLists, bool);
186  vtkBooleanMacro(NestedDisplayLists, bool);
188 
190 
195  vtkSetMacro(Masking, bool);
196  vtkGetMacro(Masking, bool);
197  vtkBooleanMacro(Masking, bool);
199 
204  void SetMaskArray(const char* maskarrayname);
205 
214  void SetMaskArray(int fieldAttributeType);
215 
229  void SetOrientationArray(const char* orientationarrayname);
230 
247  void SetOrientationArray(int fieldAttributeType);
248 
252  void SetScaleArray(const char* scalarsarrayname);
253 
257  void SetScaleArray(int fieldAttributeType);
258 
263  void SetSourceIndexArray(const char* arrayname);
264 
269  void SetSourceIndexArray(int fieldAttributeType);
270 
272 
275  vtkSetMacro(SelectionColorId,unsigned int);
276  vtkGetMacro(SelectionColorId,unsigned int);
278 
280 
281  vtkSetMacro(SelectMode, int);
283 
285 
289  virtual bool GetSupportsSelection()
290  { return true; }
291  //BTX
292 protected:
294  ~vtkGlyph3DMapper();
296 
297  virtual int RequestUpdateExtent(vtkInformation *request,
298  vtkInformationVector **inInfo,
299  vtkInformationVector *outInfo);
300 
301  virtual int FillInputPortInformation(int port,
303 
304  vtkPolyData *GetSource(int idx, vtkInformationVector *sourceInfo);
305 
307 
308  vtkDataArray* GetMaskArray(vtkDataSet* input);
309  vtkDataArray* GetSourceIndexArray(vtkDataSet* input);
310  vtkDataArray* GetOrientationArray(vtkDataSet* input);
311  vtkDataArray* GetScaleArray(vtkDataSet* input);
312  vtkUnsignedCharArray* GetColors(vtkDataSet* input);
314 
315  bool Scaling; // Determine whether scaling of geometry is performed
316  double ScaleFactor; // Scale factor to use to scale geometry
317  int ScaleMode; // Scale by scalar value or vector magnitude
318 
319  double Range[2]; // Range to use to perform scalar scaling
320  bool Orient; // boolean controls whether to "orient" data
321  bool Clamping; // whether to clamp scale factor
322  bool SourceIndexing; // Enable/disable indexing into the glyph table
323  bool Masking; // Enable/disable masking.
325  bool NestedDisplayLists; // boolean
326 
327  unsigned int SelectionColorId;
329 
330 private:
331  vtkGlyph3DMapper(const vtkGlyph3DMapper&); // Not implemented.
332  void operator=(const vtkGlyph3DMapper&); // Not implemented.
333 
335 
336  bool GetBoundsInternal(vtkDataSet* ds, double ds_bounds[6]);
337  //ETX
338 };
340 
341 #endif