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);
296 
297  vtkPolyData **Source; // Geometry to copy to each point
298  int Scaling; // Determine whether scaling of geometry is performed
299  int ScaleMode; // Scale by scalar value or vector magnitude
300  int ColorMode; // new scalars based on scale, scalar or vector
301  double ScaleFactor; // Scale factor to use to scale geometry
302  double Range[2]; // Range to use to perform scalar scaling
303  int Orient; // boolean controls whether to "orient" data
304  int VectorMode; // Orient/scale via normal or via vector data
305  int Clamping; // whether to clamp scale factor
306  int IndexMode; // what to use to index into glyph table
307  int GeneratePointIds; // produce input points ids for each output point
308  int FillCellData; // whether to fill output cell data
311 
312 private:
313  vtkGlyph3D(const vtkGlyph3D&); // Not implemented.
314  void operator=(const vtkGlyph3D&); // Not implemented.
315 };
316 
318 
319 inline const char *vtkGlyph3D::GetScaleModeAsString(void)
320 {
321  if ( this->ScaleMode == VTK_SCALE_BY_SCALAR )
322  {
323  return "ScaleByScalar";
324  }
325  else if ( this->ScaleMode == VTK_SCALE_BY_VECTOR )
326  {
327  return "ScaleByVector";
328  }
329  else
330  {
331  return "DataScalingOff";
332  }
333 }
335 
337 
338 inline const char *vtkGlyph3D::GetColorModeAsString(void)
339 {
340  if ( this->ColorMode == VTK_COLOR_BY_SCALAR )
341  {
342  return "ColorByScalar";
343  }
344  else if ( this->ColorMode == VTK_COLOR_BY_VECTOR )
345  {
346  return "ColorByVector";
347  }
348  else
349  {
350  return "ColorByScale";
351  }
352 }
354 
356 
357 inline const char *vtkGlyph3D::GetVectorModeAsString(void)
358 {
359  if ( this->VectorMode == VTK_USE_VECTOR)
360  {
361  return "UseVector";
362  }
363  else if ( this->VectorMode == VTK_USE_NORMAL)
364  {
365  return "UseNormal";
366  }
367  else
368  {
369  return "VectorRotationOff";
370  }
371 }
373 
375 
376 inline const char *vtkGlyph3D::GetIndexModeAsString(void)
377 {
378  if ( this->IndexMode == VTK_INDEXING_OFF)
379  {
380  return "IndexingOff";
381  }
382  else if ( this->IndexMode == VTK_INDEXING_BY_SCALAR)
383  {
384  return "IndexingByScalar";
385  }
386  else
387  {
388  return "IndexingByVector";
389  }
390 }
392 
393 #endif
void SetScaleModeToScaleByVectorComponents()
Definition: vtkGlyph3D.h:163
#define VTK_USE_NORMAL
Definition: vtkGlyph3D.h:101
const char * GetIndexModeAsString()
Definition: vtkGlyph3D.h:376
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:310
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:299
#define VTKFILTERSCORE_EXPORT
int Clamping
Definition: vtkGlyph3D.h:305
const char * GetColorModeAsString()
Definition: vtkGlyph3D.h:338
#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:275
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
#define VTK_SCALE_BY_VECTOR
Definition: vtkGlyph3D.h:92
char * PointIdsName
Definition: vtkGlyph3D.h:309
#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
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:357
const char * GetScaleModeAsString()
Definition: vtkGlyph3D.h:319
virtual int IsPointVisible(vtkDataSet *, vtkIdType)
Definition: vtkGlyph3D.h:265
int IndexMode
Definition: vtkGlyph3D.h:306
int GeneratePointIds
Definition: vtkGlyph3D.h:307
int ColorMode
Definition: vtkGlyph3D.h:300
void SetIndexModeToOff()
Definition: vtkGlyph3D.h:232
int FillCellData
Definition: vtkGlyph3D.h:308
Store zero or more vtkInformation instances.
vtkPolyData ** Source
Definition: vtkGlyph3D.h:297
#define VTK_COLOR_BY_SCALE
Definition: vtkGlyph3D.h:96
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Definition: vtkGlyph3D.h:139
int VectorMode
Definition: vtkGlyph3D.h:304
#define VTK_INDEXING_BY_VECTOR
Definition: vtkGlyph3D.h:106
double ScaleFactor
Definition: vtkGlyph3D.h:301
void SetVectorModeToUseVector()
Definition: vtkGlyph3D.h:214