Slicer  4.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkSlicerGlyphSource2D.h
Go to the documentation of this file.
1 /*=auto=========================================================================
2 
3  Portions (c) Copyright 2007 Brigham and Women's Hospital (BWH) All Rights Reserved.
4 
5  See COPYRIGHT.txt
6  or http://www.slicer.org/copyright/copyright.txt for details.
7 
8 =========================================================================auto=*/
15 //
21 
22 #ifndef __vtkSlicerGlyphSource2D_h
23 #define __vtkSlicerGlyphSource2D_h
24 
25 #include "vtkSlicerBaseLogic.h"
26 #include "vtkGlyphSource2D.h"
27 
28 #include "vtkPolyDataAlgorithm.h"
29 
30 /*
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 */
46 #define VTK_STARBURST_GLYPH 12
47 
48 class vtkPoints;
49 class vtkUnsignedCharArray;
50 class vtkCellArray;
51 
52 class VTK_SLICER_BASE_LOGIC_EXPORT vtkSlicerGlyphSource2D : public vtkPolyDataAlgorithm
53 {
54 public:
55  vtkTypeMacro(vtkSlicerGlyphSource2D,vtkPolyDataAlgorithm);
56  void PrintSelf(ostream& os, vtkIndent indent) override;
57 
61  static vtkSlicerGlyphSource2D *New();
62 
65  vtkSetVector3Macro(Center,double);
66  vtkGetVectorMacro(Center,double,3);
67 
71  vtkSetClampMacro(Scale,double,0.0,VTK_DOUBLE_MAX);
72  vtkGetMacro(Scale,double);
73 
77  vtkSetClampMacro(Scale2,double,0.0,VTK_DOUBLE_MAX);
78  vtkGetMacro(Scale2,double);
79 
82  vtkSetVector3Macro(Color,double);
83  vtkGetVectorMacro(Color,double,3);
84 
89  vtkSetMacro(Filled,int);
90  vtkGetMacro(Filled,int);
91  vtkBooleanMacro(Filled,int);
92 
97  vtkSetMacro(Dash,int);
98  vtkGetMacro(Dash,int);
99  vtkBooleanMacro(Dash,int);
100 
105  vtkSetMacro(Cross,int);
106  vtkGetMacro(Cross,int);
107  vtkBooleanMacro(Cross,int);
108 
113  vtkSetMacro(RotationAngle,double);
114  vtkGetMacro(RotationAngle,double);
115 
118  vtkSetClampMacro(GlyphType,int,VTK_NO_GLYPH,VTK_STARBURST_GLYPH);
119  vtkGetMacro(GlyphType,int);
120  void SetGlyphTypeToNone() {this->SetGlyphType(VTK_NO_GLYPH);}
121  void SetGlyphTypeToVertex() {this->SetGlyphType(VTK_VERTEX_GLYPH);}
122  void SetGlyphTypeToDash() {this->SetGlyphType(VTK_DASH_GLYPH);}
123  void SetGlyphTypeToCross() {this->SetGlyphType(VTK_CROSS_GLYPH);}
124  void SetGlyphTypeToThickCross() {this->SetGlyphType(VTK_THICKCROSS_GLYPH);}
125  void SetGlyphTypeToTriangle() {this->SetGlyphType(VTK_TRIANGLE_GLYPH);}
126  void SetGlyphTypeToSquare() {this->SetGlyphType(VTK_SQUARE_GLYPH);}
127  void SetGlyphTypeToCircle() {this->SetGlyphType(VTK_CIRCLE_GLYPH);}
128  void SetGlyphTypeToDiamond() {this->SetGlyphType(VTK_DIAMOND_GLYPH);}
129  void SetGlyphTypeToArrow() {this->SetGlyphType(VTK_ARROW_GLYPH);}
130  void SetGlyphTypeToThickArrow() {this->SetGlyphType(VTK_THICKARROW_GLYPH);}
131  void SetGlyphTypeToHookedArrow() {this->SetGlyphType(VTK_HOOKEDARROW_GLYPH);}
132  void SetGlyphTypeToStarBurst() {this->SetGlyphType(VTK_STARBURST_GLYPH);}
133 
134  void SetGlyphTypeAsString(const char* type);
135 
136 protected:
138  ~vtkSlicerGlyphSource2D() override = default;
139 
140  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override;
141 
142  double Center[3];
143  double Scale;
144  double Scale2;
145  double Color[3];
146  int Filled;
147  int Dash;
148  int Cross;
151 
152  void TransformGlyph(vtkPoints *pts);
153  void ConvertColor();
154  unsigned char RGB[3];
155 
156  void CreateVertex(vtkPoints *pts, vtkCellArray *verts,
157  vtkUnsignedCharArray *colors);
158  void CreateDash(vtkPoints *pts, vtkCellArray *lines,
159  vtkCellArray *polys, vtkUnsignedCharArray *colors, double scale);
160  void CreateCross(vtkPoints *pts, vtkCellArray *lines,
161  vtkCellArray *polys, vtkUnsignedCharArray *colors, double scale);
162  void CreateThickCross(vtkPoints *pts, vtkCellArray *lines,
163  vtkCellArray *polys, vtkUnsignedCharArray *colors);
164  void CreateTriangle(vtkPoints *pts, vtkCellArray *lines,
165  vtkCellArray *polys, vtkUnsignedCharArray *colors);
166  void CreateSquare(vtkPoints *pts, vtkCellArray *lines,
167  vtkCellArray *polys, vtkUnsignedCharArray *colors);
168  void CreateCircle(vtkPoints *pts, vtkCellArray *lines,
169  vtkCellArray *polys, vtkUnsignedCharArray *colors);
170  void CreateDiamond(vtkPoints *pts, vtkCellArray *lines,
171  vtkCellArray *polys, vtkUnsignedCharArray *colors);
172  void CreateArrow(vtkPoints *pts, vtkCellArray *lines,
173  vtkCellArray *polys, vtkUnsignedCharArray *colors);
174  void CreateThickArrow(vtkPoints *pts, vtkCellArray *lines,
175  vtkCellArray *polys, vtkUnsignedCharArray *colors);
176  void CreateHookedArrow(vtkPoints *pts, vtkCellArray *lines,
177  vtkCellArray *polys, vtkUnsignedCharArray *colors);
178  void CreateStarBurst(vtkPoints *pts, vtkCellArray *lines,
179  vtkCellArray *polys, vtkUnsignedCharArray *colors, double scale);
180 
181 private:
183  void operator=(const vtkSlicerGlyphSource2D&) = delete;
184 };
185 
186 #endif
#define VTK_STARBURST_GLYPH
when add new glyph types, make sure to increase the clamp