VTK  9.3.0
vtkGlyphSource2D.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
26 #ifndef vtkGlyphSource2D_h
27 #define vtkGlyphSource2D_h
28 
29 #include "vtkFiltersSourcesModule.h" // For export macro
30 #include "vtkPolyDataAlgorithm.h"
31 
32 #define VTK_NO_GLYPH 0
33 #define VTK_VERTEX_GLYPH 1
34 #define VTK_DASH_GLYPH 2
35 #define VTK_CROSS_GLYPH 3
36 #define VTK_THICKCROSS_GLYPH 4
37 #define VTK_TRIANGLE_GLYPH 5
38 #define VTK_SQUARE_GLYPH 6
39 #define VTK_CIRCLE_GLYPH 7
40 #define VTK_DIAMOND_GLYPH 8
41 #define VTK_ARROW_GLYPH 9
42 #define VTK_THICKARROW_GLYPH 10
43 #define VTK_HOOKEDARROW_GLYPH 11
44 #define VTK_EDGEARROW_GLYPH 12
45 
46 #define VTK_MAX_CIRCLE_RESOLUTION 1024
47 
48 VTK_ABI_NAMESPACE_BEGIN
49 class vtkPoints;
51 class vtkCellArray;
52 
53 class VTKFILTERSSOURCES_EXPORT vtkGlyphSource2D : public vtkPolyDataAlgorithm
54 {
55 public:
57  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
63  static vtkGlyphSource2D* New();
64 
66 
69  vtkSetVector3Macro(Center, double);
70  vtkGetVectorMacro(Center, double, 3);
72 
74 
78  vtkSetClampMacro(Scale, double, 0.0, VTK_DOUBLE_MAX);
79  vtkGetMacro(Scale, double);
81 
83 
87  vtkSetClampMacro(Scale2, double, 0.0, VTK_DOUBLE_MAX);
88  vtkGetMacro(Scale2, double);
90 
92 
95  vtkSetVector3Macro(Color, double);
96  vtkGetVectorMacro(Color, double, 3);
98 
100 
105  vtkSetMacro(Filled, vtkTypeBool);
106  vtkGetMacro(Filled, vtkTypeBool);
107  vtkBooleanMacro(Filled, vtkTypeBool);
109 
111 
116  vtkSetMacro(Dash, vtkTypeBool);
117  vtkGetMacro(Dash, vtkTypeBool);
118  vtkBooleanMacro(Dash, vtkTypeBool);
120 
122 
127  vtkSetMacro(Cross, vtkTypeBool);
128  vtkGetMacro(Cross, vtkTypeBool);
129  vtkBooleanMacro(Cross, vtkTypeBool);
131 
133 
138  vtkSetMacro(RotationAngle, double);
139  vtkGetMacro(RotationAngle, double);
141 
143 
146  vtkSetClampMacro(Resolution, int, 3, VTK_MAX_CIRCLE_RESOLUTION);
147  vtkGetMacro(Resolution, int);
149 
151 
154  vtkSetClampMacro(GlyphType, int, VTK_NO_GLYPH, VTK_EDGEARROW_GLYPH);
155  vtkGetMacro(GlyphType, int);
156  void SetGlyphTypeToNone() { this->SetGlyphType(VTK_NO_GLYPH); }
157  void SetGlyphTypeToVertex() { this->SetGlyphType(VTK_VERTEX_GLYPH); }
158  void SetGlyphTypeToDash() { this->SetGlyphType(VTK_DASH_GLYPH); }
159  void SetGlyphTypeToCross() { this->SetGlyphType(VTK_CROSS_GLYPH); }
160  void SetGlyphTypeToThickCross() { this->SetGlyphType(VTK_THICKCROSS_GLYPH); }
161  void SetGlyphTypeToTriangle() { this->SetGlyphType(VTK_TRIANGLE_GLYPH); }
162  void SetGlyphTypeToSquare() { this->SetGlyphType(VTK_SQUARE_GLYPH); }
163  void SetGlyphTypeToCircle() { this->SetGlyphType(VTK_CIRCLE_GLYPH); }
164  void SetGlyphTypeToDiamond() { this->SetGlyphType(VTK_DIAMOND_GLYPH); }
165  void SetGlyphTypeToArrow() { this->SetGlyphType(VTK_ARROW_GLYPH); }
166  void SetGlyphTypeToThickArrow() { this->SetGlyphType(VTK_THICKARROW_GLYPH); }
167  void SetGlyphTypeToHookedArrow() { this->SetGlyphType(VTK_HOOKEDARROW_GLYPH); }
168  void SetGlyphTypeToEdgeArrow() { this->SetGlyphType(VTK_EDGEARROW_GLYPH); }
170 
172 
177  vtkSetMacro(OutputPointsPrecision, int);
178  vtkGetMacro(OutputPointsPrecision, int);
180 
182 
187  vtkSetClampMacro(TipLength, double, 0.0, 1.0);
188  vtkGetMacro(TipLength, double);
190 
192 
197  vtkSetMacro(DoublePointed, bool);
198  vtkGetMacro(DoublePointed, bool);
199  vtkBooleanMacro(DoublePointed, bool);
201 
203 
208  vtkSetMacro(PointInwards, bool);
209  vtkGetMacro(PointInwards, bool);
210  vtkBooleanMacro(PointInwards, bool);
212 
213 protected:
215  ~vtkGlyphSource2D() override = default;
216 
218 
219  double Center[3] = { 0.0, 0.0, 0.0 };
220  double Scale = 1.0;
221  double Scale2 = 1.5;
222  double Color[3] = { 1.0, 1.0, 1.0 };
223  vtkTypeBool Filled = true;
224  vtkTypeBool Dash = false;
225  vtkTypeBool Cross = false;
226  int GlyphType = VTK_VERTEX_GLYPH;
227  double RotationAngle = 0.0;
228  int Resolution = 8;
229  int OutputPointsPrecision = SINGLE_PRECISION;
230  double TipLength = 0.3;
231  bool DoublePointed = false;
232  bool PointInwards = false;
233 
235  void ConvertColor();
236  unsigned char RGB[3];
237 
239  void CreateDash(vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys,
240  vtkUnsignedCharArray* colors, double scale);
241  void CreateCross(vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys,
242  vtkUnsignedCharArray* colors, double scale);
244  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
246  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
248  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
250  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
252  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
254  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
256  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
258  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
260  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
261 
262 private:
263  vtkGlyphSource2D(const vtkGlyphSource2D&) = delete;
264  void operator=(const vtkGlyphSource2D&) = delete;
265 };
266 
267 VTK_ABI_NAMESPACE_END
268 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:176
create 2D glyphs represented by vtkPolyData
void SetGlyphTypeToArrow()
Specify the type of glyph to generate.
void CreateThickArrow(vtkPoints *pts, vtkCellArray *lines, vtkCellArray *polys, vtkUnsignedCharArray *colors)
void SetGlyphTypeToSquare()
Specify the type of glyph to generate.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void SetGlyphTypeToTriangle()
Specify the type of glyph to generate.
void SetGlyphTypeToCross()
Specify the type of glyph to generate.
void SetGlyphTypeToThickArrow()
Specify the type of glyph to generate.
void SetGlyphTypeToEdgeArrow()
Specify the type of glyph to generate.
void CreateCross(vtkPoints *pts, vtkCellArray *lines, vtkCellArray *polys, vtkUnsignedCharArray *colors, double scale)
void CreateThickCross(vtkPoints *pts, vtkCellArray *lines, vtkCellArray *polys, vtkUnsignedCharArray *colors)
static vtkGlyphSource2D * New()
Construct a vertex glyph centered at the origin, scale 1.0, white in color, filled,...
void CreateDiamond(vtkPoints *pts, vtkCellArray *lines, vtkCellArray *polys, vtkUnsignedCharArray *colors)
void TransformGlyph(vtkPoints *pts)
void SetGlyphTypeToNone()
Specify the type of glyph to generate.
~vtkGlyphSource2D() override=default
void CreateCircle(vtkPoints *pts, vtkCellArray *lines, vtkCellArray *polys, vtkUnsignedCharArray *colors)
void CreateTriangle(vtkPoints *pts, vtkCellArray *lines, vtkCellArray *polys, vtkUnsignedCharArray *colors)
void SetGlyphTypeToCircle()
Specify the type of glyph to generate.
void SetGlyphTypeToHookedArrow()
Specify the type of glyph to generate.
void CreateEdgeArrow(vtkPoints *pts, vtkCellArray *lines, vtkCellArray *polys, vtkUnsignedCharArray *colors)
void CreateVertex(vtkPoints *pts, vtkCellArray *verts, vtkUnsignedCharArray *colors)
void CreateArrow(vtkPoints *pts, vtkCellArray *lines, vtkCellArray *polys, vtkUnsignedCharArray *colors)
void SetGlyphTypeToDash()
Specify the type of glyph to generate.
void SetGlyphTypeToDiamond()
Specify the type of glyph to generate.
void CreateHookedArrow(vtkPoints *pts, vtkCellArray *lines, vtkCellArray *polys, vtkUnsignedCharArray *colors)
void SetGlyphTypeToThickCross()
Specify the type of glyph to generate.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void CreateDash(vtkPoints *pts, vtkCellArray *lines, vtkCellArray *polys, vtkUnsignedCharArray *colors, double scale)
void CreateSquare(vtkPoints *pts, vtkCellArray *lines, vtkCellArray *polys, vtkUnsignedCharArray *colors)
void SetGlyphTypeToVertex()
Specify the type of glyph to generate.
a simple class to control print indentation
Definition: vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate 3D points
Definition: vtkPoints.h:29
Superclass for algorithms that produce only polydata as output.
dynamic, self-adjusting array of unsigned char
@ Color
Definition: vtkX3D.h:46
@ scale
Definition: vtkX3D.h:229
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_DIAMOND_GLYPH
#define VTK_SQUARE_GLYPH
#define VTK_TRIANGLE_GLYPH
#define VTK_NO_GLYPH
#define VTK_MAX_CIRCLE_RESOLUTION
#define VTK_VERTEX_GLYPH
#define VTK_THICKCROSS_GLYPH
#define VTK_DASH_GLYPH
#define VTK_HOOKEDARROW_GLYPH
#define VTK_ARROW_GLYPH
#define VTK_EDGEARROW_GLYPH
#define VTK_CIRCLE_GLYPH
#define VTK_CROSS_GLYPH
#define VTK_THICKARROW_GLYPH
#define VTK_DOUBLE_MAX
Definition: vtkType.h:154