Slicer  4.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkAnnotationGlyphSource2D.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  Program: 3D Slicer
9  Module: $RCSfile: vtkAnnotationGlyphSource2D.h,v $
10  Date: $Date: 2010-02-15 16:35:35 -0500 (Mon, 15 Feb 2010) $
11  Version: $Revision: 12142 $
12 
13 =========================================================================auto=*/
20 //
26 
27 #ifndef __vtkAnnotationGlyphSource2D_h
28 #define __vtkAnnotationGlyphSource2D_h
29 
30 // Annotations includes
31 #include "vtkSlicerAnnotationsModuleVTKWidgetsExport.h"
32 
33 // VTK includes
34 #include <vtkGlyphSource2D.h>
35 #include <vtkPolyDataAlgorithm.h>
36 
37 /*
39 #define VTK_NO_GLYPH 0
40 #define VTK_VERTEX_GLYPH 1
41 #define VTK_DASH_GLYPH 2
42 #define VTK_CROSS_GLYPH 3
43 #define VTK_THICKCROSS_GLYPH 4
44 #define VTK_TRIANGLE_GLYPH 5
45 #define VTK_SQUARE_GLYPH 6
46 #define VTK_CIRCLE_GLYPH 7
47 #define VTK_DIAMOND_GLYPH 8
48 #define VTK_ARROW_GLYPH 9
49 #define VTK_THICKARROW_GLYPH 10
50 #define VTK_HOOKEDARROW_GLYPH 11
51 */
53 #define VTK_STARBURST_GLYPH 12
54 
55 class vtkPoints;
56 class vtkUnsignedCharArray;
57 class vtkCellArray;
58 
59 class VTK_SLICER_ANNOTATIONS_MODULE_VTKWIDGETS_EXPORT
61  : public vtkPolyDataAlgorithm
62 {
63 public:
64  vtkTypeMacro(vtkAnnotationGlyphSource2D,vtkPolyDataAlgorithm);
65  void PrintSelf(ostream& os, vtkIndent indent) override;
66 
70  static vtkAnnotationGlyphSource2D *New();
71 
74  vtkSetVector3Macro(Center,double);
75  vtkGetVectorMacro(Center,double,3);
76 
80  vtkSetClampMacro(Scale,double,0.0,VTK_DOUBLE_MAX);
81  vtkGetMacro(Scale,double);
82 
86  vtkSetClampMacro(Scale2,double,0.0,VTK_DOUBLE_MAX);
87  vtkGetMacro(Scale2,double);
88 
91  vtkSetVector3Macro(Color,double);
92  vtkGetVectorMacro(Color,double,3);
93 
98  vtkSetMacro(Filled,int);
99  vtkGetMacro(Filled,int);
100  vtkBooleanMacro(Filled,int);
101 
106  vtkSetMacro(Dash,int);
107  vtkGetMacro(Dash,int);
108  vtkBooleanMacro(Dash,int);
109 
114  vtkSetMacro(Cross,int);
115  vtkGetMacro(Cross,int);
116  vtkBooleanMacro(Cross,int);
117 
122  vtkSetMacro(RotationAngle,double);
123  vtkGetMacro(RotationAngle,double);
124 
127  vtkSetClampMacro(GlyphType,int,VTK_NO_GLYPH,VTK_STARBURST_GLYPH);
128  vtkGetMacro(GlyphType,int);
129  void SetGlyphTypeToNone() {this->SetGlyphType(VTK_NO_GLYPH);}
130  void SetGlyphTypeToVertex() {this->SetGlyphType(VTK_VERTEX_GLYPH);}
131  void SetGlyphTypeToDash() {this->SetGlyphType(VTK_DASH_GLYPH);}
132  void SetGlyphTypeToCross() {this->SetGlyphType(VTK_CROSS_GLYPH);}
133  void SetGlyphTypeToThickCross() {this->SetGlyphType(VTK_THICKCROSS_GLYPH);}
134  void SetGlyphTypeToTriangle() {this->SetGlyphType(VTK_TRIANGLE_GLYPH);}
135  void SetGlyphTypeToSquare() {this->SetGlyphType(VTK_SQUARE_GLYPH);}
136  void SetGlyphTypeToCircle() {this->SetGlyphType(VTK_CIRCLE_GLYPH);}
137  void SetGlyphTypeToDiamond() {this->SetGlyphType(VTK_DIAMOND_GLYPH);}
138  void SetGlyphTypeToArrow() {this->SetGlyphType(VTK_ARROW_GLYPH);}
139  void SetGlyphTypeToThickArrow() {this->SetGlyphType(VTK_THICKARROW_GLYPH);}
140  void SetGlyphTypeToHookedArrow() {this->SetGlyphType(VTK_HOOKEDARROW_GLYPH);}
141  void SetGlyphTypeToStarBurst() {this->SetGlyphType(VTK_STARBURST_GLYPH);}
142 
143  void SetGlyphTypeAsString(const char* type);
144 
145 protected:
147  ~vtkAnnotationGlyphSource2D() override = default;
148 
149  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override;
150 
151  double Center[3];
152  double Scale;
153  double Scale2;
154  double Color[3];
155  int Filled;
156  int Dash;
157  int Cross;
160 
161  void TransformGlyph(vtkPoints *pts);
162  void ConvertColor();
163  unsigned char RGB[3];
164 
165  void CreateVertex(vtkPoints *pts, vtkCellArray *verts,
166  vtkUnsignedCharArray *colors);
167  void CreateDash(vtkPoints *pts, vtkCellArray *lines,
168  vtkCellArray *polys, vtkUnsignedCharArray *colors, double scale);
169  void CreateCross(vtkPoints *pts, vtkCellArray *lines,
170  vtkCellArray *polys, vtkUnsignedCharArray *colors, double scale);
171  void CreateThickCross(vtkPoints *pts, vtkCellArray *lines,
172  vtkCellArray *polys, vtkUnsignedCharArray *colors);
173  void CreateTriangle(vtkPoints *pts, vtkCellArray *lines,
174  vtkCellArray *polys, vtkUnsignedCharArray *colors);
175  void CreateSquare(vtkPoints *pts, vtkCellArray *lines,
176  vtkCellArray *polys, vtkUnsignedCharArray *colors);
177  void CreateCircle(vtkPoints *pts, vtkCellArray *lines,
178  vtkCellArray *polys, vtkUnsignedCharArray *colors);
179  void CreateDiamond(vtkPoints *pts, vtkCellArray *lines,
180  vtkCellArray *polys, vtkUnsignedCharArray *colors);
181  void CreateArrow(vtkPoints *pts, vtkCellArray *lines,
182  vtkCellArray *polys, vtkUnsignedCharArray *colors);
183  void CreateThickArrow(vtkPoints *pts, vtkCellArray *lines,
184  vtkCellArray *polys, vtkUnsignedCharArray *colors);
185  void CreateHookedArrow(vtkPoints *pts, vtkCellArray *lines,
186  vtkCellArray *polys, vtkUnsignedCharArray *colors);
187  void CreateStarBurst(vtkPoints *pts, vtkCellArray *lines,
188  vtkCellArray *polys, vtkUnsignedCharArray *colors, double scale);
189 
190 private:
192  void operator=(const vtkAnnotationGlyphSource2D&) = delete;
193 };
194 
195 #endif
#define VTK_STARBURST_GLYPH
when add new glyph types, make sure to increase the clamp