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