Slicer  5.3
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 
29 //
35 
36 #ifndef __vtkMarkupsGlyphSource2D_h
37 #define __vtkMarkupsGlyphSource2D_h
38 
39 #include "vtkSlicerMarkupsModuleVTKWidgetsExport.h"
40 
41 #include "vtkSlicerBaseLogic.h"
42 
43 // VTK includes
44 #include "vtkGlyphSource2D.h"
45 #include "vtkPolyDataAlgorithm.h"
46 
47 class vtkPoints;
48 class vtkUnsignedCharArray;
49 class vtkCellArray;
50 
51 class VTK_SLICER_MARKUPS_MODULE_VTKWIDGETS_EXPORT vtkMarkupsGlyphSource2D : public vtkPolyDataAlgorithm
52 {
53 public:
54  vtkTypeMacro(vtkMarkupsGlyphSource2D,vtkPolyDataAlgorithm);
55  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
59  static vtkMarkupsGlyphSource2D *New();
60 
62  vtkSetVector3Macro(Center,double);
63  vtkGetVectorMacro(Center,double,3);
64 
67  vtkSetClampMacro(Scale,double,0.0,VTK_DOUBLE_MAX);
68  vtkGetMacro(Scale,double);
69 
72  vtkSetClampMacro(Scale2,double,0.0,VTK_DOUBLE_MAX);
73  vtkGetMacro(Scale2,double);
74 
76  vtkSetVector3Macro(Color,double);
77  vtkGetVectorMacro(Color,double,3);
78 
82  vtkSetMacro(Filled,int);
83  vtkGetMacro(Filled,int);
84  vtkBooleanMacro(Filled,int);
85 
89  vtkSetMacro(Dash,int);
90  vtkGetMacro(Dash,int);
91  vtkBooleanMacro(Dash,int);
92 
96  vtkSetMacro(Cross,int);
97  vtkGetMacro(Cross,int);
98  vtkBooleanMacro(Cross,int);
99 
103  vtkSetMacro(RotationAngle,double);
104  vtkGetMacro(RotationAngle,double);
105 
107  vtkSetClampMacro(GlyphType,int, GlyphNone, GlyphType_Last-1);
108  vtkGetMacro(GlyphType,int);
109  void SetGlyphTypeToNone() {this->SetGlyphType(GlyphNone);}
110  void SetGlyphTypeToStarBurst() {this->SetGlyphType(GlyphStarBurst);}
111  void SetGlyphTypeToCross() {this->SetGlyphType(GlyphCross);}
112  void SetGlyphTypeToCrossDot() { this->SetGlyphType(GlyphCrossDot); }
113  void SetGlyphTypeToThickCross() {this->SetGlyphType(GlyphThickCross);}
114  void SetGlyphTypeToVertex() {this->SetGlyphType(GlyphVertex);}
115  void SetGlyphTypeToDash() {this->SetGlyphType(GlyphDash);}
116  void SetGlyphTypeToTriangle() {this->SetGlyphType(GlyphTriangle);}
117  void SetGlyphTypeToSquare() {this->SetGlyphType(GlyphSquare);}
118  void SetGlyphTypeToCircle() {this->SetGlyphType(GlyphCircle);}
119  void SetGlyphTypeToDiamond() {this->SetGlyphType(GlyphDiamond);}
120  void SetGlyphTypeToArrow() {this->SetGlyphType(GlyphArrow);}
121  void SetGlyphTypeToThickArrow() {this->SetGlyphType(GlyphThickArrow);}
122  void SetGlyphTypeToHookedArrow() {this->SetGlyphType(GlyphHookedArrow);}
123 
124  void SetNextGlyphType();
125 
127  {
128  GlyphNone = 0,
142  GlyphType_Last // insert new types above this line
143  };
144 
145 protected:
147  ~vtkMarkupsGlyphSource2D() 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 = 1.0);
169  void CreateCross(vtkPoints *pts, vtkCellArray *lines,
170  vtkCellArray *polys, vtkUnsignedCharArray *colors, double scale = 1.0, bool dot=false);
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);
189 
190 private:
192  void operator=(const vtkMarkupsGlyphSource2D&) = delete;
193 };
194 
195 #endif