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 "vtkFiltersCoreModule.h" // For export macro
89 #include "vtkPolyDataAlgorithm.h"
90 
91 #define VTK_SCALE_BY_SCALAR 0
92 #define VTK_SCALE_BY_VECTOR 1
93 #define VTK_SCALE_BY_VECTORCOMPONENTS 2
94 #define VTK_DATA_SCALING_OFF 3
95 
96 #define VTK_COLOR_BY_SCALE 0
97 #define VTK_COLOR_BY_SCALAR 1
98 #define VTK_COLOR_BY_VECTOR 2
99 
100 #define VTK_USE_VECTOR 0
101 #define VTK_USE_NORMAL 1
102 #define VTK_VECTOR_ROTATION_OFF 2
103 
104 #define VTK_INDEXING_OFF 0
105 #define VTK_INDEXING_BY_SCALAR 1
106 #define VTK_INDEXING_BY_VECTOR 2
107 
108 class vtkTransform;
109 
111 {
112 public:
114  void PrintSelf(ostream& os, vtkIndent indent);
115 
120  static vtkGlyph3D *New();
121 
126  void SetSourceData(vtkPolyData *pd) {this->SetSourceData(0,pd);};
127 
132  void SetSourceData(int id, vtkPolyData *pd);
133 
135 
138  void SetSourceConnection(int id, vtkAlgorithmOutput* algOutput);
140  {
141  this->SetSourceConnection(0, algOutput);
142  }
144 
146  vtkPolyData *GetSource(int id=0);
147 
149 
150  vtkSetMacro(Scaling,int);
151  vtkBooleanMacro(Scaling,int);
152  vtkGetMacro(Scaling,int);
154 
156 
157  vtkSetMacro(ScaleMode,int);
158  vtkGetMacro(ScaleMode,int);
160  {this->SetScaleMode(VTK_SCALE_BY_SCALAR);};
162  {this->SetScaleMode(VTK_SCALE_BY_VECTOR);};
164  {this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);};
166  {this->SetScaleMode(VTK_DATA_SCALING_OFF);};
167  const char *GetScaleModeAsString();
169 
171 
172  vtkSetMacro(ColorMode,int);
173  vtkGetMacro(ColorMode,int);
175  {this->SetColorMode(VTK_COLOR_BY_SCALE);};
177  {this->SetColorMode(VTK_COLOR_BY_SCALAR);};
179  {this->SetColorMode(VTK_COLOR_BY_VECTOR);};
180  const char *GetColorModeAsString();
182 
184 
185  vtkSetMacro(ScaleFactor,double);
186  vtkGetMacro(ScaleFactor,double);
188 
190 
191  vtkSetVector2Macro(Range,double);
192  vtkGetVectorMacro(Range,double,2);
194 
196 
197  vtkSetMacro(Orient,int);
198  vtkBooleanMacro(Orient,int);
199  vtkGetMacro(Orient,int);
201 
203 
205  vtkSetMacro(Clamping,int);
206  vtkBooleanMacro(Clamping,int);
207  vtkGetMacro(Clamping,int);
209 
211 
212  vtkSetMacro(VectorMode,int);
213  vtkGetMacro(VectorMode,int);
214  void SetVectorModeToUseVector() {this->SetVectorMode(VTK_USE_VECTOR);};
215  void SetVectorModeToUseNormal() {this->SetVectorMode(VTK_USE_NORMAL);};
217  {this->SetVectorMode(VTK_VECTOR_ROTATION_OFF);};
218  const char *GetVectorModeAsString();
220 
222 
228  vtkSetMacro(IndexMode,int);
229  vtkGetMacro(IndexMode,int);
230  void SetIndexModeToScalar() {this->SetIndexMode(VTK_INDEXING_BY_SCALAR);};
231  void SetIndexModeToVector() {this->SetIndexMode(VTK_INDEXING_BY_VECTOR);};
232  void SetIndexModeToOff() {this->SetIndexMode(VTK_INDEXING_OFF);};
233  const char *GetIndexModeAsString();
235 
237 
241  vtkSetMacro(GeneratePointIds,int);
242  vtkGetMacro(GeneratePointIds,int);
243  vtkBooleanMacro(GeneratePointIds,int);
245 
247 
250  vtkSetStringMacro(PointIdsName);
251  vtkGetStringMacro(PointIdsName);
253 
255 
258  vtkSetMacro(FillCellData,int);
259  vtkGetMacro(FillCellData,int);
260  vtkBooleanMacro(FillCellData,int);
262 
265  virtual int IsPointVisible(vtkDataSet*, vtkIdType) {return 1;};
266 
268 
271  void SetSourceTransform(vtkTransform*);
272  vtkGetObjectMacro(SourceTransform, vtkTransform);
274 
276  virtual unsigned long GetMTime();
277 
278 protected:
279  vtkGlyph3D();
280  ~vtkGlyph3D();
281 
284  virtual int FillInputPortInformation(int, vtkInformation *);
285 
286  vtkPolyData* GetSource(int idx, vtkInformationVector *sourceInfo);
287 
289 
292  virtual bool Execute(vtkDataSet* input,
293  vtkInformationVector* sourceVector,
294  vtkPolyData* output);
295  virtual bool Execute(vtkDataSet* input,
296  vtkInformationVector* sourceVector,
297  vtkPolyData* output,
298  vtkDataArray *inSScalars,
299  vtkDataArray *inVectors);
301 
302  vtkPolyData **Source; // Geometry to copy to each point
303  int Scaling; // Determine whether scaling of geometry is performed
304  int ScaleMode; // Scale by scalar value or vector magnitude
305  int ColorMode; // new scalars based on scale, scalar or vector
306  double ScaleFactor; // Scale factor to use to scale geometry
307  double Range[2]; // Range to use to perform scalar scaling
308  int Orient; // boolean controls whether to "orient" data
309  int VectorMode; // Orient/scale via normal or via vector data
310  int Clamping; // whether to clamp scale factor
311  int IndexMode; // what to use to index into glyph table
312  int GeneratePointIds; // produce input points ids for each output point
313  int FillCellData; // whether to fill output cell data
316 
317 private:
318  vtkGlyph3D(const vtkGlyph3D&); // Not implemented.
319  void operator=(const vtkGlyph3D&); // Not implemented.
320 };
321 
323 
324 inline const char *vtkGlyph3D::GetScaleModeAsString(void)
325 {
326  if ( this->ScaleMode == VTK_SCALE_BY_SCALAR )
327  {
328  return "ScaleByScalar";
329  }
330  else if ( this->ScaleMode == VTK_SCALE_BY_VECTOR )
331  {
332  return "ScaleByVector";
333  }
334  else
335  {
336  return "DataScalingOff";
337  }
338 }
340 
342 
343 inline const char *vtkGlyph3D::GetColorModeAsString(void)
344 {
345  if ( this->ColorMode == VTK_COLOR_BY_SCALAR )
346  {
347  return "ColorByScalar";
348  }
349  else if ( this->ColorMode == VTK_COLOR_BY_VECTOR )
350  {
351  return "ColorByVector";
352  }
353  else
354  {
355  return "ColorByScale";
356  }
357 }
359 
361 
362 inline const char *vtkGlyph3D::GetVectorModeAsString(void)
363 {
364  if ( this->VectorMode == VTK_USE_VECTOR)
365  {
366  return "UseVector";
367  }
368  else if ( this->VectorMode == VTK_USE_NORMAL)
369  {
370  return "UseNormal";
371  }
372  else
373  {
374  return "VectorRotationOff";
375  }
376 }
378 
380 
381 inline const char *vtkGlyph3D::GetIndexModeAsString(void)
382 {
383  if ( this->IndexMode == VTK_INDEXING_OFF)
384  {
385  return "IndexingOff";
386  }
387  else if ( this->IndexMode == VTK_INDEXING_BY_SCALAR)
388  {
389  return "IndexingByScalar";
390  }
391  else
392  {
393  return "IndexingByVector";
394  }
395 }
397 
398 #endif
void SetScaleModeToScaleByVectorComponents()
Definition: vtkGlyph3D.h:163
#define VTK_USE_NORMAL
Definition: vtkGlyph3D.h:101
const char * GetIndexModeAsString()
Definition: vtkGlyph3D.h:381
void SetSourceData(vtkPolyData *pd)
Definition: vtkGlyph3D.h:126
void SetScaleModeToScaleByVector()
Definition: vtkGlyph3D.h:161
virtual int FillInputPortInformation(int port, vtkInformation *info)
void SetColorModeToColorByScale()
Definition: vtkGlyph3D.h:174
void SetIndexModeToVector()
Definition: vtkGlyph3D.h:231
vtkTransform * SourceTransform
Definition: vtkGlyph3D.h:315
Store vtkAlgorithm input/output information.
#define VTK_SCALE_BY_VECTORCOMPONENTS
Definition: vtkGlyph3D.h:93
abstract class to specify dataset behavior
Definition: vtkDataSet.h:61
void SetScaleModeToScaleByScalar()
Definition: vtkGlyph3D.h:159
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
int ScaleMode
Definition: vtkGlyph3D.h:304
#define VTKFILTERSCORE_EXPORT
int Clamping
Definition: vtkGlyph3D.h:310
const char * GetColorModeAsString()
Definition: vtkGlyph3D.h:343
#define VTK_COLOR_BY_VECTOR
Definition: vtkGlyph3D.h:98
#define VTK_SCALE_BY_SCALAR
Definition: vtkGlyph3D.h:91
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:59
int vtkIdType
Definition: vtkType.h:247
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
#define VTK_SCALE_BY_VECTOR
Definition: vtkGlyph3D.h:92
char * PointIdsName
Definition: vtkGlyph3D.h:314
#define VTK_USE_VECTOR
Definition: vtkGlyph3D.h:100
void SetColorModeToColorByVector()
Definition: vtkGlyph3D.h:178
Proxy object to connect input/output ports.
#define VTK_COLOR_BY_SCALAR
Definition: vtkGlyph3D.h:97
#define VTK_DATA_SCALING_OFF
Definition: vtkGlyph3D.h:94
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:105
void SetIndexModeToScalar()
Definition: vtkGlyph3D.h:230
virtual unsigned long GetMTime()
a simple class to control print indentation
Definition: vtkIndent.h:38
#define VTK_INDEXING_OFF
Definition: vtkGlyph3D.h:104
void SetColorModeToColorByScalar()
Definition: vtkGlyph3D.h:176
void SetVectorModeToUseNormal()
Definition: vtkGlyph3D.h:215
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:110
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
void SetVectorModeToVectorRotationOff()
Definition: vtkGlyph3D.h:216
void SetScaleModeToDataScalingOff()
Definition: vtkGlyph3D.h:165
#define VTK_VECTOR_ROTATION_OFF
Definition: vtkGlyph3D.h:102
const char * GetVectorModeAsString()
Definition: vtkGlyph3D.h:362
const char * GetScaleModeAsString()
Definition: vtkGlyph3D.h:324
virtual int IsPointVisible(vtkDataSet *, vtkIdType)
Definition: vtkGlyph3D.h:265
int IndexMode
Definition: vtkGlyph3D.h:311
int GeneratePointIds
Definition: vtkGlyph3D.h:312
int ColorMode
Definition: vtkGlyph3D.h:305
void SetIndexModeToOff()
Definition: vtkGlyph3D.h:232
int FillCellData
Definition: vtkGlyph3D.h:313
Store zero or more vtkInformation instances.
vtkPolyData ** Source
Definition: vtkGlyph3D.h:302
#define VTK_COLOR_BY_SCALE
Definition: vtkGlyph3D.h:96
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Definition: vtkGlyph3D.h:139
int VectorMode
Definition: vtkGlyph3D.h:309
#define VTK_INDEXING_BY_VECTOR
Definition: vtkGlyph3D.h:106
double ScaleFactor
Definition: vtkGlyph3D.h:306
void SetVectorModeToUseVector()
Definition: vtkGlyph3D.h:214