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  SELECTIONID = 4
51  };
52  //ETX
53 
55 
58  void SetSourceConnection(int idx, vtkAlgorithmOutput* algOutput);
59  void SetSourceConnection(vtkAlgorithmOutput* algOutput)
60  {
61  this->SetSourceConnection(0, algOutput);
62  }
64 
66  void SetSource(int idx, vtkPolyData *pd);
67 
70  void SetSource(vtkPolyData *pd);
71 
73  vtkPolyData *GetSource(int idx=0);
74 
76 
79  vtkSetMacro(Scaling, bool);
80  vtkBooleanMacro(Scaling, bool);
81  vtkGetMacro(Scaling, bool);
83 
85 
89  vtkSetMacro(ScaleMode, int);
90  vtkGetMacro(ScaleMode, int);
92 
94 
96  vtkSetMacro(ScaleFactor,double);
97  vtkGetMacro(ScaleFactor,double);
99 
100  //BTX
102  {
103  NO_DATA_SCALING = 0,
104  SCALE_BY_MAGNITUDE = 1,
105  SCALE_BY_COMPONENTS = 2
106  };
107  //ETX
108  void SetScaleModeToScaleByMagnitude()
109  { this->SetScaleMode(SCALE_BY_MAGNITUDE); }
110  void SetScaleModeToScaleByVectorComponents()
111  { this->SetScaleMode(SCALE_BY_COMPONENTS); }
112  void SetScaleModeToNoDataScaling()
113  { this->SetScaleMode(NO_DATA_SCALING); }
114  const char *GetScaleModeAsString();
115 
117 
118  vtkSetVector2Macro(Range,double);
119  vtkGetVectorMacro(Range,double,2);
121 
123 
125  vtkSetMacro(Orient, bool);
126  vtkGetMacro(Orient, bool);
127  vtkBooleanMacro(Orient, bool);
129 
131 
134  vtkSetClampMacro(OrientationMode, int, DIRECTION, ROTATION);
135  vtkGetMacro(OrientationMode, int);
136  void SetOrientationModeToDirection()
137  { this->SetOrientationMode(vtkGlyph3DMapper::DIRECTION); }
138  void SetOrientationModeToRotation()
139  { this->SetOrientationMode(vtkGlyph3DMapper::ROTATION); }
140  const char* GetOrientationModeAsString();
141  //BTX
143  {
144  DIRECTION=0,
145  ROTATION=1
146  };
147  //ETX
149 
151 
153  vtkSetMacro(Clamping, bool);
154  vtkGetMacro(Clamping, bool);
155  vtkBooleanMacro(Clamping, bool);
157 
159 
164  vtkSetMacro(SourceIndexing, bool);
165  vtkGetMacro(SourceIndexing, bool);
166  vtkBooleanMacro(SourceIndexing, bool);
168 
170 
172  vtkSetMacro(UseSelectionIds, bool);
173  vtkBooleanMacro(UseSelectionIds, bool);
174  vtkGetMacro(UseSelectionIds, bool);
176 
178  virtual double *GetBounds();
179 
182  virtual void GetBounds(double bounds[6]);
183 
185  virtual void Render(vtkRenderer *ren, vtkActor *act);
186 
188 
193  vtkSetMacro(NestedDisplayLists, bool);
194  vtkGetMacro(NestedDisplayLists, bool);
195  vtkBooleanMacro(NestedDisplayLists, bool);
197 
199 
204  vtkSetMacro(Masking, bool);
205  vtkGetMacro(Masking, bool);
206  vtkBooleanMacro(Masking, bool);
208 
213  void SetMaskArray(const char* maskarrayname);
214 
223  void SetMaskArray(int fieldAttributeType);
224 
238  void SetOrientationArray(const char* orientationarrayname);
239 
256  void SetOrientationArray(int fieldAttributeType);
257 
261  void SetScaleArray(const char* scalarsarrayname);
262 
266  void SetScaleArray(int fieldAttributeType);
267 
272  void SetSourceIndexArray(const char* arrayname);
273 
278  void SetSourceIndexArray(int fieldAttributeType);
279 
285  void SetSelectionIdArray(const char* selectionIdArrayName);
286 
292  void SetSelectionIdArray(int fieldAttributeType);
293 
295 
298  vtkSetMacro(SelectionColorId,unsigned int);
299  vtkGetMacro(SelectionColorId,unsigned int);
301 
303 
304  vtkSetMacro(SelectMode, int);
306 
308 
312  virtual bool GetSupportsSelection()
313  { return true; }
314  //BTX
315 protected:
317  ~vtkGlyph3DMapper();
319 
320  virtual int RequestUpdateExtent(vtkInformation *request,
321  vtkInformationVector **inInfo,
322  vtkInformationVector *outInfo);
323 
324  virtual int FillInputPortInformation(int port,
326 
327  vtkPolyData *GetSource(int idx, vtkInformationVector *sourceInfo);
328 
330 
331  vtkDataArray* GetMaskArray(vtkDataSet* input);
332  vtkDataArray* GetSourceIndexArray(vtkDataSet* input);
333  vtkDataArray* GetOrientationArray(vtkDataSet* input);
334  vtkDataArray* GetScaleArray(vtkDataSet* input);
335  vtkDataArray* GetSelectionIdArray(vtkDataSet* input);
336  vtkUnsignedCharArray* GetColors(vtkDataSet* input);
338 
339  bool Scaling; // Determine whether scaling of geometry is performed
340  double ScaleFactor; // Scale factor to use to scale geometry
341  int ScaleMode; // Scale by scalar value or vector magnitude
342 
343  double Range[2]; // Range to use to perform scalar scaling
344  bool Orient; // boolean controls whether to "orient" data
345  bool Clamping; // whether to clamp scale factor
346  bool SourceIndexing; // Enable/disable indexing into the glyph table
347  bool UseSelectionIds; // Enable/disable custom pick ids
348  bool Masking; // Enable/disable masking.
350  bool NestedDisplayLists; // boolean
351 
352  unsigned int SelectionColorId;
354 
355 private:
356  vtkGlyph3DMapper(const vtkGlyph3DMapper&); // Not implemented.
357  void operator=(const vtkGlyph3DMapper&); // Not implemented.
358 
360 
361  bool GetBoundsInternal(vtkDataSet* ds, double ds_bounds[6]);
362  //ETX
363 };
365 
366 #endif