VTK  9.7.1
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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
32 
33 #define VTK_NO_GLYPH 0
34 #define VTK_VERTEX_GLYPH 1
35 #define VTK_DASH_GLYPH 2
36 #define VTK_CROSS_GLYPH 3
37 #define VTK_THICKCROSS_GLYPH 4
38 #define VTK_TRIANGLE_GLYPH 5
39 #define VTK_SQUARE_GLYPH 6
40 #define VTK_CIRCLE_GLYPH 7
41 #define VTK_DIAMOND_GLYPH 8
42 #define VTK_ARROW_GLYPH 9
43 #define VTK_THICKARROW_GLYPH 10
44 #define VTK_HOOKEDARROW_GLYPH 11
45 #define VTK_EDGEARROW_GLYPH 12
46 
47 #define VTK_MAX_CIRCLE_RESOLUTION 1024
48 
49 VTK_ABI_NAMESPACE_BEGIN
50 class vtkPoints;
52 class vtkCellArray;
53 
54 class VTKFILTERSSOURCES_EXPORT VTK_MARSHALAUTO vtkGlyphSource2D : public vtkPolyDataAlgorithm
55 {
56 public:
58  void PrintSelf(ostream& os, vtkIndent indent) override;
59 
64  static vtkGlyphSource2D* New();
65 
67 
70  vtkSetVector3Macro(Center, double);
71  vtkGetVectorMacro(Center, double, 3);
73 
75 
79  vtkSetClampMacro(Scale, double, 0.0, VTK_DOUBLE_MAX);
80  vtkGetMacro(Scale, double);
82 
84 
88  vtkSetClampMacro(Scale2, double, 0.0, VTK_DOUBLE_MAX);
89  vtkGetMacro(Scale2, double);
91 
93 
96  vtkSetVector3Macro(Color, double);
97  vtkGetVectorMacro(Color, double, 3);
99 
101 
106  vtkSetMacro(Filled, vtkTypeBool);
107  vtkGetMacro(Filled, vtkTypeBool);
108  vtkBooleanMacro(Filled, vtkTypeBool);
110 
112 
117  vtkSetMacro(Dash, vtkTypeBool);
118  vtkGetMacro(Dash, vtkTypeBool);
119  vtkBooleanMacro(Dash, vtkTypeBool);
121 
123 
128  vtkSetMacro(Cross, vtkTypeBool);
129  vtkGetMacro(Cross, vtkTypeBool);
130  vtkBooleanMacro(Cross, vtkTypeBool);
132 
134 
139  vtkSetMacro(RotationAngle, double);
140  vtkGetMacro(RotationAngle, double);
142 
144 
147  vtkSetClampMacro(Resolution, int, 3, VTK_MAX_CIRCLE_RESOLUTION);
148  vtkGetMacro(Resolution, int);
150 
152 
155  vtkSetClampMacro(GlyphType, int, VTK_NO_GLYPH, VTK_EDGEARROW_GLYPH);
156  vtkGetMacro(GlyphType, int);
157  void SetGlyphTypeToNone() { this->SetGlyphType(VTK_NO_GLYPH); }
158  void SetGlyphTypeToVertex() { this->SetGlyphType(VTK_VERTEX_GLYPH); }
159  void SetGlyphTypeToDash() { this->SetGlyphType(VTK_DASH_GLYPH); }
160  void SetGlyphTypeToCross() { this->SetGlyphType(VTK_CROSS_GLYPH); }
161  void SetGlyphTypeToThickCross() { this->SetGlyphType(VTK_THICKCROSS_GLYPH); }
162  void SetGlyphTypeToTriangle() { this->SetGlyphType(VTK_TRIANGLE_GLYPH); }
163  void SetGlyphTypeToSquare() { this->SetGlyphType(VTK_SQUARE_GLYPH); }
164  void SetGlyphTypeToCircle() { this->SetGlyphType(VTK_CIRCLE_GLYPH); }
165  void SetGlyphTypeToDiamond() { this->SetGlyphType(VTK_DIAMOND_GLYPH); }
166  void SetGlyphTypeToArrow() { this->SetGlyphType(VTK_ARROW_GLYPH); }
167  void SetGlyphTypeToThickArrow() { this->SetGlyphType(VTK_THICKARROW_GLYPH); }
168  void SetGlyphTypeToHookedArrow() { this->SetGlyphType(VTK_HOOKEDARROW_GLYPH); }
169  void SetGlyphTypeToEdgeArrow() { this->SetGlyphType(VTK_EDGEARROW_GLYPH); }
171 
173 
178  vtkSetMacro(OutputPointsPrecision, int);
179  vtkGetMacro(OutputPointsPrecision, int);
181 
183 
188  vtkSetClampMacro(TipLength, double, 0.0, 1.0);
189  vtkGetMacro(TipLength, double);
191 
193 
198  vtkSetMacro(DoublePointed, bool);
199  vtkGetMacro(DoublePointed, bool);
200  vtkBooleanMacro(DoublePointed, bool);
202 
204 
209  vtkSetMacro(PointInwards, bool);
210  vtkGetMacro(PointInwards, bool);
211  vtkBooleanMacro(PointInwards, bool);
213 
214 protected:
216  ~vtkGlyphSource2D() override = default;
217 
219 
220  double Center[3] = { 0.0, 0.0, 0.0 };
221  double Scale = 1.0;
222  double Scale2 = 1.5;
223  double Color[3] = { 1.0, 1.0, 1.0 };
224  vtkTypeBool Filled = true;
225  vtkTypeBool Dash = false;
226  vtkTypeBool Cross = false;
227  int GlyphType = VTK_VERTEX_GLYPH;
228  double RotationAngle = 0.0;
229  int Resolution = 8;
230  int OutputPointsPrecision = SINGLE_PRECISION;
231  double TipLength = 0.3;
232  bool DoublePointed = false;
233  bool PointInwards = false;
234 
235  void TransformGlyph(vtkPoints* pts);
236  void ConvertColor();
237  unsigned char RGB[3];
238 
239  void CreateVertex(vtkPoints* pts, vtkCellArray* verts, vtkUnsignedCharArray* colors);
240  void CreateDash(vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys,
241  vtkUnsignedCharArray* colors, double scale);
242  void CreateCross(vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys,
243  vtkUnsignedCharArray* colors, double scale);
244  void CreateThickCross(
245  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
246  void CreateTriangle(
247  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
248  void CreateSquare(
249  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
250  void CreateCircle(
251  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
252  void CreateDiamond(
253  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
254  void CreateArrow(
255  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
256  void CreateThickArrow(
257  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
258  void CreateHookedArrow(
259  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
260  void CreateEdgeArrow(
261  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
262 
263 private:
264  vtkGlyphSource2D(const vtkGlyphSource2D&) = delete;
265  void operator=(const vtkGlyphSource2D&) = delete;
266 };
267 
268 VTK_ABI_NAMESPACE_END
269 #endif
#define VTK_HOOKEDARROW_GLYPH
#define VTK_DOUBLE_MAX
Definition: vtkType.h:202
Store vtkAlgorithm input/output information.
#define VTK_EDGEARROW_GLYPH
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
void SetGlyphTypeToVertex()
Specify the type of glyph to generate.
void SetGlyphTypeToDash()
Specify the type of glyph to generate.
#define VTK_MAX_CIRCLE_RESOLUTION
#define VTK_THICKCROSS_GLYPH
void SetGlyphTypeToThickCross()
Specify the type of glyph to generate.
void SetGlyphTypeToCircle()
Specify the type of glyph to generate.
#define VTK_NO_GLYPH
void SetGlyphTypeToTriangle()
Specify the type of glyph to generate.
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_SQUARE_GLYPH
Superclass for algorithms that produce only polydata as output.
void SetGlyphTypeToNone()
Specify the type of glyph to generate.
#define VTK_VERTEX_GLYPH
void SetGlyphTypeToHookedArrow()
Specify the type of glyph to generate.
a simple class to control print indentation
Definition: vtkIndent.h:28
#define VTK_DIAMOND_GLYPH
void SetGlyphTypeToCross()
Specify the type of glyph to generate.
void SetGlyphTypeToEdgeArrow()
Specify the type of glyph to generate.
#define VTK_ARROW_GLYPH
dynamic, self-adjusting array of unsigned char
void SetGlyphTypeToSquare()
Specify the type of glyph to generate.
object to represent cell connectivity
Definition: vtkCellArray.h:177
#define VTK_CROSS_GLYPH
#define VTK_CIRCLE_GLYPH
#define VTK_DASH_GLYPH
Store zero or more vtkInformation instances.
#define VTK_MARSHALAUTO
#define VTK_TRIANGLE_GLYPH
create 2D glyphs represented by vtkPolyData
void SetGlyphTypeToDiamond()
Specify the type of glyph to generate.
void SetGlyphTypeToThickArrow()
Specify the type of glyph to generate.
#define VTK_THICKARROW_GLYPH
represent and manipulate 3D points
Definition: vtkPoints.h:30
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetGlyphTypeToArrow()
Specify the type of glyph to generate.