VTK  9.2.6
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=========================================================================*/
86#ifndef vtkGlyph3D_h
87#define vtkGlyph3D_h
88
89#include "vtkFiltersCoreModule.h" // For export macro
91
92#define VTK_SCALE_BY_SCALAR 0
93#define VTK_SCALE_BY_VECTOR 1
94#define VTK_SCALE_BY_VECTORCOMPONENTS 2
95#define VTK_DATA_SCALING_OFF 3
96
97#define VTK_COLOR_BY_SCALE 0
98#define VTK_COLOR_BY_SCALAR 1
99#define VTK_COLOR_BY_VECTOR 2
100
101#define VTK_USE_VECTOR 0
102#define VTK_USE_NORMAL 1
103#define VTK_VECTOR_ROTATION_OFF 2
104#define VTK_FOLLOW_CAMERA_DIRECTION 3
105
106#define VTK_INDEXING_OFF 0
107#define VTK_INDEXING_BY_SCALAR 1
108#define VTK_INDEXING_BY_VECTOR 2
109
110class vtkTransform;
111
112class VTKFILTERSCORE_EXPORT vtkGlyph3D : public vtkPolyDataAlgorithm
113{
114public:
116 void PrintSelf(ostream& os, vtkIndent indent) override;
117
124 static vtkGlyph3D* New();
125
132 void SetSourceData(vtkPolyData* pd) { this->SetSourceData(0, pd); }
133
140 void SetSourceData(int id, vtkPolyData* pd);
141
143
148 void SetSourceConnection(int id, vtkAlgorithmOutput* algOutput);
150 {
151 this->SetSourceConnection(0, algOutput);
152 }
154
158 vtkPolyData* GetSource(int id = 0);
159
161
164 vtkSetMacro(Scaling, vtkTypeBool);
165 vtkBooleanMacro(Scaling, vtkTypeBool);
166 vtkGetMacro(Scaling, vtkTypeBool);
168
170
173 vtkSetMacro(ScaleMode, int);
174 vtkGetMacro(ScaleMode, int);
175 void SetScaleModeToScaleByScalar() { this->SetScaleMode(VTK_SCALE_BY_SCALAR); }
176 void SetScaleModeToScaleByVector() { this->SetScaleMode(VTK_SCALE_BY_VECTOR); }
178 {
179 this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);
180 }
182 const char* GetScaleModeAsString();
184
186
189 vtkSetMacro(ColorMode, int);
190 vtkGetMacro(ColorMode, int);
191 void SetColorModeToColorByScale() { this->SetColorMode(VTK_COLOR_BY_SCALE); }
192 void SetColorModeToColorByScalar() { this->SetColorMode(VTK_COLOR_BY_SCALAR); }
193 void SetColorModeToColorByVector() { this->SetColorMode(VTK_COLOR_BY_VECTOR); }
194 const char* GetColorModeAsString();
196
198
201 vtkSetMacro(ScaleFactor, double);
202 vtkGetMacro(ScaleFactor, double);
204
206
209 vtkSetVector2Macro(Range, double);
210 vtkGetVectorMacro(Range, double, 2);
212
214
217 vtkSetMacro(Orient, vtkTypeBool);
218 vtkBooleanMacro(Orient, vtkTypeBool);
219 vtkGetMacro(Orient, vtkTypeBool);
221
223
227 vtkSetMacro(Clamping, vtkTypeBool);
228 vtkBooleanMacro(Clamping, vtkTypeBool);
229 vtkGetMacro(Clamping, vtkTypeBool);
231
233
236 vtkSetMacro(VectorMode, int);
237 vtkGetMacro(VectorMode, int);
238 void SetVectorModeToUseVector() { this->SetVectorMode(VTK_USE_VECTOR); }
239 void SetVectorModeToUseNormal() { this->SetVectorMode(VTK_USE_NORMAL); }
242 const char* GetVectorModeAsString();
244
246
250 vtkSetVectorMacro(FollowedCameraPosition, double, 3);
251 vtkGetVectorMacro(FollowedCameraPosition, double, 3);
253
255
258 vtkSetVectorMacro(FollowedCameraViewUp, double, 3);
259 vtkGetVectorMacro(FollowedCameraViewUp, double, 3);
261
263
270 vtkSetMacro(IndexMode, int);
271 vtkGetMacro(IndexMode, int);
272 void SetIndexModeToScalar() { this->SetIndexMode(VTK_INDEXING_BY_SCALAR); }
273 void SetIndexModeToVector() { this->SetIndexMode(VTK_INDEXING_BY_VECTOR); }
274 void SetIndexModeToOff() { this->SetIndexMode(VTK_INDEXING_OFF); }
275 const char* GetIndexModeAsString();
277
279
285 vtkSetMacro(GeneratePointIds, vtkTypeBool);
286 vtkGetMacro(GeneratePointIds, vtkTypeBool);
287 vtkBooleanMacro(GeneratePointIds, vtkTypeBool);
289
291
295 vtkSetStringMacro(PointIdsName);
296 vtkGetStringMacro(PointIdsName);
298
300
305 vtkSetMacro(FillCellData, vtkTypeBool);
306 vtkGetMacro(FillCellData, vtkTypeBool);
307 vtkBooleanMacro(FillCellData, vtkTypeBool);
309
314 virtual int IsPointVisible(vtkDataSet*, vtkIdType) { return 1; }
315
317
323 vtkGetObjectMacro(SourceTransform, vtkTransform);
325
330
332
337 vtkSetMacro(OutputPointsPrecision, int);
338 vtkGetMacro(OutputPointsPrecision, int);
340
341protected:
343 ~vtkGlyph3D() override;
344
348
350
352
357 virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output);
358 virtual bool Execute(vtkDataSet* input, vtkInformationVector* sourceVector, vtkPolyData* output,
359 vtkDataArray* inSScalars, vtkDataArray* inVectors);
361
362 vtkPolyData** Source; // Geometry to copy to each point
363 vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
364 int ScaleMode; // Scale by scalar value or vector magnitude
365 int ColorMode; // new scalars based on scale, scalar or vector
366 double ScaleFactor; // Scale factor to use to scale geometry
367 double Range[2]; // Range to use to perform scalar scaling
368 int Orient; // boolean controls whether to "orient" data
369 int VectorMode; // Orient/scale via normal or via vector data
370 double
371 FollowedCameraPosition[3]; // glyphs face towards this point in VTK_FOLLOW_CAMERA_DIRECTION mode
372 double FollowedCameraViewUp[3]; // glyph up direction in VTK_FOLLOW_CAMERA_DIRECTION mode
373 vtkTypeBool Clamping; // whether to clamp scale factor
374 int IndexMode; // what to use to index into glyph table
375 vtkTypeBool GeneratePointIds; // produce input points ids for each output point
376 vtkTypeBool FillCellData; // whether to fill output cell data
380
381private:
382 vtkGlyph3D(const vtkGlyph3D&) = delete;
383 void operator=(const vtkGlyph3D&) = delete;
384};
385
390{
391 if (this->ScaleMode == VTK_SCALE_BY_SCALAR)
392 {
393 return "ScaleByScalar";
394 }
395 else if (this->ScaleMode == VTK_SCALE_BY_VECTOR)
396 {
397 return "ScaleByVector";
398 }
399 else
400 {
401 return "DataScalingOff";
402 }
403}
404
409{
410 if (this->ColorMode == VTK_COLOR_BY_SCALAR)
411 {
412 return "ColorByScalar";
413 }
414 else if (this->ColorMode == VTK_COLOR_BY_VECTOR)
415 {
416 return "ColorByVector";
417 }
418 else
419 {
420 return "ColorByScale";
421 }
422}
423
428{
429 if (this->VectorMode == VTK_USE_VECTOR)
430 {
431 return "UseVector";
432 }
433 else if (this->VectorMode == VTK_USE_NORMAL)
434 {
435 return "UseNormal";
436 }
437 else if (this->VectorMode == VTK_FOLLOW_CAMERA_DIRECTION)
438 {
439 return "FollowCameraDirection";
440 }
441 else
442 {
443 return "VectorRotationOff";
444 }
445}
446
451{
452 if (this->IndexMode == VTK_INDEXING_OFF)
453 {
454 return "IndexingOff";
455 }
456 else if (this->IndexMode == VTK_INDEXING_BY_SCALAR)
457 {
458 return "IndexingByScalar";
459 }
460 else
461 {
462 return "IndexingByVector";
463 }
464}
465
466#endif
Proxy object to connect input/output ports.
abstract superclass for arrays of numeric data
abstract class to specify dataset behavior
Definition vtkDataSet.h:63
copy oriented and scaled glyph geometry to every input point
Definition vtkGlyph3D.h:113
void SetIndexModeToScalar()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition vtkGlyph3D.h:272
void SetSourceData(int id, vtkPolyData *pd)
Specify a source object at a specified table location.
void SetScaleModeToScaleByVector()
Either scale by scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:176
int OutputPointsPrecision
Definition vtkGlyph3D.h:379
void SetVectorModeToUseNormal()
Specify whether to use vector or normal to perform vector operations.
Definition vtkGlyph3D.h:239
const char * GetVectorModeAsString()
Return the vector mode as a character string.
Definition vtkGlyph3D.h:427
void SetScaleModeToScaleByVectorComponents()
Either scale by scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:177
void SetIndexModeToOff()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition vtkGlyph3D.h:274
void SetScaleModeToScaleByScalar()
Either scale by scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:175
void SetColorModeToColorByScalar()
Either color by scale, scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:192
void SetSourceTransform(vtkTransform *)
When set, this is use to transform the source polydata before using it to generate the glyph.
const char * GetIndexModeAsString()
Return the index mode as a character string.
Definition vtkGlyph3D.h:450
vtkTypeBool Scaling
Definition vtkGlyph3D.h:363
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
const char * GetScaleModeAsString()
Return the method of scaling as a descriptive character string.
Definition vtkGlyph3D.h:389
void SetVectorModeToUseVector()
Specify whether to use vector or normal to perform vector operations.
Definition vtkGlyph3D.h:238
void SetScaleModeToDataScalingOff()
Either scale by scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:181
vtkMTimeType GetMTime() override
Overridden to include SourceTransform's MTime.
virtual int IsPointVisible(vtkDataSet *, vtkIdType)
This can be overwritten by subclass to return 0 when a point is blanked.
Definition vtkGlyph3D.h:314
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
Definition vtkGlyph3D.h:408
void SetSourceConnection(int id, vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkPolyData * GetSource(int id=0)
Get a pointer to a source object at a specified table location.
vtkTypeBool Clamping
Definition vtkGlyph3D.h:373
void SetColorModeToColorByScale()
Either color by scale, scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:191
virtual bool Execute(vtkDataSet *input, vtkInformationVector *sourceVector, vtkPolyData *output, vtkDataArray *inSScalars, vtkDataArray *inVectors)
Method called in RequestData() to do the actual data processing.
void SetColorModeToColorByVector()
Either color by scale, scalar or by vector/normal magnitude.
Definition vtkGlyph3D.h:193
vtkTypeBool FillCellData
Definition vtkGlyph3D.h:376
vtkPolyData ** Source
Definition vtkGlyph3D.h:362
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify a source object at a specified table location.
Definition vtkGlyph3D.h:149
~vtkGlyph3D() override
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
vtkPolyData * GetSource(int idx, vtkInformationVector *sourceInfo)
void SetVectorModeToFollowCameraDirection()
Specify whether to use vector or normal to perform vector operations.
Definition vtkGlyph3D.h:241
char * PointIdsName
Definition vtkGlyph3D.h:377
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
double ScaleFactor
Definition vtkGlyph3D.h:366
vtkTransform * SourceTransform
Definition vtkGlyph3D.h:378
void SetIndexModeToVector()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
Definition vtkGlyph3D.h:273
void SetSourceData(vtkPolyData *pd)
Set the source to use for the glyph.
Definition vtkGlyph3D.h:132
void SetVectorModeToVectorRotationOff()
Specify whether to use vector or normal to perform vector operations.
Definition vtkGlyph3D.h:240
vtkTypeBool GeneratePointIds
Definition vtkGlyph3D.h:375
virtual bool Execute(vtkDataSet *input, vtkInformationVector *sourceVector, vtkPolyData *output)
Method called in RequestData() to do the actual data processing.
static vtkGlyph3D * New()
Construct object with scaling on, scaling mode is by scalar value, scale factor = 1....
a simple class to control print indentation
Definition vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:91
describes linear transformations via a 4x4 matrix
int vtkTypeBool
Definition vtkABI.h:69
#define VTK_COLOR_BY_VECTOR
Definition vtkGlyph3D.h:99
#define VTK_FOLLOW_CAMERA_DIRECTION
Definition vtkGlyph3D.h:104
#define VTK_SCALE_BY_SCALAR
Definition vtkGlyph3D.h:92
#define VTK_INDEXING_BY_SCALAR
Definition vtkGlyph3D.h:107
#define VTK_DATA_SCALING_OFF
Definition vtkGlyph3D.h:95
#define VTK_VECTOR_ROTATION_OFF
Definition vtkGlyph3D.h:103
#define VTK_COLOR_BY_SCALAR
Definition vtkGlyph3D.h:98
#define VTK_USE_VECTOR
Definition vtkGlyph3D.h:101
#define VTK_USE_NORMAL
Definition vtkGlyph3D.h:102
#define VTK_INDEXING_BY_VECTOR
Definition vtkGlyph3D.h:108
#define VTK_SCALE_BY_VECTOR
Definition vtkGlyph3D.h:93
#define VTK_INDEXING_OFF
Definition vtkGlyph3D.h:106
#define VTK_COLOR_BY_SCALE
Definition vtkGlyph3D.h:97
#define VTK_SCALE_BY_VECTORCOMPONENTS
Definition vtkGlyph3D.h:94
int vtkIdType
Definition vtkType.h:332
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:287