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