VTK
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 =========================================================================*/
36 #ifndef vtkGlyphSource2D_h
37 #define vtkGlyphSource2D_h
38 
39 #include "vtkFiltersSourcesModule.h" // For export macro
40 #include "vtkPolyDataAlgorithm.h"
41 
42 #define VTK_NO_GLYPH 0
43 #define VTK_VERTEX_GLYPH 1
44 #define VTK_DASH_GLYPH 2
45 #define VTK_CROSS_GLYPH 3
46 #define VTK_THICKCROSS_GLYPH 4
47 #define VTK_TRIANGLE_GLYPH 5
48 #define VTK_SQUARE_GLYPH 6
49 #define VTK_CIRCLE_GLYPH 7
50 #define VTK_DIAMOND_GLYPH 8
51 #define VTK_ARROW_GLYPH 9
52 #define VTK_THICKARROW_GLYPH 10
53 #define VTK_HOOKEDARROW_GLYPH 11
54 #define VTK_EDGEARROW_GLYPH 12
55 
56 #define VTK_MAX_CIRCLE_RESOLUTION 1024
57 
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 
190 protected:
192  ~vtkGlyphSource2D() override {}
193 
195 
196  double Center[3];
197  double Scale;
198  double Scale2;
199  double Color[3];
207 
208  void TransformGlyph(vtkPoints *pts);
209  void ConvertColor();
210  unsigned char RGB[3];
211 
212  void CreateVertex(vtkPoints *pts, vtkCellArray *verts,
213  vtkUnsignedCharArray *colors);
214  void CreateDash(vtkPoints *pts, vtkCellArray *lines,
215  vtkCellArray *polys, vtkUnsignedCharArray *colors, double scale);
216  void CreateCross(vtkPoints *pts, vtkCellArray *lines,
217  vtkCellArray *polys, vtkUnsignedCharArray *colors, double scale);
218  void CreateThickCross(vtkPoints *pts, vtkCellArray *lines,
219  vtkCellArray *polys, vtkUnsignedCharArray *colors);
220  void CreateTriangle(vtkPoints *pts, vtkCellArray *lines,
221  vtkCellArray *polys, vtkUnsignedCharArray *colors);
222  void CreateSquare(vtkPoints *pts, vtkCellArray *lines,
223  vtkCellArray *polys, vtkUnsignedCharArray *colors);
224  void CreateCircle(vtkPoints *pts, vtkCellArray *lines,
225  vtkCellArray *polys, vtkUnsignedCharArray *colors);
226  void CreateDiamond(vtkPoints *pts, vtkCellArray *lines,
227  vtkCellArray *polys, vtkUnsignedCharArray *colors);
228  void CreateArrow(vtkPoints *pts, vtkCellArray *lines,
229  vtkCellArray *polys, vtkUnsignedCharArray *colors);
230  void CreateThickArrow(vtkPoints *pts, vtkCellArray *lines,
231  vtkCellArray *polys, vtkUnsignedCharArray *colors);
232  void CreateHookedArrow(vtkPoints *pts, vtkCellArray *lines,
233  vtkCellArray *polys, vtkUnsignedCharArray *colors);
234  void CreateEdgeArrow(vtkPoints *pts, vtkCellArray *lines,
235  vtkCellArray *polys, vtkUnsignedCharArray *colors);
236 
237 private:
238  vtkGlyphSource2D(const vtkGlyphSource2D&) = delete;
239  void operator=(const vtkGlyphSource2D&) = delete;
240 };
241 
242 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
VTK_CROSS_GLYPH
#define VTK_CROSS_GLYPH
Definition: vtkGlyphSource2D.h:45
vtkGlyphSource2D
create 2D glyphs represented by vtkPolyData
Definition: vtkGlyphSource2D.h:62
vtkGlyphSource2D::Scale
double Scale
Definition: vtkGlyphSource2D.h:197
vtkGlyphSource2D::SetGlyphTypeToDiamond
void SetGlyphTypeToDiamond()
Definition: vtkGlyphSource2D.h:173
vtkX3D::scale
Definition: vtkX3D.h:229
vtkGlyphSource2D::Dash
vtkTypeBool Dash
Definition: vtkGlyphSource2D.h:201
vtkGlyphSource2D::Filled
vtkTypeBool Filled
Definition: vtkGlyphSource2D.h:200
VTK_DASH_GLYPH
#define VTK_DASH_GLYPH
Definition: vtkGlyphSource2D.h:44
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
VTK_DIAMOND_GLYPH
#define VTK_DIAMOND_GLYPH
Definition: vtkGlyphSource2D.h:50
vtkGlyphSource2D::SetGlyphTypeToThickCross
void SetGlyphTypeToThickCross()
Definition: vtkGlyphSource2D.h:169
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:41
vtkX3D::Color
Definition: vtkX3D.h:46
vtkGlyphSource2D::SetGlyphTypeToVertex
void SetGlyphTypeToVertex()
Definition: vtkGlyphSource2D.h:166
VTK_CIRCLE_GLYPH
#define VTK_CIRCLE_GLYPH
Definition: vtkGlyphSource2D.h:49
vtkGlyphSource2D::~vtkGlyphSource2D
~vtkGlyphSource2D() override
Definition: vtkGlyphSource2D.h:192
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:202
vtkPolyDataAlgorithm.h
VTK_TRIANGLE_GLYPH
#define VTK_TRIANGLE_GLYPH
Definition: vtkGlyphSource2D.h:47
VTK_THICKARROW_GLYPH
#define VTK_THICKARROW_GLYPH
Definition: vtkGlyphSource2D.h:52
vtkGlyphSource2D::SetGlyphTypeToTriangle
void SetGlyphTypeToTriangle()
Definition: vtkGlyphSource2D.h:170
vtkGlyphSource2D::SetGlyphTypeToNone
void SetGlyphTypeToNone()
Definition: vtkGlyphSource2D.h:165
vtkPolyDataAlgorithm::RequestData
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkGlyphSource2D::SetGlyphTypeToThickArrow
void SetGlyphTypeToThickArrow()
Definition: vtkGlyphSource2D.h:175
vtkGlyphSource2D::OutputPointsPrecision
int OutputPointsPrecision
Definition: vtkGlyphSource2D.h:206
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:50
VTK_EDGEARROW_GLYPH
#define VTK_EDGEARROW_GLYPH
Definition: vtkGlyphSource2D.h:54
vtkGlyphSource2D::Scale2
double Scale2
Definition: vtkGlyphSource2D.h:198
vtkGlyphSource2D::SetGlyphTypeToSquare
void SetGlyphTypeToSquare()
Definition: vtkGlyphSource2D.h:171
vtkGlyphSource2D::SetGlyphTypeToCross
void SetGlyphTypeToCross()
Definition: vtkGlyphSource2D.h:168
vtkGlyphSource2D::SetGlyphTypeToArrow
void SetGlyphTypeToArrow()
Definition: vtkGlyphSource2D.h:174
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
VTK_THICKCROSS_GLYPH
#define VTK_THICKCROSS_GLYPH
Definition: vtkGlyphSource2D.h:46
VTK_SQUARE_GLYPH
#define VTK_SQUARE_GLYPH
Definition: vtkGlyphSource2D.h:48
VTK_HOOKEDARROW_GLYPH
#define VTK_HOOKEDARROW_GLYPH
Definition: vtkGlyphSource2D.h:53
vtkGlyphSource2D::Resolution
int Resolution
Definition: vtkGlyphSource2D.h:205
vtkGlyphSource2D::SetGlyphTypeToHookedArrow
void SetGlyphTypeToHookedArrow()
Definition: vtkGlyphSource2D.h:176
vtkGlyphSource2D::SetGlyphTypeToEdgeArrow
void SetGlyphTypeToEdgeArrow()
Definition: vtkGlyphSource2D.h:177
vtkGlyphSource2D::SetGlyphTypeToCircle
void SetGlyphTypeToCircle()
Definition: vtkGlyphSource2D.h:172
VTK_VERTEX_GLYPH
#define VTK_VERTEX_GLYPH
Definition: vtkGlyphSource2D.h:43
vtkGlyphSource2D::RotationAngle
double RotationAngle
Definition: vtkGlyphSource2D.h:204
vtkGlyphSource2D::SetGlyphTypeToDash
void SetGlyphTypeToDash()
Definition: vtkGlyphSource2D.h:167
VTK_ARROW_GLYPH
#define VTK_ARROW_GLYPH
Definition: vtkGlyphSource2D.h:51
VTK_MAX_CIRCLE_RESOLUTION
#define VTK_MAX_CIRCLE_RESOLUTION
Definition: vtkGlyphSource2D.h:56
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX
Definition: vtkType.h:169
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkPolyDataAlgorithm::New
static vtkPolyDataAlgorithm * New()
vtkGlyphSource2D::GlyphType
int GlyphType
Definition: vtkGlyphSource2D.h:203
VTK_NO_GLYPH
#define VTK_NO_GLYPH
Definition: vtkGlyphSource2D.h:42
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:44