Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMarkupsGlyphSource2D.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Portions (c) Copyright Brigham and Women's Hospital (BWH) All Rights Reserved.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16 ==============================================================================*/
17 
24 //
30 
31 #ifndef __vtkMarkupsGlyphSource2D_h
32 #define __vtkMarkupsGlyphSource2D_h
33 
34 #include "vtkSlicerMarkupsModuleVTKWidgetsExport.h"
35 
36 #include "vtkSlicerBaseLogic.h"
37 
38 // VTK includes
39 #include "vtkGlyphSource2D.h"
40 #include "vtkPolyDataAlgorithm.h"
41 
43 #define VTK_STARBURST_GLYPH 12
44 
45 class vtkPoints;
46 class vtkUnsignedCharArray;
47 class vtkCellArray;
48 
49 class VTK_SLICER_MARKUPS_MODULE_VTKWIDGETS_EXPORT vtkMarkupsGlyphSource2D : public vtkPolyDataAlgorithm
50 {
51 public:
52  vtkTypeMacro(vtkMarkupsGlyphSource2D,vtkPolyDataAlgorithm);
53  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
54 
57  static vtkMarkupsGlyphSource2D *New();
58 
60  vtkSetVector3Macro(Center,double);
61  vtkGetVectorMacro(Center,double,3);
62 
65  vtkSetClampMacro(Scale,double,0.0,VTK_DOUBLE_MAX);
66  vtkGetMacro(Scale,double);
67 
70  vtkSetClampMacro(Scale2,double,0.0,VTK_DOUBLE_MAX);
71  vtkGetMacro(Scale2,double);
72 
74  vtkSetVector3Macro(Color,double);
75  vtkGetVectorMacro(Color,double,3);
76 
80  vtkSetMacro(Filled,int);
81  vtkGetMacro(Filled,int);
82  vtkBooleanMacro(Filled,int);
83 
87  vtkSetMacro(Dash,int);
88  vtkGetMacro(Dash,int);
89  vtkBooleanMacro(Dash,int);
90 
94  vtkSetMacro(Cross,int);
95  vtkGetMacro(Cross,int);
96  vtkBooleanMacro(Cross,int);
97 
101  vtkSetMacro(RotationAngle,double);
102  vtkGetMacro(RotationAngle,double);
103 
105  vtkSetClampMacro(GlyphType,int,VTK_NO_GLYPH,VTK_STARBURST_GLYPH);
106  vtkGetMacro(GlyphType,int);
107  void SetGlyphTypeToNone() {this->SetGlyphType(VTK_NO_GLYPH);}
108  void SetGlyphTypeToVertex() {this->SetGlyphType(VTK_VERTEX_GLYPH);}
109  void SetGlyphTypeToDash() {this->SetGlyphType(VTK_DASH_GLYPH);}
110  void SetGlyphTypeToCross() {this->SetGlyphType(VTK_CROSS_GLYPH);}
111  void SetGlyphTypeToThickCross() {this->SetGlyphType(VTK_THICKCROSS_GLYPH);}
112  void SetGlyphTypeToTriangle() {this->SetGlyphType(VTK_TRIANGLE_GLYPH);}
113  void SetGlyphTypeToSquare() {this->SetGlyphType(VTK_SQUARE_GLYPH);}
114  void SetGlyphTypeToCircle() {this->SetGlyphType(VTK_CIRCLE_GLYPH);}
115  void SetGlyphTypeToDiamond() {this->SetGlyphType(VTK_DIAMOND_GLYPH);}
116  void SetGlyphTypeToArrow() {this->SetGlyphType(VTK_ARROW_GLYPH);}
117  void SetGlyphTypeToThickArrow() {this->SetGlyphType(VTK_THICKARROW_GLYPH);}
118  void SetGlyphTypeToHookedArrow() {this->SetGlyphType(VTK_HOOKEDARROW_GLYPH);}
119  void SetGlyphTypeToStarBurst() {this->SetGlyphType(VTK_STARBURST_GLYPH);}
120 
121  void SetGlyphTypeAsString(const char* type);
122 
123 protected:
126 
127  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
128 
129  double Center[3];
130  double Scale;
131  double Scale2;
132  double Color[3];
133  int Filled;
134  int Dash;
135  int Cross;
138 
139  void TransformGlyph(vtkPoints *pts);
140  void ConvertColor();
141  unsigned char RGB[3];
142 
143  void CreateVertex(vtkPoints *pts, vtkCellArray *verts,
144  vtkUnsignedCharArray *colors);
145  void CreateDash(vtkPoints *pts, vtkCellArray *lines,
146  vtkCellArray *polys, vtkUnsignedCharArray *colors, double scale = 1.0);
147  void CreateCross(vtkPoints *pts, vtkCellArray *lines,
148  vtkCellArray *polys, vtkUnsignedCharArray *colors, double scale = 1.0);
149  void CreateThickCross(vtkPoints *pts, vtkCellArray *lines,
150  vtkCellArray *polys, vtkUnsignedCharArray *colors);
151  void CreateTriangle(vtkPoints *pts, vtkCellArray *lines,
152  vtkCellArray *polys, vtkUnsignedCharArray *colors);
153  void CreateSquare(vtkPoints *pts, vtkCellArray *lines,
154  vtkCellArray *polys, vtkUnsignedCharArray *colors);
155  void CreateCircle(vtkPoints *pts, vtkCellArray *lines,
156  vtkCellArray *polys, vtkUnsignedCharArray *colors);
157  void CreateDiamond(vtkPoints *pts, vtkCellArray *lines,
158  vtkCellArray *polys, vtkUnsignedCharArray *colors);
159  void CreateArrow(vtkPoints *pts, vtkCellArray *lines,
160  vtkCellArray *polys, vtkUnsignedCharArray *colors);
161  void CreateThickArrow(vtkPoints *pts, vtkCellArray *lines,
162  vtkCellArray *polys, vtkUnsignedCharArray *colors);
163  void CreateHookedArrow(vtkPoints *pts, vtkCellArray *lines,
164  vtkCellArray *polys, vtkUnsignedCharArray *colors);
165  void CreateStarBurst(vtkPoints *pts, vtkCellArray *lines,
166  vtkCellArray *polys, vtkUnsignedCharArray *colors);
167 
168 private:
170  void operator=(const vtkMarkupsGlyphSource2D&);
171 };
172 
173 #endif
#define VTK_STARBURST_GLYPH
when add new glyph types, make sure to increase the clamp