]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/creaContoursFactory.cpp
Creatiation of the factory of contours
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / manualContour / creaContoursFactory.cpp
1 #include "creaContoursFactory.h"
2
3 creaContoursFactory::creaContoursFactory()
4 {
5
6 }
7
8
9 creaContoursFactory::~creaContoursFactory()
10 {
11
12 }
13
14 manualContourBaseControler* creaContoursFactory::getContourControler(int typeContour)
15 {
16         manualContourBaseControler *manContourControl;
17         //spline
18         if (typeContour==1)
19         {
20                 manContourControl       = new manualContourControler();
21         }
22
23         //rectangle
24         if (typeContour==2)
25         {
26                 manContourControl       = new manualRoiControler();
27         }
28
29         //circle
30         if (typeContour==3)
31         {
32                 manContourControl       = new manualCircleControler();
33         }
34
35         //bullEye
36         if (typeContour==4)
37         {
38                 manContourControl       = new manualRoiControler();
39         }
40
41         //line
42         if (typeContour==6)
43         {
44                 manContourControl       = new manualLineControler();
45         }
46
47         //points
48         if (typeContour==7)
49         {
50                 manContourControl       = new manualContourControler();
51         }
52
53         //rotationTool
54         if (typeContour==8)
55         {
56                 manContourControl       = new manualRotationToolControler();
57         }
58         
59         //polygon
60         if (typeContour==10)
61         {
62                 manContourControl       = new manualContourControler();
63         }
64         return manContourControl;
65
66         
67
68 }
69
70 manualContourBaseControler* creaContoursFactory::getContourControler(std::string typeContour)
71 {
72         manualContourBaseControler *manContourControl;
73         if (typeContour.compare("spline")==0)
74         {
75                         manContourControl = getContourControler(1);
76         }
77
78         if (typeContour.compare("rectangle")==0)
79         {
80                 manContourControl = getContourControler(2);
81         }
82
83         if (typeContour.compare("circle")==0)
84         {
85                 manContourControl = getContourControler(3);
86         }
87
88         if (typeContour.compare("bullEye")==0)
89         {
90                 manContourControl = getContourControler(4);
91         }
92
93         if (typeContour.compare("line")==0)
94         {
95                 manContourControl = getContourControler(6);
96         }
97         
98         if (typeContour.compare("points")==0)
99         {
100                 manContourControl = getContourControler(7);
101         }
102
103         if (typeContour.compare("rotationTool")==0)
104         {
105                 manContourControl = getContourControler(8);
106         }
107         
108         if (typeContour.compare("polygon")==0)
109         {
110                 manContourControl       =  getContourControler(10);
111         }
112
113         return manContourControl;
114 }
115
116 manualViewBaseContour* creaContoursFactory::getCountourView (int typeContour)
117 {
118         
119         manualViewBaseContour *manViewerContour;
120         //spline
121         if (typeContour==1)
122         {
123                 manViewerContour        = new manualViewContour();
124         }
125
126         //rectangle
127         if (typeContour==2)
128         {
129                 manViewerContour        = new manualViewRoi();
130         }
131
132         //circle
133         if (typeContour==3)
134         {
135                 manViewerContour        = new manualViewCircle();
136         }
137
138         //bullEye
139         if (typeContour==4)
140         {
141                 manViewerContour        = new manualViewBullEye();
142         }
143
144         //line
145         if (typeContour==6)
146         {
147                 manViewerContour        = new manualViewLine();
148         }
149         
150         //points
151         if (typeContour==7)
152         {
153                 manViewerContour        = new manualViewPoints();
154         }
155
156         //rotationTool
157         if (typeContour==8)
158         {
159                 manViewerContour        = new manualViewRotationTool();
160         }
161
162         //polygon
163         if (typeContour==10)
164         {
165                 manViewerContour        = new manualViewContour();
166         }
167         return manViewerContour;
168 }
169
170 manualViewBaseContour* creaContoursFactory::getCountourView (std::string typeContour)
171 {
172
173         manualViewBaseContour *manViewerContour;
174
175         if (typeContour.compare("spline")==0)
176         {
177                 manViewerContour = getCountourView(1);
178         }
179
180         if (typeContour.compare("rectangle")==0)
181         {
182                 manViewerContour = getCountourView(2);
183         }
184
185         if (typeContour.compare("circle")==0)
186         {
187                 manViewerContour = getCountourView(3);
188         }
189
190         if (typeContour.compare("bullEye")==0)
191         {
192                 manViewerContour = getCountourView(4);
193         }
194
195         if (typeContour.compare("line")==0)
196         {
197                 manViewerContour = getCountourView(6);
198         }
199         
200         if (typeContour.compare("points")==0)
201         {
202                 manViewerContour = getCountourView(7);
203         }
204
205         if (typeContour.compare("rotationTool")==0)
206         {
207                 manViewerContour = getCountourView(8);
208         }
209
210         if (typeContour.compare("polygon")==0)
211         {
212                 manViewerContour = getCountourView(10);
213         }
214         return manViewerContour;
215
216 }
217
218 manualBaseModel* creaContoursFactory::getContourModel(int typeContour)
219 {
220         manualBaseModel *manModelContour=NULL;
221
222         // spline
223         if (typeContour==1)
224         {
225                 manModelContour = new manualContourModel();
226         }
227
228         // rectangle
229         if (typeContour==2)
230         {
231                 manModelContour = new manualContourModelRoi();
232         }
233
234         // circle
235         if (typeContour==3)
236         {
237                 manModelContour = new manualContourModelCircle();
238         }
239
240         //bullEye
241         if(typeContour==4)
242         {
243                 //Here we create a bullEye with 3 crowns and 5 sectors.
244                 manualContourModelBullEye *manModelContourBullEye = new manualContourModelBullEye();
245                         
246                 int iCrown,sizeCrowns,iSector,sizeSectors;
247                 double radioA,radioB,ang,angDelta,radioA2,radioB2 ;
248
249                 sizeCrowns = 3;
250                 radioA=33;
251                 radioB=0;
252                 angDelta= 72;
253                 for ( iCrown=0 ; iCrown<sizeCrowns ; iCrown++ )
254                 {
255                         sizeSectors = 5;
256                         radioB  = radioA;
257                         if (iCrown==sizeCrowns-1)
258                         {
259                                 radioA  = 0;
260                         } 
261                         else 
262                         {
263                                 radioA  = radioA+33;
264                         }
265                         radioA2=radioA/100.0;
266                         radioB2=radioB/100.0;
267                         ang=0;
268                         for ( iSector=0 ; iSector<sizeSectors  ; iSector++ )
269                         {               
270                                 ang     = ang+angDelta;
271                                 manModelContourBullEye->AddSector(radioA2,radioB2,ang,angDelta);
272                         } // for iSector
273                 }//for iCrown
274                 manModelContour         = manModelContourBullEye;
275         }
276
277         // line
278         if (typeContour==6)
279         {
280                 manModelContour = new manualContourModelLine();
281         }
282         
283         // points
284         if (typeContour==7)
285         {
286                 manModelContour = new manualBaseModel();
287         }
288
289         //rotationTool
290         if(typeContour==8)
291         {
292                 manModelContour = new manualContourModelRotationTool();
293         }
294
295         //polygon
296         if(typeContour==10)
297         {
298                 manModelContour = new manualContourModelPolygon();
299         }
300
301         return manModelContour;
302 }
303
304
305 manualBaseModel* creaContoursFactory::getContourModel(std::string typeContour)
306 {
307         manualBaseModel *manModelContour=NULL;
308
309         if (typeContour.compare("spline")==0)
310         {
311                 manModelContour = getContourModel(1);
312         }
313
314         if (typeContour.compare("rectangle")==0)
315         {
316                 manModelContour = getContourModel(2);
317         }
318
319         if (typeContour.compare("circle")==0)
320         {
321                 manModelContour = getContourModel(3);
322         }
323
324         if (typeContour.compare("bullEye")==0)
325         {
326                 manModelContour = getContourModel(4);
327         
328         }
329
330         if (typeContour.compare("line")==0)
331         {
332                 manModelContour = getContourModel(6);
333         }
334         
335         if (typeContour.compare("points")==0)
336         {
337                 manModelContour = getContourModel(7);
338         }
339
340         if (typeContour.compare("rotationTool")==0)
341         {
342                 manModelContour = getContourModel(8);
343         }
344         
345         if (typeContour.compare("polygon")==0)
346         {
347                 manModelContour = getContourModel(10);
348         }
349
350         return manModelContour;
351 }