VTK  9.3.20240424
vtkGenericGlyph3DFilter.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
70#ifndef vtkGenericGlyph3DFilter_h
71#define vtkGenericGlyph3DFilter_h
72
73#include "vtkFiltersGenericModule.h" // For export macro
75
76#define VTK_SCALE_BY_SCALAR 0
77#define VTK_SCALE_BY_VECTOR 1
78#define VTK_SCALE_BY_VECTORCOMPONENTS 2
79#define VTK_DATA_SCALING_OFF 3
80
81#define VTK_COLOR_BY_SCALE 0
82#define VTK_COLOR_BY_SCALAR 1
83#define VTK_COLOR_BY_VECTOR 2
84
85#define VTK_USE_VECTOR 0
86#define VTK_USE_NORMAL 1
87#define VTK_VECTOR_ROTATION_OFF 2
88
89#define VTK_INDEXING_OFF 0
90#define VTK_INDEXING_BY_SCALAR 1
91#define VTK_INDEXING_BY_VECTOR 2
92
93VTK_ABI_NAMESPACE_BEGIN
94class VTKFILTERSGENERIC_EXPORT vtkGenericGlyph3DFilter : public vtkPolyDataAlgorithm
95{
96public:
98 void PrintSelf(ostream& os, vtkIndent indent) override;
99
107
111 void SetSourceData(vtkPolyData* pd) { this->SetSourceData(0, pd); }
112
116 void SetSourceData(int id, vtkPolyData* pd);
117
121 vtkPolyData* GetSource(int id = 0);
122
124
127 vtkSetMacro(Scaling, vtkTypeBool);
128 vtkBooleanMacro(Scaling, vtkTypeBool);
129 vtkGetMacro(Scaling, vtkTypeBool);
131
133
136 vtkSetMacro(ScaleMode, int);
137 vtkGetMacro(ScaleMode, int);
138 void SetScaleModeToScaleByScalar() { this->SetScaleMode(VTK_SCALE_BY_SCALAR); }
139 void SetScaleModeToScaleByVector() { this->SetScaleMode(VTK_SCALE_BY_VECTOR); }
141 {
142 this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);
143 }
145 const char* GetScaleModeAsString();
147
149
152 vtkSetMacro(ColorMode, int);
153 vtkGetMacro(ColorMode, int);
154 void SetColorModeToColorByScale() { this->SetColorMode(VTK_COLOR_BY_SCALE); }
155 void SetColorModeToColorByScalar() { this->SetColorMode(VTK_COLOR_BY_SCALAR); }
156 void SetColorModeToColorByVector() { this->SetColorMode(VTK_COLOR_BY_VECTOR); }
157 const char* GetColorModeAsString();
159
161
164 vtkSetMacro(ScaleFactor, double);
165 vtkGetMacro(ScaleFactor, double);
167
169
172 vtkSetVector2Macro(Range, double);
173 vtkGetVectorMacro(Range, double, 2);
175
177
180 vtkSetMacro(Orient, vtkTypeBool);
181 vtkBooleanMacro(Orient, vtkTypeBool);
182 vtkGetMacro(Orient, vtkTypeBool);
184
186
190 vtkSetMacro(Clamping, vtkTypeBool);
191 vtkBooleanMacro(Clamping, vtkTypeBool);
192 vtkGetMacro(Clamping, vtkTypeBool);
194
196
199 vtkSetMacro(VectorMode, int);
200 vtkGetMacro(VectorMode, int);
201 void SetVectorModeToUseVector() { this->SetVectorMode(VTK_USE_VECTOR); }
202 void SetVectorModeToUseNormal() { this->SetVectorMode(VTK_USE_NORMAL); }
204 const char* GetVectorModeAsString();
206
208
213 vtkSetMacro(IndexMode, int);
214 vtkGetMacro(IndexMode, int);
215 void SetIndexModeToScalar() { this->SetIndexMode(VTK_INDEXING_BY_SCALAR); }
216 void SetIndexModeToVector() { this->SetIndexMode(VTK_INDEXING_BY_VECTOR); }
217 void SetIndexModeToOff() { this->SetIndexMode(VTK_INDEXING_OFF); }
218 const char* GetIndexModeAsString();
220
222
228 vtkSetMacro(GeneratePointIds, vtkTypeBool);
229 vtkGetMacro(GeneratePointIds, vtkTypeBool);
230 vtkBooleanMacro(GeneratePointIds, vtkTypeBool);
232
234
238 vtkSetStringMacro(PointIdsName);
239 vtkGetStringMacro(PointIdsName);
241
243
247 vtkGetStringMacro(InputScalarsSelection);
248 void SelectInputScalars(const char* fieldName) { this->SetInputScalarsSelection(fieldName); }
250
252
256 vtkGetStringMacro(InputVectorsSelection);
257 void SelectInputVectors(const char* fieldName) { this->SetInputVectorsSelection(fieldName); }
259
261
265 vtkGetStringMacro(InputNormalsSelection);
266 void SelectInputNormals(const char* fieldName) { this->SetInputNormalsSelection(fieldName); }
268
269protected:
272
274
278 vtkPolyData** Source; // Geometry to copy to each point
279 vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
280 int ScaleMode; // Scale by scalar value or vector magnitude
281 int ColorMode; // new scalars based on scale, scalar or vector
282 double ScaleFactor; // Scale factor to use to scale geometry
283 double Range[2]; // Range to use to perform scalar scaling
284 vtkTypeBool Orient; // boolean controls whether to "orient" data
285 int VectorMode; // Orient/scale via normal or via vector data
286 vtkTypeBool Clamping; // whether to clamp scale factor
287 int IndexMode; // what to use to index into glyph table
288 vtkTypeBool GeneratePointIds; // produce input points ids for each output point
290
294 vtkSetStringMacro(InputScalarsSelection);
295 vtkSetStringMacro(InputVectorsSelection);
296 vtkSetStringMacro(InputNormalsSelection);
297
298private:
300 void operator=(const vtkGenericGlyph3DFilter&) = delete;
301};
302
307{
308 if (this->ScaleMode == VTK_SCALE_BY_SCALAR)
309 {
310 return "ScaleByScalar";
311 }
312 else if (this->ScaleMode == VTK_SCALE_BY_VECTOR)
313 {
314 return "ScaleByVector";
315 }
316 else
317 {
318 return "DataScalingOff";
319 }
320}
321
326{
327 if (this->ColorMode == VTK_COLOR_BY_SCALAR)
328 {
329 return "ColorByScalar";
330 }
331 else if (this->ColorMode == VTK_COLOR_BY_VECTOR)
332 {
333 return "ColorByVector";
334 }
335 else
336 {
337 return "ColorByScale";
338 }
339}
340
345{
346 if (this->VectorMode == VTK_USE_VECTOR)
347 {
348 return "UseVector";
349 }
350 else if (this->VectorMode == VTK_USE_NORMAL)
351 {
352 return "UseNormal";
353 }
354 else
355 {
356 return "VectorRotationOff";
357 }
358}
359
364{
365 if (this->IndexMode == VTK_INDEXING_OFF)
366 {
367 return "IndexingOff";
368 }
369 else if (this->IndexMode == VTK_INDEXING_BY_SCALAR)
370 {
371 return "IndexingByScalar";
372 }
373 else
374 {
375 return "IndexingByVector";
376 }
377}
378
379VTK_ABI_NAMESPACE_END
380#endif
copy oriented and scaled glyph geometry to every input point
void SelectInputVectors(const char *fieldName)
If you want to use an arbitrary vectors array, then set its name here.
void SelectInputNormals(const char *fieldName)
If you want to use an arbitrary normals array, then set its name here.
~vtkGenericGlyph3DFilter() override
void SetScaleModeToScaleByScalar()
Either scale by scalar or by vector/normal magnitude.
void SetScaleModeToScaleByVector()
Either scale by scalar or by vector/normal magnitude.
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.
void SetVectorModeToUseVector()
Specify whether to use vector or normal to perform vector operations.
const char * GetScaleModeAsString()
Return the method of scaling as a descriptive character string.
void SetIndexModeToVector()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
void SetColorModeToColorByVector()
Either color by scale, scalar or by vector/normal magnitude.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
void SetSourceData(vtkPolyData *pd)
Set the source to use for the glyph.
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
const char * GetColorModeAsString()
Return the method of coloring as a descriptive character string.
void SetColorModeToColorByScalar()
Either color by scale, scalar or by vector/normal magnitude.
void SetColorModeToColorByScale()
Either color by scale, scalar or by vector/normal magnitude.
void SetIndexModeToScalar()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetIndexModeToOff()
Index into table of sources by scalar, by vector/normal magnitude, or no indexing.
static vtkGenericGlyph3DFilter * New()
Construct object with scaling on, scaling mode is by scalar value, scale factor = 1....
const char * GetVectorModeAsString()
Return the vector mode as a character string.
void SetSourceData(int id, vtkPolyData *pd)
Specify a source object at a specified table location.
void SetVectorModeToUseNormal()
Specify whether to use vector or normal to perform vector operations.
void SelectInputScalars(const char *fieldName)
If you want to use an arbitrary scalars array, then set its name here.
const char * GetIndexModeAsString()
Return the index mode as a character string.
void SetVectorModeToVectorRotationOff()
Specify whether to use vector or normal to perform vector operations.
void SetScaleModeToScaleByVectorComponents()
Either scale by scalar or by vector/normal magnitude.
void SetScaleModeToDataScalingOff()
Either scale by scalar or by vector/normal magnitude.
a simple class to control print indentation
Definition vtkIndent.h:108
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
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_COLOR_BY_VECTOR
#define VTK_SCALE_BY_SCALAR
#define VTK_INDEXING_BY_SCALAR
#define VTK_COLOR_BY_SCALAR
#define VTK_USE_VECTOR
#define VTK_USE_NORMAL
#define VTK_SCALE_BY_VECTOR
#define VTK_INDEXING_OFF
#define VTK_COLOR_BY_VECTOR
Definition vtkGlyph3D.h:196
#define VTK_SCALE_BY_SCALAR
Definition vtkGlyph3D.h:189
#define VTK_INDEXING_BY_SCALAR
Definition vtkGlyph3D.h:204
#define VTK_DATA_SCALING_OFF
Definition vtkGlyph3D.h:192
#define VTK_VECTOR_ROTATION_OFF
Definition vtkGlyph3D.h:200
#define VTK_COLOR_BY_SCALAR
Definition vtkGlyph3D.h:195
#define VTK_USE_VECTOR
Definition vtkGlyph3D.h:198
#define VTK_USE_NORMAL
Definition vtkGlyph3D.h:199
#define VTK_INDEXING_BY_VECTOR
Definition vtkGlyph3D.h:205
#define VTK_SCALE_BY_VECTOR
Definition vtkGlyph3D.h:190
#define VTK_INDEXING_OFF
Definition vtkGlyph3D.h:203
#define VTK_COLOR_BY_SCALE
Definition vtkGlyph3D.h:194
#define VTK_SCALE_BY_VECTORCOMPONENTS
Definition vtkGlyph3D.h:191