VTK  9.0.20200920
vtkGlyphSource2D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGlyphSource2D.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 =========================================================================*/
30 #ifndef vtkGlyphSource2D_h
31 #define vtkGlyphSource2D_h
32 
33 #include "vtkFiltersSourcesModule.h" // For export macro
34 #include "vtkPolyDataAlgorithm.h"
35 
36 #define VTK_NO_GLYPH 0
37 #define VTK_VERTEX_GLYPH 1
38 #define VTK_DASH_GLYPH 2
39 #define VTK_CROSS_GLYPH 3
40 #define VTK_THICKCROSS_GLYPH 4
41 #define VTK_TRIANGLE_GLYPH 5
42 #define VTK_SQUARE_GLYPH 6
43 #define VTK_CIRCLE_GLYPH 7
44 #define VTK_DIAMOND_GLYPH 8
45 #define VTK_ARROW_GLYPH 9
46 #define VTK_THICKARROW_GLYPH 10
47 #define VTK_HOOKEDARROW_GLYPH 11
48 #define VTK_EDGEARROW_GLYPH 12
49 
50 #define VTK_MAX_CIRCLE_RESOLUTION 1024
51 
52 class vtkPoints;
54 class vtkCellArray;
55 
56 class VTKFILTERSSOURCES_EXPORT vtkGlyphSource2D : public vtkPolyDataAlgorithm
57 {
58 public:
60  void PrintSelf(ostream& os, vtkIndent indent) override;
61 
66  static vtkGlyphSource2D* New();
67 
69 
72  vtkSetVector3Macro(Center, double);
73  vtkGetVectorMacro(Center, double, 3);
75 
77 
81  vtkSetClampMacro(Scale, double, 0.0, VTK_DOUBLE_MAX);
82  vtkGetMacro(Scale, double);
84 
86 
90  vtkSetClampMacro(Scale2, double, 0.0, VTK_DOUBLE_MAX);
91  vtkGetMacro(Scale2, double);
93 
95 
98  vtkSetVector3Macro(Color, double);
99  vtkGetVectorMacro(Color, double, 3);
101 
103 
108  vtkSetMacro(Filled, vtkTypeBool);
109  vtkGetMacro(Filled, vtkTypeBool);
110  vtkBooleanMacro(Filled, vtkTypeBool);
112 
114 
119  vtkSetMacro(Dash, vtkTypeBool);
120  vtkGetMacro(Dash, vtkTypeBool);
121  vtkBooleanMacro(Dash, vtkTypeBool);
123 
125 
130  vtkSetMacro(Cross, vtkTypeBool);
131  vtkGetMacro(Cross, vtkTypeBool);
132  vtkBooleanMacro(Cross, vtkTypeBool);
134 
136 
141  vtkSetMacro(RotationAngle, double);
142  vtkGetMacro(RotationAngle, double);
144 
146 
149  vtkSetClampMacro(Resolution, int, 3, VTK_MAX_CIRCLE_RESOLUTION);
150  vtkGetMacro(Resolution, int);
152 
154 
157  vtkSetClampMacro(GlyphType, int, VTK_NO_GLYPH, VTK_EDGEARROW_GLYPH);
158  vtkGetMacro(GlyphType, int);
159  void SetGlyphTypeToNone() { this->SetGlyphType(VTK_NO_GLYPH); }
160  void SetGlyphTypeToVertex() { this->SetGlyphType(VTK_VERTEX_GLYPH); }
161  void SetGlyphTypeToDash() { this->SetGlyphType(VTK_DASH_GLYPH); }
162  void SetGlyphTypeToCross() { this->SetGlyphType(VTK_CROSS_GLYPH); }
163  void SetGlyphTypeToThickCross() { this->SetGlyphType(VTK_THICKCROSS_GLYPH); }
164  void SetGlyphTypeToTriangle() { this->SetGlyphType(VTK_TRIANGLE_GLYPH); }
165  void SetGlyphTypeToSquare() { this->SetGlyphType(VTK_SQUARE_GLYPH); }
166  void SetGlyphTypeToCircle() { this->SetGlyphType(VTK_CIRCLE_GLYPH); }
167  void SetGlyphTypeToDiamond() { this->SetGlyphType(VTK_DIAMOND_GLYPH); }
168  void SetGlyphTypeToArrow() { this->SetGlyphType(VTK_ARROW_GLYPH); }
169  void SetGlyphTypeToThickArrow() { this->SetGlyphType(VTK_THICKARROW_GLYPH); }
170  void SetGlyphTypeToHookedArrow() { this->SetGlyphType(VTK_HOOKEDARROW_GLYPH); }
171  void SetGlyphTypeToEdgeArrow() { this->SetGlyphType(VTK_EDGEARROW_GLYPH); }
173 
175 
180  vtkSetMacro(OutputPointsPrecision, int);
181  vtkGetMacro(OutputPointsPrecision, int);
183 
184 protected:
186  ~vtkGlyphSource2D() override = default;
187 
189 
190  double Center[3];
191  double Scale;
192  double Scale2;
193  double Color[3];
201 
202  void TransformGlyph(vtkPoints* pts);
203  void ConvertColor();
204  unsigned char RGB[3];
205 
206  void CreateVertex(vtkPoints* pts, vtkCellArray* verts, vtkUnsignedCharArray* colors);
207  void CreateDash(vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys,
208  vtkUnsignedCharArray* colors, double scale);
209  void CreateCross(vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys,
210  vtkUnsignedCharArray* colors, double scale);
211  void CreateThickCross(
212  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
213  void CreateTriangle(
214  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
215  void CreateSquare(
216  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
217  void CreateCircle(
218  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
219  void CreateDiamond(
220  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
221  void CreateArrow(
222  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
223  void CreateThickArrow(
224  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
225  void CreateHookedArrow(
226  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
227  void CreateEdgeArrow(
228  vtkPoints* pts, vtkCellArray* lines, vtkCellArray* polys, vtkUnsignedCharArray* colors);
229 
230 private:
231  vtkGlyphSource2D(const vtkGlyphSource2D&) = delete;
232  void operator=(const vtkGlyphSource2D&) = delete;
233 };
234 
235 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:33
VTK_CROSS_GLYPH
#define VTK_CROSS_GLYPH
Definition: vtkGlyphSource2D.h:39
vtkGlyphSource2D
create 2D glyphs represented by vtkPolyData
Definition: vtkGlyphSource2D.h:56
vtkGlyphSource2D::Scale
double Scale
Definition: vtkGlyphSource2D.h:191
vtkGlyphSource2D::SetGlyphTypeToDiamond
void SetGlyphTypeToDiamond()
Definition: vtkGlyphSource2D.h:167
vtkX3D::scale
Definition: vtkX3D.h:235
vtkGlyphSource2D::Dash
vtkTypeBool Dash
Definition: vtkGlyphSource2D.h:195
vtkGlyphSource2D::Filled
vtkTypeBool Filled
Definition: vtkGlyphSource2D.h:194
VTK_DASH_GLYPH
#define VTK_DASH_GLYPH
Definition: vtkGlyphSource2D.h:38
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
VTK_DIAMOND_GLYPH
#define VTK_DIAMOND_GLYPH
Definition: vtkGlyphSource2D.h:44
vtkGlyphSource2D::SetGlyphTypeToThickCross
void SetGlyphTypeToThickCross()
Definition: vtkGlyphSource2D.h:163
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:35
vtkX3D::Color
Definition: vtkX3D.h:52
vtkGlyphSource2D::SetGlyphTypeToVertex
void SetGlyphTypeToVertex()
Definition: vtkGlyphSource2D.h:160
VTK_CIRCLE_GLYPH
#define VTK_CIRCLE_GLYPH
Definition: vtkGlyphSource2D.h:43
vtkPolyDataAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkGlyphSource2D::Cross
vtkTypeBool Cross
Definition: vtkGlyphSource2D.h:196
vtkPolyDataAlgorithm.h
VTK_TRIANGLE_GLYPH
#define VTK_TRIANGLE_GLYPH
Definition: vtkGlyphSource2D.h:41
VTK_THICKARROW_GLYPH
#define VTK_THICKARROW_GLYPH
Definition: vtkGlyphSource2D.h:46
vtkGlyphSource2D::SetGlyphTypeToTriangle
void SetGlyphTypeToTriangle()
Definition: vtkGlyphSource2D.h:164
vtkGlyphSource2D::SetGlyphTypeToNone
void SetGlyphTypeToNone()
Definition: vtkGlyphSource2D.h:159
vtkPolyDataAlgorithm::RequestData
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkGlyphSource2D::SetGlyphTypeToThickArrow
void SetGlyphTypeToThickArrow()
Definition: vtkGlyphSource2D.h:169
vtkGlyphSource2D::OutputPointsPrecision
int OutputPointsPrecision
Definition: vtkGlyphSource2D.h:200
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:180
VTK_EDGEARROW_GLYPH
#define VTK_EDGEARROW_GLYPH
Definition: vtkGlyphSource2D.h:48
vtkGlyphSource2D::Scale2
double Scale2
Definition: vtkGlyphSource2D.h:192
vtkGlyphSource2D::SetGlyphTypeToSquare
void SetGlyphTypeToSquare()
Definition: vtkGlyphSource2D.h:165
vtkGlyphSource2D::SetGlyphTypeToCross
void SetGlyphTypeToCross()
Definition: vtkGlyphSource2D.h:162
vtkGlyphSource2D::SetGlyphTypeToArrow
void SetGlyphTypeToArrow()
Definition: vtkGlyphSource2D.h:168
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
VTK_THICKCROSS_GLYPH
#define VTK_THICKCROSS_GLYPH
Definition: vtkGlyphSource2D.h:40
VTK_SQUARE_GLYPH
#define VTK_SQUARE_GLYPH
Definition: vtkGlyphSource2D.h:42
VTK_HOOKEDARROW_GLYPH
#define VTK_HOOKEDARROW_GLYPH
Definition: vtkGlyphSource2D.h:47
vtkGlyphSource2D::Resolution
int Resolution
Definition: vtkGlyphSource2D.h:199
vtkGlyphSource2D::SetGlyphTypeToHookedArrow
void SetGlyphTypeToHookedArrow()
Definition: vtkGlyphSource2D.h:170
vtkGlyphSource2D::SetGlyphTypeToEdgeArrow
void SetGlyphTypeToEdgeArrow()
Definition: vtkGlyphSource2D.h:171
vtkGlyphSource2D::SetGlyphTypeToCircle
void SetGlyphTypeToCircle()
Definition: vtkGlyphSource2D.h:166
VTK_VERTEX_GLYPH
#define VTK_VERTEX_GLYPH
Definition: vtkGlyphSource2D.h:37
vtkGlyphSource2D::RotationAngle
double RotationAngle
Definition: vtkGlyphSource2D.h:198
vtkGlyphSource2D::SetGlyphTypeToDash
void SetGlyphTypeToDash()
Definition: vtkGlyphSource2D.h:161
VTK_ARROW_GLYPH
#define VTK_ARROW_GLYPH
Definition: vtkGlyphSource2D.h:45
VTK_MAX_CIRCLE_RESOLUTION
#define VTK_MAX_CIRCLE_RESOLUTION
Definition: vtkGlyphSource2D.h:50
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX
Definition: vtkType.h:157
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkPolyDataAlgorithm::New
static vtkPolyDataAlgorithm * New()
vtkGlyphSource2D::GlyphType
int GlyphType
Definition: vtkGlyphSource2D.h:197
VTK_NO_GLYPH
#define VTK_NO_GLYPH
Definition: vtkGlyphSource2D.h:36
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:41