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
35 #ifndef vtkGlyphSource2D_h
36 #define vtkGlyphSource2D_h
37 
38 #include "vtkFiltersSourcesModule.h" // For export macro
39 #include "vtkPolyDataAlgorithm.h"
40 
41 #define VTK_NO_GLYPH 0
42 #define VTK_VERTEX_GLYPH 1
43 #define VTK_DASH_GLYPH 2
44 #define VTK_CROSS_GLYPH 3
45 #define VTK_THICKCROSS_GLYPH 4
46 #define VTK_TRIANGLE_GLYPH 5
47 #define VTK_SQUARE_GLYPH 6
48 #define VTK_CIRCLE_GLYPH 7
49 #define VTK_DIAMOND_GLYPH 8
50 #define VTK_ARROW_GLYPH 9
51 #define VTK_THICKARROW_GLYPH 10
52 #define VTK_HOOKEDARROW_GLYPH 11
53 #define VTK_EDGEARROW_GLYPH 12
54 
55 #define VTK_MAX_CIRCLE_RESOLUTION 1024
56 
57 VTK_ABI_NAMESPACE_BEGIN
58 class vtkPoints;
60 class vtkCellArray;
61 
62 class VTKFILTERSSOURCES_EXPORT vtkGlyphSource2D : public vtkPolyDataAlgorithm
63 {
64 public:
66  void PrintSelf(ostream& os, vtkIndent indent) override;
67 
72  static vtkGlyphSource2D* New();
73 
75 
78  vtkSetVector3Macro(Center, double);
79  vtkGetVectorMacro(Center, double, 3);
81 
83 
87  vtkSetClampMacro(Scale, double, 0.0, VTK_DOUBLE_MAX);
88  vtkGetMacro(Scale, double);
90 
92 
96  vtkSetClampMacro(Scale2, double, 0.0, VTK_DOUBLE_MAX);
97  vtkGetMacro(Scale2, double);
99 
101 
104  vtkSetVector3Macro(Color, double);
105  vtkGetVectorMacro(Color, double, 3);
107 
109 
114  vtkSetMacro(Filled, vtkTypeBool);
115  vtkGetMacro(Filled, vtkTypeBool);
116  vtkBooleanMacro(Filled, vtkTypeBool);
118 
120 
125  vtkSetMacro(Dash, vtkTypeBool);
126  vtkGetMacro(Dash, vtkTypeBool);
127  vtkBooleanMacro(Dash, vtkTypeBool);
129 
131 
136  vtkSetMacro(Cross, vtkTypeBool);
137  vtkGetMacro(Cross, vtkTypeBool);
138  vtkBooleanMacro(Cross, vtkTypeBool);
140 
142 
147  vtkSetMacro(RotationAngle, double);
148  vtkGetMacro(RotationAngle, double);
150 
152 
155  vtkSetClampMacro(Resolution, int, 3, VTK_MAX_CIRCLE_RESOLUTION);
156  vtkGetMacro(Resolution, int);
158 
160 
163  vtkSetClampMacro(GlyphType, int, VTK_NO_GLYPH, VTK_EDGEARROW_GLYPH);
164  vtkGetMacro(GlyphType, int);
165  void SetGlyphTypeToNone() { this->SetGlyphType(VTK_NO_GLYPH); }
166  void SetGlyphTypeToVertex() { this->SetGlyphType(VTK_VERTEX_GLYPH); }
167  void SetGlyphTypeToDash() { this->SetGlyphType(VTK_DASH_GLYPH); }
168  void SetGlyphTypeToCross() { this->SetGlyphType(VTK_CROSS_GLYPH); }
169  void SetGlyphTypeToThickCross() { this->SetGlyphType(VTK_THICKCROSS_GLYPH); }
170  void SetGlyphTypeToTriangle() { this->SetGlyphType(VTK_TRIANGLE_GLYPH); }
171  void SetGlyphTypeToSquare() { this->SetGlyphType(VTK_SQUARE_GLYPH); }
172  void SetGlyphTypeToCircle() { this->SetGlyphType(VTK_CIRCLE_GLYPH); }
173  void SetGlyphTypeToDiamond() { this->SetGlyphType(VTK_DIAMOND_GLYPH); }
174  void SetGlyphTypeToArrow() { this->SetGlyphType(VTK_ARROW_GLYPH); }
175  void SetGlyphTypeToThickArrow() { this->SetGlyphType(VTK_THICKARROW_GLYPH); }
176  void SetGlyphTypeToHookedArrow() { this->SetGlyphType(VTK_HOOKEDARROW_GLYPH); }
177  void SetGlyphTypeToEdgeArrow() { this->SetGlyphType(VTK_EDGEARROW_GLYPH); }
179 
181 
186  vtkSetMacro(OutputPointsPrecision, int);
187  vtkGetMacro(OutputPointsPrecision, int);
189 
191 
196  vtkSetClampMacro(TipLength, double, 0.0, 1.0);
197  vtkGetMacro(TipLength, double);
199 
201 
206  vtkSetMacro(DoublePointed, bool);
207  vtkGetMacro(DoublePointed, bool);
208  vtkBooleanMacro(DoublePointed, bool);
210 
212 
217  vtkSetMacro(PointInwards, bool);
218  vtkGetMacro(PointInwards, bool);
219  vtkBooleanMacro(PointInwards, bool);
221 
222 protected:
224  ~vtkGlyphSource2D() override = default;
225 
227 
228  double Center[3] = { 0.0, 0.0, 0.0 };
229  double Scale = 1.0;
230  double Scale2 = 1.5;
231  double Color[3] = { 1.0, 1.0, 1.0 };
232  vtkTypeBool Filled = true;
233  vtkTypeBool Dash = false;
234  vtkTypeBool Cross = false;
235  int GlyphType = VTK_VERTEX_GLYPH;
236  double RotationAngle = 0.0;
237  int Resolution = 8;
238  int OutputPointsPrecision = SINGLE_PRECISION;
239  double TipLength = 0.3;
240  bool DoublePointed = false;
241  bool PointInwards = false;
242 
244  void ConvertColor();
245  unsigned char RGB[3];
246 
248  void CreateDash(vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys,
249  vtkUnsignedCharArray* colors, double scale);
250  void CreateCross(vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys,
251  vtkUnsignedCharArray* colors, double scale);
253  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
255  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
257  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
259  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
261  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
263  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
265  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
267  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
269  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
270 
271 private:
272  vtkGlyphSource2D(const vtkGlyphSource2D&) = delete;
273  void operator=(const vtkGlyphSource2D&) = delete;
274 };
275 
276 VTK_ABI_NAMESPACE_END
277 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:185
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:38
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate 3D points
Definition: vtkPoints.h:38
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