VTK  9.1.0
vtkGenericGlyph3DFilter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkGenericGlyph3DFilter.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=========================================================================*/
79#ifndef vtkGenericGlyph3DFilter_h
80#define vtkGenericGlyph3DFilter_h
81
82#include "vtkFiltersGenericModule.h" // For export macro
84
85#define VTK_SCALE_BY_SCALAR 0
86#define VTK_SCALE_BY_VECTOR 1
87#define VTK_SCALE_BY_VECTORCOMPONENTS 2
88#define VTK_DATA_SCALING_OFF 3
89
90#define VTK_COLOR_BY_SCALE 0
91#define VTK_COLOR_BY_SCALAR 1
92#define VTK_COLOR_BY_VECTOR 2
93
94#define VTK_USE_VECTOR 0
95#define VTK_USE_NORMAL 1
96#define VTK_VECTOR_ROTATION_OFF 2
97
98#define VTK_INDEXING_OFF 0
99#define VTK_INDEXING_BY_SCALAR 1
100#define VTK_INDEXING_BY_VECTOR 2
101
102class VTKFILTERSGENERIC_EXPORT vtkGenericGlyph3DFilter : public vtkPolyDataAlgorithm
103{
104public:
106 void PrintSelf(ostream& os, vtkIndent indent) override;
107
115
119 void SetSourceData(vtkPolyData* pd) { this->SetSourceData(0, pd); }
120
124 void SetSourceData(int id, vtkPolyData* pd);
125
129 vtkPolyData* GetSource(int id = 0);
130
132
135 vtkSetMacro(Scaling, vtkTypeBool);
136 vtkBooleanMacro(Scaling, vtkTypeBool);
137 vtkGetMacro(Scaling, vtkTypeBool);
139
141
144 vtkSetMacro(ScaleMode, int);
145 vtkGetMacro(ScaleMode, int);
146 void SetScaleModeToScaleByScalar() { this->SetScaleMode(VTK_SCALE_BY_SCALAR); }
147 void SetScaleModeToScaleByVector() { this->SetScaleMode(VTK_SCALE_BY_VECTOR); }
149 {
150 this->SetScaleMode(VTK_SCALE_BY_VECTORCOMPONENTS);
151 }
153 const char* GetScaleModeAsString();
155
157
160 vtkSetMacro(ColorMode, int);
161 vtkGetMacro(ColorMode, int);
162 void SetColorModeToColorByScale() { this->SetColorMode(VTK_COLOR_BY_SCALE); }
163 void SetColorModeToColorByScalar() { this->SetColorMode(VTK_COLOR_BY_SCALAR); }
164 void SetColorModeToColorByVector() { this->SetColorMode(VTK_COLOR_BY_VECTOR); }
165 const char* GetColorModeAsString();
167
169
172 vtkSetMacro(ScaleFactor, double);
173 vtkGetMacro(ScaleFactor, double);
175
177
180 vtkSetVector2Macro(Range, double);
181 vtkGetVectorMacro(Range, double, 2);
183
185
188 vtkSetMacro(Orient, vtkTypeBool);
189 vtkBooleanMacro(Orient, vtkTypeBool);
190 vtkGetMacro(Orient, vtkTypeBool);
192
194
198 vtkSetMacro(Clamping, vtkTypeBool);
199 vtkBooleanMacro(Clamping, vtkTypeBool);
200 vtkGetMacro(Clamping, vtkTypeBool);
202
204
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 const char* GetVectorModeAsString();
214
216
221 vtkSetMacro(IndexMode, int);
222 vtkGetMacro(IndexMode, int);
223 void SetIndexModeToScalar() { this->SetIndexMode(VTK_INDEXING_BY_SCALAR); }
224 void SetIndexModeToVector() { this->SetIndexMode(VTK_INDEXING_BY_VECTOR); }
225 void SetIndexModeToOff() { this->SetIndexMode(VTK_INDEXING_OFF); }
226 const char* GetIndexModeAsString();
228
230
236 vtkSetMacro(GeneratePointIds, vtkTypeBool);
237 vtkGetMacro(GeneratePointIds, vtkTypeBool);
238 vtkBooleanMacro(GeneratePointIds, vtkTypeBool);
240
242
246 vtkSetStringMacro(PointIdsName);
247 vtkGetStringMacro(PointIdsName);
249
251
255 vtkGetStringMacro(InputScalarsSelection);
256 void SelectInputScalars(const char* fieldName) { this->SetInputScalarsSelection(fieldName); }
258
260
264 vtkGetStringMacro(InputVectorsSelection);
265 void SelectInputVectors(const char* fieldName) { this->SetInputVectorsSelection(fieldName); }
267
269
273 vtkGetStringMacro(InputNormalsSelection);
274 void SelectInputNormals(const char* fieldName) { this->SetInputNormalsSelection(fieldName); }
276
277protected:
280
282
286 vtkPolyData** Source; // Geometry to copy to each point
287 vtkTypeBool Scaling; // Determine whether scaling of geometry is performed
288 int ScaleMode; // Scale by scalar value or vector magnitude
289 int ColorMode; // new scalars based on scale, scalar or vector
290 double ScaleFactor; // Scale factor to use to scale geometry
291 double Range[2]; // Range to use to perform scalar scaling
292 vtkTypeBool Orient; // boolean controls whether to "orient" data
293 int VectorMode; // Orient/scale via normal or via vector data
294 vtkTypeBool Clamping; // whether to clamp scale factor
295 int IndexMode; // what to use to index into glyph table
296 vtkTypeBool GeneratePointIds; // produce input points ids for each output point
298
302 vtkSetStringMacro(InputScalarsSelection);
303 vtkSetStringMacro(InputVectorsSelection);
304 vtkSetStringMacro(InputNormalsSelection);
305
306private:
308 void operator=(const vtkGenericGlyph3DFilter&) = delete;
309};
310
315{
316 if (this->ScaleMode == VTK_SCALE_BY_SCALAR)
317 {
318 return "ScaleByScalar";
319 }
320 else if (this->ScaleMode == VTK_SCALE_BY_VECTOR)
321 {
322 return "ScaleByVector";
323 }
324 else
325 {
326 return "DataScalingOff";
327 }
328}
329
334{
335 if (this->ColorMode == VTK_COLOR_BY_SCALAR)
336 {
337 return "ColorByScalar";
338 }
339 else if (this->ColorMode == VTK_COLOR_BY_VECTOR)
340 {
341 return "ColorByVector";
342 }
343 else
344 {
345 return "ColorByScale";
346 }
347}
348
353{
354 if (this->VectorMode == VTK_USE_VECTOR)
355 {
356 return "UseVector";
357 }
358 else if (this->VectorMode == VTK_USE_NORMAL)
359 {
360 return "UseNormal";
361 }
362 else
363 {
364 return "VectorRotationOff";
365 }
366}
367
372{
373 if (this->IndexMode == VTK_INDEXING_OFF)
374 {
375 return "IndexingOff";
376 }
377 else if (this->IndexMode == VTK_INDEXING_BY_SCALAR)
378 {
379 return "IndexingByScalar";
380 }
381 else
382 {
383 return "IndexingByVector";
384 }
385}
386
387#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:113
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:195
int vtkTypeBool
Definition: vtkABI.h:69
#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:202
#define VTK_SCALE_BY_SCALAR
Definition: vtkGlyph3D.h:195
#define VTK_INDEXING_BY_SCALAR
Definition: vtkGlyph3D.h:210
#define VTK_DATA_SCALING_OFF
Definition: vtkGlyph3D.h:198
#define VTK_VECTOR_ROTATION_OFF
Definition: vtkGlyph3D.h:206
#define VTK_COLOR_BY_SCALAR
Definition: vtkGlyph3D.h:201
#define VTK_USE_VECTOR
Definition: vtkGlyph3D.h:204
#define VTK_USE_NORMAL
Definition: vtkGlyph3D.h:205
#define VTK_INDEXING_BY_VECTOR
Definition: vtkGlyph3D.h:211
#define VTK_SCALE_BY_VECTOR
Definition: vtkGlyph3D.h:196
#define VTK_INDEXING_OFF
Definition: vtkGlyph3D.h:209
#define VTK_COLOR_BY_SCALE
Definition: vtkGlyph3D.h:200
#define VTK_SCALE_BY_VECTORCOMPONENTS
Definition: vtkGlyph3D.h:197