VTK
vtkGlyph3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGlyph3D.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 =========================================================================*/
85 #ifndef __vtkGlyph3D_h
86 #define __vtkGlyph3D_h
87 
88 #include "vtkPolyDataAlgorithm.h"
89 
90 #define VTK_SCALE_BY_SCALAR 0
91 #define VTK_SCALE_BY_VECTOR 1
92 #define VTK_SCALE_BY_VECTORCOMPONENTS 2
93 #define VTK_DATA_SCALING_OFF 3
94 
95 #define VTK_COLOR_BY_SCALE 0
96 #define VTK_COLOR_BY_SCALAR 1
97 #define VTK_COLOR_BY_VECTOR 2
98 
99 #define VTK_USE_VECTOR 0
100 #define VTK_USE_NORMAL 1
101 #define VTK_VECTOR_ROTATION_OFF 2
102 
103 #define VTK_INDEXING_OFF 0
104 #define VTK_INDEXING_BY_SCALAR 1
105 #define VTK_INDEXING_BY_VECTOR 2
106 
107 class vtkTransform;
108 
110 {
111 public:
113  void PrintSelf(ostream& os, vtkIndent indent);
114 
119  static vtkGlyph3D *New();
120 
123  void SetSource(vtkPolyData *pd) {this->SetSource(0,pd);};
124 
127  void SetSource(int id, vtkPolyData *pd);
128 
130 
133  void SetSourceConnection(int id, vtkAlgorithmOutput* algOutput);
135  {
136  this->SetSourceConnection(0, algOutput);
137  }
139 
141  vtkPolyData *GetSource(int id=0);
142 
144 
145  vtkSetMacro(Scaling,int);
146  vtkBooleanMacro(Scaling,int);
147  vtkGetMacro(Scaling,int);
149 
151 
152  vtkSetMacro(ScaleMode,int);
153  vtkGetMacro(ScaleMode,int);
155  {this->SetScaleMode(VTK_SCALE_BY_SCALAR);};
157  {this->SetScaleMode(VTK_SCALE_BY_VECTOR);};
159  {this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);};
161  {this->SetScaleMode(VTK_DATA_SCALING_OFF);};
162  const char *GetScaleModeAsString();
164 
166 
167  vtkSetMacro(ColorMode,int);
168  vtkGetMacro(ColorMode,int);
170  {this->SetColorMode(VTK_COLOR_BY_SCALE);};
172  {this->SetColorMode(VTK_COLOR_BY_SCALAR);};
174  {this->SetColorMode(VTK_COLOR_BY_VECTOR);};
175  const char *GetColorModeAsString();
177 
179 
180  vtkSetMacro(ScaleFactor,double);
181  vtkGetMacro(ScaleFactor,double);
183 
185 
186  vtkSetVector2Macro(Range,double);
187  vtkGetVectorMacro(Range,double,2);
189 
191 
192  vtkSetMacro(Orient,int);
193  vtkBooleanMacro(Orient,int);
194  vtkGetMacro(Orient,int);
196 
198 
200  vtkSetMacro(Clamping,int);
201  vtkBooleanMacro(Clamping,int);
202  vtkGetMacro(Clamping,int);
204 
206 
207  vtkSetMacro(VectorMode,int);
208  vtkGetMacro(VectorMode,int);
209  void SetVectorModeToUseVector() {this->SetVectorMode(VTK_USE_VECTOR);};
210  void SetVectorModeToUseNormal() {this->SetVectorMode(VTK_USE_NORMAL);};
212  {this->SetVectorMode(VTK_VECTOR_ROTATION_OFF);};
213  const char *GetVectorModeAsString();
215 
217 
223  vtkSetMacro(IndexMode,int);
224  vtkGetMacro(IndexMode,int);
225  void SetIndexModeToScalar() {this->SetIndexMode(VTK_INDEXING_BY_SCALAR);};
226  void SetIndexModeToVector() {this->SetIndexMode(VTK_INDEXING_BY_VECTOR);};
227  void SetIndexModeToOff() {this->SetIndexMode(VTK_INDEXING_OFF);};
228  const char *GetIndexModeAsString();
230 
232 
236  vtkSetMacro(GeneratePointIds,int);
237  vtkGetMacro(GeneratePointIds,int);
238  vtkBooleanMacro(GeneratePointIds,int);
240 
242 
245  vtkSetStringMacro(PointIdsName);
246  vtkGetStringMacro(PointIdsName);
248 
250 
253  vtkSetMacro(FillCellData,int);
254  vtkGetMacro(FillCellData,int);
255  vtkBooleanMacro(FillCellData,int);
257 
260  virtual int IsPointVisible(vtkDataSet*, vtkIdType) {return 1;};
261 
263 
266  void SetSourceTransform(vtkTransform*);
267  vtkGetObjectMacro(SourceTransform, vtkTransform);
269 
271  virtual unsigned long GetMTime();
272 
273 protected:
274  vtkGlyph3D();
275  ~vtkGlyph3D();
276 
279  virtual int FillInputPortInformation(int, vtkInformation *);
280 
281  vtkPolyData* GetSource(int idx, vtkInformationVector *sourceInfo);
282 
283  vtkPolyData **Source; // Geometry to copy to each point
284  int Scaling; // Determine whether scaling of geometry is performed
285  int ScaleMode; // Scale by scalar value or vector magnitude
286  int ColorMode; // new scalars based on scale, scalar or vector
287  double ScaleFactor; // Scale factor to use to scale geometry
288  double Range[2]; // Range to use to perform scalar scaling
289  int Orient; // boolean controls whether to "orient" data
290  int VectorMode; // Orient/scale via normal or via vector data
291  int Clamping; // whether to clamp scale factor
292  int IndexMode; // what to use to index into glyph table
293  int GeneratePointIds; // produce input points ids for each output point
294  int FillCellData; // whether to fill output cell data
297 
298 private:
299  vtkGlyph3D(const vtkGlyph3D&); // Not implemented.
300  void operator=(const vtkGlyph3D&); // Not implemented.
301 };
302 
304 
305 inline const char *vtkGlyph3D::GetScaleModeAsString(void)
306 {
307  if ( this->ScaleMode == VTK_SCALE_BY_SCALAR )
308  {
309  return "ScaleByScalar";
310  }
311  else if ( this->ScaleMode == VTK_SCALE_BY_VECTOR )
312  {
313  return "ScaleByVector";
314  }
315  else
316  {
317  return "DataScalingOff";
318  }
319 }
321 
323 
324 inline const char *vtkGlyph3D::GetColorModeAsString(void)
325 {
326  if ( this->ColorMode == VTK_COLOR_BY_SCALAR )
327  {
328  return "ColorByScalar";
329  }
330  else if ( this->ColorMode == VTK_COLOR_BY_VECTOR )
331  {
332  return "ColorByVector";
333  }
334  else
335  {
336  return "ColorByScale";
337  }
338 }
340 
342 
343 inline const char *vtkGlyph3D::GetVectorModeAsString(void)
344 {
345  if ( this->VectorMode == VTK_USE_VECTOR)
346  {
347  return "UseVector";
348  }
349  else if ( this->VectorMode == VTK_USE_NORMAL)
350  {
351  return "UseNormal";
352  }
353  else
354  {
355  return "VectorRotationOff";
356  }
357 }
359 
361 
362 inline const char *vtkGlyph3D::GetIndexModeAsString(void)
363 {
364  if ( this->IndexMode == VTK_INDEXING_OFF)
365  {
366  return "IndexingOff";
367  }
368  else if ( this->IndexMode == VTK_INDEXING_BY_SCALAR)
369  {
370  return "IndexingByScalar";
371  }
372  else
373  {
374  return "IndexingByVector";
375  }
376 }
378 
379 #endif
void SetScaleModeToScaleByVectorComponents()
Definition: vtkGlyph3D.h:158
#define VTK_USE_NORMAL
Definition: vtkGlyph3D.h:100
const char * GetIndexModeAsString()
Definition: vtkGlyph3D.h:362
#define VTK_GRAPHICS_EXPORT
void SetScaleModeToScaleByVector()
Definition: vtkGlyph3D.h:156
virtual int FillInputPortInformation(int port, vtkInformation *info)
void SetColorModeToColorByScale()
Definition: vtkGlyph3D.h:169
void SetIndexModeToVector()
Definition: vtkGlyph3D.h:226
vtkTransform * SourceTransform
Definition: vtkGlyph3D.h:296
Store vtkAlgorithm input/output information.
#define VTK_SCALE_BY_VECTORCOMPONENTS
Definition: vtkGlyph3D.h:92
abstract class to specify dataset behavior
Definition: vtkDataSet.h:58
void SetScaleModeToScaleByScalar()
Definition: vtkGlyph3D.h:154
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
int ScaleMode
Definition: vtkGlyph3D.h:285
int Clamping
Definition: vtkGlyph3D.h:291
const char * GetColorModeAsString()
Definition: vtkGlyph3D.h:324
#define VTK_COLOR_BY_VECTOR
Definition: vtkGlyph3D.h:97
#define VTK_SCALE_BY_SCALAR
Definition: vtkGlyph3D.h:90
void SetSource(vtkPolyData *pd)
Definition: vtkGlyph3D.h:123
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:58
int vtkIdType
Definition: vtkType.h:255
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:81
#define VTK_SCALE_BY_VECTOR
Definition: vtkGlyph3D.h:91
char * PointIdsName
Definition: vtkGlyph3D.h:295
#define VTK_USE_VECTOR
Definition: vtkGlyph3D.h:99
void SetColorModeToColorByVector()
Definition: vtkGlyph3D.h:173
Proxy object to connect input/output ports.
#define VTK_COLOR_BY_SCALAR
Definition: vtkGlyph3D.h:96
#define VTK_DATA_SCALING_OFF
Definition: vtkGlyph3D.h:93
static vtkPolyDataAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent)
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Superclass for algorithms that produce only polydata as output.
#define VTK_INDEXING_BY_SCALAR
Definition: vtkGlyph3D.h:104
void SetIndexModeToScalar()
Definition: vtkGlyph3D.h:225
virtual unsigned long GetMTime()
a simple class to control print indentation
Definition: vtkIndent.h:37
#define VTK_INDEXING_OFF
Definition: vtkGlyph3D.h:103
void SetColorModeToColorByScalar()
Definition: vtkGlyph3D.h:171
void SetVectorModeToUseNormal()
Definition: vtkGlyph3D.h:210
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:109
void SetVectorModeToVectorRotationOff()
Definition: vtkGlyph3D.h:211
void SetScaleModeToDataScalingOff()
Definition: vtkGlyph3D.h:160
#define VTK_VECTOR_ROTATION_OFF
Definition: vtkGlyph3D.h:101
const char * GetVectorModeAsString()
Definition: vtkGlyph3D.h:343
const char * GetScaleModeAsString()
Definition: vtkGlyph3D.h:305
virtual int IsPointVisible(vtkDataSet *, vtkIdType)
Definition: vtkGlyph3D.h:260
int IndexMode
Definition: vtkGlyph3D.h:292
int GeneratePointIds
Definition: vtkGlyph3D.h:293
int ColorMode
Definition: vtkGlyph3D.h:286
void SetIndexModeToOff()
Definition: vtkGlyph3D.h:227
int FillCellData
Definition: vtkGlyph3D.h:294
Store zero or more vtkInformation instances.
vtkPolyData ** Source
Definition: vtkGlyph3D.h:283
#define VTK_COLOR_BY_SCALE
Definition: vtkGlyph3D.h:95
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Definition: vtkGlyph3D.h:134
int VectorMode
Definition: vtkGlyph3D.h:290
#define VTK_INDEXING_BY_VECTOR
Definition: vtkGlyph3D.h:105
double ScaleFactor
Definition: vtkGlyph3D.h:287
void SetVectorModeToUseVector()
Definition: vtkGlyph3D.h:209