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