ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/step/src/st_gestionnaire.cpp
Revision: 283
Committed: Tue Sep 13 21:11:20 2011 UTC (13 years, 8 months ago) by francois
File size: 25678 byte(s)
Log Message:
structure de l'écriture

File Contents

# User Rev Content
1 francois 283 //------------------------------------------------------------
2     //------------------------------------------------------------
3     // MAGiC
4     // Jean Christophe Cuilli�re et Vincent FRANCOIS
5     // D�partement de G�nie M�canique - UQTR
6     //------------------------------------------------------------
7     // Le projet MAGIC est un projet de recherche du d�partement
8     // de g�nie m�canique de l'Universit� du Qu�bec �
9     // Trois Rivi�res
10     // Les librairies ne peuvent �tre utilis�es sans l'accord
11     // des auteurs (contact : francois@uqtr.ca)
12     //------------------------------------------------------------
13     //------------------------------------------------------------
14     //
15     // st_gestionnaire.cpp
16     //
17     //------------------------------------------------------------
18     //------------------------------------------------------------
19     // COPYRIGHT 2000
20     // Version du 02/03/2006 � 11H24
21     //------------------------------------------------------------
22     //------------------------------------------------------------
23    
24    
25     #include "gestionversion.h"
26    
27     #include <stdio.h>
28    
29     #include <stdlib.h>
30     #include <string.h>
31     #include "st_gestionnaire.h"
32     #include "parse.h"
33     #include "pars_argument.h"
34    
35    
36    
37    
38     //---------------------------------------------------------------------------
39    
40    
41     template<class Y,class X> void ajouter(Y& y,X x,ST_GESTIONNAIRE& gest)
42     {
43     y.ajouter(x);
44     gest.lst_entity.ajouter(x);
45     }
46    
47     template<class Y,class X>void libere(Y& y)
48     {
49     for (long i=0;i<y.get_nb();i++)
50     {
51     X* x=y.get(i);
52     delete x;
53     }
54     y.vide();
55     }
56    
57     ST_GESTIONNAIRE::ST_GESTIONNAIRE(char *path):nom(NULL)
58     {
59     int num=strlen(path);
60     nom=new char[num+1];
61     strcpy(nom,path);
62     init();
63     }
64    
65     ST_GESTIONNAIRE::ST_GESTIONNAIRE():nom(NULL)
66     {
67     init();
68     }
69    
70    
71     void ST_GESTIONNAIRE::init(void)
72     {
73     for (int i=0;i<25;i++) tabentite[i]=0;
74     entitenom.insert(entitenom.end(),"VERTEX_POINT");
75     entitenom.insert(entitenom.end(),"VECTOR");
76     entitenom.insert(entitenom.end(),"LINE");
77     entitenom.insert(entitenom.end(),"EDGE_CURVE");
78     entitenom.insert(entitenom.end(),"ORIENTED_EDGE");
79     entitenom.insert(entitenom.end(),"EDGE_LOOP");
80     entitenom.insert(entitenom.end(),"FACE_BOUND");
81     entitenom.insert(entitenom.end(),"FACE_OUTER_BOUND");
82     entitenom.insert(entitenom.end(),"ADVANCED_FACE");
83     entitenom.insert(entitenom.end(),"AXIS2_PLACEMENT_3D");
84     entitenom.insert(entitenom.end(),"PLANE");
85     entitenom.insert(entitenom.end(),"CYLINDRICAL_SURFACE");
86     entitenom.insert(entitenom.end(),"TOROIDAL_SURFACE");
87     entitenom.insert(entitenom.end(),"CONICAL_SURFACE");
88     entitenom.insert(entitenom.end(),"SPHERICAL_SURFACE");
89     entitenom.insert(entitenom.end(),"CLOSED_SHELL");
90     entitenom.insert(entitenom.end(),"ORIENTED_CLOSED_SHELL");
91     entitenom.insert(entitenom.end(),"MANIFOLD_SOLID_BREP");
92     entitenom.insert(entitenom.end(),"BREP_WITH_VOIDS");
93     entitenom.insert(entitenom.end(),"CIRCLE");
94     entitenom.insert(entitenom.end(),"ELLIPSE");
95     entitenom.insert(entitenom.end(),"DIRECTION");
96     entitenom.insert(entitenom.end(),"CARTESIAN_POINT");
97     entitenom.insert(entitenom.end(),"B_SPLINE_CURVE_WITH_KNOTS");
98     entitenom.insert(entitenom.end(),"B_SPLINE_SURFACE_WITH_KNOTS");
99     }
100    
101     ST_GESTIONNAIRE::~ST_GESTIONNAIRE()
102     {
103     libere<TPL_MAP_ENTITE<class ST_VECTOR*>,ST_VECTOR>(lst_vector);
104     libere<TPL_MAP_ENTITE<class ST_EDGE_CURVE*>,ST_EDGE_CURVE>(lst_edgecurve);
105     libere<TPL_MAP_ENTITE<class ST_ORIENTED_EDGE*>,ST_ORIENTED_EDGE>(lst_oriedge);
106     libere<TPL_MAP_ENTITE<class ST_LINE*>,ST_LINE>(lst_line);
107     libere<TPL_MAP_ENTITE<class ST_FACE_BOUND*>,ST_FACE_BOUND>(lst_facebound);
108     libere<TPL_MAP_ENTITE<class ST_VERTEX*>,ST_VERTEX>(lst_vertex);
109     libere<TPL_MAP_ENTITE<class ST_PLANE*>,ST_PLANE>(lst_plane);
110     libere<TPL_MAP_ENTITE<class ST_CYLINDRICAL*>,ST_CYLINDRICAL>(lst_cylindrical);
111     libere<TPL_MAP_ENTITE<class ST_SPHERICAL*>,ST_SPHERICAL>(lst_spherical);
112     libere<TPL_MAP_ENTITE<class ST_TOROIDAL*>,ST_TOROIDAL>(lst_toroidal);
113     libere<TPL_MAP_ENTITE<class ST_CONICAL*>,ST_CONICAL>(lst_conical);
114     libere<TPL_MAP_ENTITE<class ST_AXIS2_PLACEMENT_3D*>,ST_AXIS2_PLACEMENT_3D>(lst_axis2_placement_3d);
115     libere<TPL_MAP_ENTITE<class ST_CLOSED_SHELL*>,ST_CLOSED_SHELL>(lst_closed_shell);
116     libere<TPL_MAP_ENTITE<class ST_ORIENTED_CLOSED_SHELL*>,ST_ORIENTED_CLOSED_SHELL>(lst_oriented_closed_shell);
117     libere<TPL_MAP_ENTITE<class ST_ADVANCED_FACE*>,ST_ADVANCED_FACE>(lst_advanced_face);
118     libere<TPL_MAP_ENTITE<class ST_EDGE_LOOP*>,ST_EDGE_LOOP>(lst_edge_loop);
119     libere<TPL_MAP_ENTITE<class ST_MANIFOLD_BREP*>,ST_MANIFOLD_BREP>(lst_manifold_brep);
120     libere<TPL_MAP_ENTITE<class ST_BREP_WITH_VOIDS*>,ST_BREP_WITH_VOIDS>(lst_brep_with_voids);
121     libere<TPL_MAP_ENTITE<class ST_CIRCLE*>,ST_CIRCLE>(lst_circle);
122     libere<TPL_MAP_ENTITE<class ST_ELLIPSE*>,ST_ELLIPSE>(lst_ellipse);
123     libere<TPL_MAP_ENTITE<class ST_DIRECTION*>,ST_DIRECTION>(lst_direction);
124     libere<TPL_MAP_ENTITE<class ST_POINT*>,ST_POINT>(lst_point);
125     libere<TPL_MAP_ENTITE<class ST_B_SPLINE*>,ST_B_SPLINE>(lst_bspline);
126     libere<TPL_MAP_ENTITE<class ST_B_SPLINE_SURF*>,ST_B_SPLINE_SURF>(lst_bsplines);
127     lst_entity.vide();
128     if (nom!=NULL) delete [] nom;
129     }
130    
131    
132     void ST_GESTIONNAIRE::change_nom(char *path)
133     {
134     if (nom!=NULL) delete [] nom;
135     int num=strlen(path);
136     nom=new char[num+1];
137     strcpy(nom,path);
138     }
139    
140    
141    
142    
143     char* ST_GESTIONNAIRE::get_nom(void)
144     {
145     return nom;
146     }
147    
148     long ST_GESTIONNAIRE::cid(std::string str)
149     {
150     return atol(str.c_str()+1);
151     }
152    
153    
154    
155     int ST_GESTIONNAIRE::cbool(std::string str)
156     {
157     if (str==".T.") return 1;
158     if (str==".F.") return -1;
159     return 0;
160     }
161    
162    
163     int ST_GESTIONNAIRE::lire(void)
164     {
165     FILE *in;
166    
167    
168     in=fopen(nom,"rt");
169     if (in==NULL) return 0;
170    
171    
172     // Headers
173     PARS_ARGUMENT param[20];
174     PARSE parse;
175     do
176     {
177     int ierr;
178     std::string ligne=parse.lire(in,';',&ierr);
179     if (ierr!=0) return 0;
180     parse.decode(ligne.c_str(),"@;",param);
181     }
182     while (param[0].argument[0]!="DATA");
183    
184     // Data
185     do
186     {
187     int ierr;
188     std::string ligne=parse.lire(in,';',&ierr);
189     int nbcar=ligne.length();
190     for (int i=nbcar-1;i>=0;i--)
191     if (ligne[i]==' ') ligne.erase(i,1);
192     parse.decode(ligne.c_str(),"@;",param);
193     if (param[0].argument[0]!="ENDSEC")
194     {
195     parse.decode(ligne.c_str(),"#@=@(@);",param);
196     std::string entite=param[1].argument[0];
197     if (entite=="")
198     {
199     parse.decode(ligne.c_str(),"#@=(@);",param);
200     entite=param[1].argument[0];
201     }
202     long id=atol(param[0].argument[0].c_str());
203     std::string data=param[2].argument[0] ;
204     if (entite=="VERTEX_POINT")
205     {
206     parse.decode(data.c_str(),"'@',@",param+2);
207     long id_point=cid(param[3].argument[0].c_str());
208     ST_VERTEX *vertex=new ST_VERTEX(id,param[2].argument[0],id_point);
209     ajouter<TPL_MAP_ENTITE<ST_VERTEX*>,ST_VERTEX*>(lst_vertex,vertex,*this);
210     tabentite[VERTEX_POINT]++;
211     }
212     else if (entite=="VECTOR")
213     {
214     parse.decode(data.c_str(),"'@',@,@",param+2);
215     long iddirection=cid(param[3].argument[0]);
216     double magnitude=atof(param[4].argument[0].c_str());
217     ST_VECTOR* vector=new ST_VECTOR(id,param[2].argument[0],iddirection,magnitude);
218     ajouter<TPL_MAP_ENTITE<ST_VECTOR*>,ST_VECTOR*>(lst_vector,vector,*this);
219     tabentite[VECTOR]++;
220     }
221     else if (entite=="LINE")
222     {
223     parse.decode(data.c_str(),"'@',@,@",param+2);
224     long id_point=cid(param[3].argument[0].c_str());
225     long id_vector=cid(param[4].argument[0].c_str());
226     ST_LINE *line=new ST_LINE(id,param[2].argument[0],id_point,id_vector);
227     ajouter<TPL_MAP_ENTITE<ST_LINE*>,ST_LINE*>(lst_line,line,*this);
228     ajouter<TPL_MAP_ENTITE<ST_COURBE*>,ST_COURBE*>(lst_courbe,line,*this);
229     tabentite[LINE]++;
230     }
231     else if (entite=="EDGE_CURVE")
232     {
233     parse.decode(data.c_str(),"'@',@,@,@,@",param+2);
234     long idvertex1=cid(param[3].argument[0]);
235     long idvertex2=cid(param[4].argument[0]);
236     long idcurve=cid(param[5].argument[0]);
237     int sens=cbool(param[6].argument[0]);
238     ST_EDGE_CURVE *edgecurve=new ST_EDGE_CURVE(id,param[2].argument[0],idvertex1,idvertex2,idcurve,sens);
239     ajouter<TPL_MAP_ENTITE<ST_EDGE_CURVE*>,ST_EDGE_CURVE*>(lst_edgecurve,edgecurve,*this);
240     tabentite[EDGE_CURVE]++;
241     }
242     else if (entite=="ORIENTED_EDGE")
243     {
244     parse.decode(data.c_str(),"'@',@,@,@,@",param+2);
245     long id_edge_curve=cid(param[5].argument[0].c_str());
246     int sens=cbool(param[6].argument[0]);
247     ST_ORIENTED_EDGE *oriedge=new ST_ORIENTED_EDGE(id,param[2].argument[0],id_edge_curve,sens);
248     ajouter<TPL_MAP_ENTITE<ST_ORIENTED_EDGE*>,ST_ORIENTED_EDGE*>(lst_oriedge,oriedge,*this);
249     tabentite[ORIENTED_EDGE]++;
250     }
251     else if (entite=="EDGE_LOOP")
252     {
253     parse.decode(data.c_str(),"'@',(&)",param+2);
254     std::vector<long> liste_tmp;
255     long nb=param[3].get_nombre();
256     for (long i=0;i<nb;i++)
257     liste_tmp.insert(liste_tmp.end(),cid(param[3].argument[i]));
258     ST_EDGE_LOOP *edge_loop=new ST_EDGE_LOOP(id,param[2].argument[0],&liste_tmp);
259     ajouter<TPL_MAP_ENTITE<ST_EDGE_LOOP*>,ST_EDGE_LOOP*>(lst_edge_loop,edge_loop,*this);
260     tabentite[EDGE_LOOP]++;
261     }
262     else if ((entite=="FACE_BOUND") || (entite=="FACE_OUTER_BOUND"))
263     {
264     parse.decode(data.c_str(),"'@',@,@",param+2);
265     long id_edge_loop=cid(param[3].argument[0].c_str());
266     int sens=cbool(param[4].argument[0]);
267     ST_FACE_BOUND *facebound=new ST_FACE_BOUND(id,param[2].argument[0],id_edge_loop,sens);
268     ajouter<TPL_MAP_ENTITE<ST_FACE_BOUND*>,ST_FACE_BOUND*>(lst_facebound,facebound,*this);
269     if (entite=="FACE_BOUND") tabentite[FACE_BOUND]++;
270     if (entite=="FACE_OUTER_BOUND") tabentite[FACE_OUTER_BOUND]++;
271     }
272     else if (entite=="ADVANCED_FACE")
273     {
274     parse.decode(data.c_str(),"'@',(&),@,@",param+2);
275     std::vector<long> liste_tmp;
276     long nb=param[3].get_nombre();
277     for (long i=0;i<nb;i++)
278     liste_tmp.insert(liste_tmp.end(),cid(param[3].argument[i]));
279     long id_surface=cid(param[4].argument[0].c_str());
280     int sens=cbool(param[5].argument[0]);
281     ST_ADVANCED_FACE *advanced_face=new ST_ADVANCED_FACE(id,param[2].argument[0],&liste_tmp,id_surface,sens);
282     ajouter<TPL_MAP_ENTITE<ST_ADVANCED_FACE*>,ST_ADVANCED_FACE*>(lst_advanced_face,advanced_face,*this);
283     tabentite[ADVANCED_FACE]++;
284     }
285     else if (entite=="AXIS2_PLACEMENT_3D")
286     {
287     parse.decode(data.c_str(),"'@',@,@,@",param+2);
288     long id_point=cid(param[3].argument[0].c_str());
289     long id_direction1=cid(param[4].argument[0].c_str());
290     long id_direction2;
291     if (param[5].argument[0].c_str()=="$")
292     {
293     id_direction2=-1;
294     }
295     else
296     {
297     id_direction2=cid(param[5].argument[0].c_str());
298     }
299     ST_AXIS2_PLACEMENT_3D *axis2_placement_3d=new ST_AXIS2_PLACEMENT_3D(id,param[2].argument[0],id_point,id_direction1,id_direction2);
300     ajouter<TPL_MAP_ENTITE<ST_AXIS2_PLACEMENT_3D*>,ST_AXIS2_PLACEMENT_3D*>(lst_axis2_placement_3d,axis2_placement_3d,*this);
301     tabentite[AXIS2_PLACEMENT_3D]++;
302     }
303     else if (entite=="PLANE")
304     {
305     parse.decode(data.c_str(),"'@',@",param+2);
306     long id_axis2_placement_3d=cid(param[3].argument[0].c_str());
307     ST_PLANE *plane=new ST_PLANE(id,param[2].argument[0],id_axis2_placement_3d);
308     ajouter<TPL_MAP_ENTITE<ST_PLANE*>,ST_PLANE*>(lst_plane,plane,*this);
309     ajouter<TPL_MAP_ENTITE<ST_SURFACE*>,ST_SURFACE*>(lst_surface,plane,*this);
310     tabentite[PLANE]++;
311     }
312     else if (entite=="CYLINDRICAL_SURFACE")
313     {
314     parse.decode(data.c_str(),"'@',@,@",param+2);
315     long id_axis2_placement_3d=cid(param[3].argument[0].c_str());
316     double rayon=atof(param[4].argument[0].c_str());
317     ST_CYLINDRICAL *cylindrical=new ST_CYLINDRICAL(id,param[2].argument[0],id_axis2_placement_3d,rayon);
318     ajouter<TPL_MAP_ENTITE<ST_CYLINDRICAL*>,ST_CYLINDRICAL*>(lst_cylindrical,cylindrical,*this);
319     ajouter<TPL_MAP_ENTITE<ST_SURFACE*>,ST_SURFACE*>(lst_surface,cylindrical,*this);
320     tabentite[CYLINDRICAL_SURFACE]++;
321     }
322     else if (entite=="TOROIDAL_SURFACE")
323     {
324     parse.decode(data.c_str(),"'@',@,@,@",param+2);
325     long id_axis2_placement_3d=cid(param[3].argument[0].c_str());
326     double grandray=atof(param[4].argument[0].c_str());
327     double petitray=atof(param[5].argument[0].c_str());
328     ST_TOROIDAL *toroidal=new ST_TOROIDAL(id,param[2].argument[0],id_axis2_placement_3d,grandray,petitray);
329     ajouter<TPL_MAP_ENTITE<ST_TOROIDAL*>,ST_TOROIDAL*>(lst_toroidal,toroidal,*this);
330     ajouter<TPL_MAP_ENTITE<ST_SURFACE*>,ST_SURFACE*>(lst_surface,toroidal,*this);
331     tabentite[TOROIDAL_SURFACE]++;
332     }
333     else if (entite=="CONICAL_SURFACE")
334     {
335     parse.decode(data.c_str(),"'@',@,@,@",param+2);
336     long id_axis2_placement_3d=cid(param[3].argument[0].c_str());
337     double rayon=atof(param[4].argument[0].c_str());
338     double angle=atof(param[5].argument[0].c_str());
339     ST_CONICAL *conical=new ST_CONICAL(id,param[2].argument[0],id_axis2_placement_3d,rayon,angle);
340     ajouter<TPL_MAP_ENTITE<ST_CONICAL*>,ST_CONICAL*>(lst_conical,conical,*this);
341     ajouter<TPL_MAP_ENTITE<ST_SURFACE*>,ST_SURFACE*>(lst_surface,conical,*this);
342     tabentite[CONICAL_SURFACE]++;
343     }
344     else if (entite=="SPHERICAL_SURFACE")
345     {
346     parse.decode(data.c_str(),"'@',@,@",param+2);
347     long id_axis2_placement_3d=cid(param[3].argument[0].c_str());
348     double rayon=atof(param[4].argument[0].c_str());
349     ST_SPHERICAL *spherical=new ST_SPHERICAL(id,param[2].argument[0],id_axis2_placement_3d,rayon);
350     ajouter<TPL_MAP_ENTITE<ST_SPHERICAL*>,ST_SPHERICAL*>(lst_spherical,spherical,*this);
351     ajouter<TPL_MAP_ENTITE<ST_SURFACE*>,ST_SURFACE*>(lst_surface,spherical,*this);
352     tabentite[SPHERICAL_SURFACE]++;
353     }
354     else if (entite=="CLOSED_SHELL")
355     {
356     parse.decode(data.c_str(),"'@',(&)",param+2);
357     std::vector<long> liste_tmp;
358     long nb=param[3].get_nombre();
359     for (long i=0;i<nb;i++)
360     liste_tmp.insert(liste_tmp.end(),cid(param[3].argument[i]));
361     ST_CLOSED_SHELL *closed_shell=new ST_CLOSED_SHELL(id,param[2].argument[0],&liste_tmp);
362     ajouter<TPL_MAP_ENTITE<ST_CLOSED_SHELL*>,ST_CLOSED_SHELL*>(lst_closed_shell,closed_shell,*this);
363     tabentite[CLOSED_SHELL]++;
364     }
365     else if (entite=="ORIENTED_CLOSED_SHELL")
366     {
367     parse.decode(data.c_str(),"'@',@,@,@",param+2);
368     long id_closed_shell=cid(param[4].argument[0].c_str());
369     int sens=cbool(param[5].argument[0]);
370     ST_ORIENTED_CLOSED_SHELL *oriented_closed_shell=new ST_ORIENTED_CLOSED_SHELL(id,param[2].argument[0],id_closed_shell,sens);
371     ajouter<TPL_MAP_ENTITE<ST_ORIENTED_CLOSED_SHELL*>,ST_ORIENTED_CLOSED_SHELL*>(lst_oriented_closed_shell,oriented_closed_shell,*this);
372     tabentite[ORIENTED_CLOSED_SHELL]++;
373     }
374     else if (entite=="MANIFOLD_SOLID_BREP")
375     {
376     parse.decode(data.c_str(),"'@',@",param+2);
377     long id_closed_shell=cid(param[3].argument[0].c_str());
378     ST_MANIFOLD_BREP *manifold_brep=new ST_MANIFOLD_BREP(id,param[2].argument[0],id_closed_shell);
379     ajouter<TPL_MAP_ENTITE<ST_MANIFOLD_BREP*>,ST_MANIFOLD_BREP*>(lst_manifold_brep,manifold_brep,*this);
380     tabentite[MANIFOLD_SOLID_BREP]++;
381     }
382     else if (entite=="BREP_WITH_VOIDS")
383     {
384     parse.decode(data.c_str(),"'@',@,(&)",param+2);
385     long id_closed_shell=cid(param[3].argument[0].c_str());
386     std::vector<long> liste_tmp;
387     long nb=param[4].get_nombre();
388     for (long i=0;i<nb;i++)
389     liste_tmp.insert(liste_tmp.end(),cid(param[4].argument[i]));
390     ST_BREP_WITH_VOIDS *brep_with_voids=new ST_BREP_WITH_VOIDS(id,param[2].argument[0],id_closed_shell,&liste_tmp);
391     ajouter<TPL_MAP_ENTITE<ST_BREP_WITH_VOIDS*>,ST_BREP_WITH_VOIDS*>(lst_brep_with_voids,brep_with_voids,*this);
392     tabentite[BREP_WITH_VOIDS]++;
393     }
394     else if (entite=="CIRCLE")
395     {
396     parse.decode(data.c_str(),"'@',@,@",param+2);
397     long id_axis2_placement_3d=cid(param[3].argument[0].c_str());
398     double rayon=atof(param[4].argument[0].c_str());
399     ST_CIRCLE *circle=new ST_CIRCLE(id,param[2].argument[0],id_axis2_placement_3d,rayon);
400     ajouter<TPL_MAP_ENTITE<ST_CIRCLE*>,ST_CIRCLE*>(lst_circle,circle,*this);
401     ajouter<TPL_MAP_ENTITE<ST_COURBE*>,ST_COURBE*>(lst_courbe,circle,*this);
402     tabentite[CIRCLE]++;
403     }
404     else if (entite=="ELLIPSE")
405     {
406     parse.decode(data.c_str(),"'@',@,@,@",param+2);
407     long id_axis2_placement_3d=cid(param[3].argument[0].c_str());
408     double a=atof(param[4].argument[0].c_str());
409     double b=atof(param[5].argument[0].c_str());
410     ST_ELLIPSE *ellipse=new ST_ELLIPSE(id,param[2].argument[0],id_axis2_placement_3d,a,b);
411     ajouter<TPL_MAP_ENTITE<ST_ELLIPSE*>,ST_ELLIPSE*>(lst_ellipse,ellipse,*this);
412     ajouter<TPL_MAP_ENTITE<ST_COURBE*>,ST_COURBE*>(lst_courbe,ellipse,*this);
413     tabentite[ELLIPSE]++;
414     }
415     else if (entite=="DIRECTION")
416     {
417     parse.decode(data.c_str(),"'@',(&)",param+2);
418     int nb=param[3].get_nombre();
419     nb++;
420     nb--;
421     double x=atof(param[3].argument[0].c_str());
422     double y=atof(param[3].argument[1].c_str());
423     double z=atof(param[3].argument[2].c_str());
424     ST_DIRECTION *direction=new ST_DIRECTION(id,param[2].argument[0],x,y,z);
425     ajouter<TPL_MAP_ENTITE<ST_DIRECTION*>,ST_DIRECTION*>(lst_direction,direction,*this);
426     tabentite[DIRECTION]++;
427     }
428     else if (entite=="CARTESIAN_POINT")
429     {
430     parse.decode(data.c_str(),"'@',(&)",param+2);
431     double x=atof(param[3].argument[0].c_str());
432     double y=atof(param[3].argument[1].c_str());
433     double z=atof(param[3].argument[2].c_str());
434     ST_POINT *point=new ST_POINT(id,param[2].argument[0],x,y,z);
435     ajouter<TPL_MAP_ENTITE<ST_POINT*>,ST_POINT*>(lst_point,point,*this);
436     tabentite[CARTESIAN_POINT]++;
437     }
438     else if (entite=="B_SPLINE_CURVE_WITH_KNOTS")
439     {
440     parse.decode(data.c_str(),"'@',@,(&),@,@,@,(&),(&),@",param+2);
441     int bs_degre=atoi(param[3].argument[0].c_str());
442     std::vector<int> liste_tmp_1;
443     int nb_1=param[4].get_nombre();
444     for (int i=0;i<nb_1;i++)
445     liste_tmp_1.insert(liste_tmp_1.end(),cid(param[4].argument[i]));
446     std::vector<int> liste_tmp_2;
447     int nb_2=param[8].get_nombre();
448     for (int j=0;j<nb_2;j++)
449     liste_tmp_2.insert(liste_tmp_2.end(),atoi(param[8].argument[j].c_str()));
450     std::vector<double> liste_tmp_3;
451     long nb_3=param[9].get_nombre();
452     for (long k=0;k<nb_3;k++)
453     liste_tmp_3.insert(liste_tmp_3.end(),atof(param[9].argument[k].c_str()));
454     ST_B_SPLINE *bspline=new ST_B_SPLINE(id,param[2].argument[0],bs_degre,liste_tmp_1,liste_tmp_2,liste_tmp_3);
455     ajouter<TPL_MAP_ENTITE<ST_B_SPLINE*>,ST_B_SPLINE*>(lst_bspline,bspline,*this);
456     ajouter<TPL_MAP_ENTITE<ST_COURBE*>,ST_COURBE*>(lst_courbe,bspline,*this);
457     tabentite[B_SPLINE_CURVE_WITH_KNOTS]++;
458     }
459     else if (entite=="B_SPLINE_SURFACE_WITH_KNOTS")
460     {
461     parse.decode(data.c_str(),"'@',@,@,(&),@,@,@,@,(&),(&),(&),(&),@",param+2);
462     int bs_degre_u=atoi(param[3].argument[0].c_str());
463     int bs_degre_v=atoi(param[4].argument[0].c_str());
464     int nb_1=param[5].get_nombre();
465     std::vector<int> liste_tmp_1;
466     for (int i=0;i<nb_1;i++)
467     {
468     PARS_ARGUMENT param2;
469     parse.decode(param[5].argument[i].c_str(),"(&)", &param2);
470     int nb_11=param2.get_nombre();
471     for (int j=0;j<nb_11;j++)
472     liste_tmp_1.insert(liste_tmp_1.end(),cid(param2.argument[j].c_str()));
473     }
474     std::vector<int> liste_tmp_2;
475     int nb_2=param[10].get_nombre();
476     for (int j=0;j<nb_2;j++)
477     liste_tmp_2.insert(liste_tmp_2.end(),atoi(param[10].argument[j].c_str()));
478     std::vector<int> liste_tmp_3;
479     int nb_3=param[11].get_nombre();
480     for (int j=0;j<nb_3;j++)
481     liste_tmp_3.insert(liste_tmp_3.end(),atoi(param[11].argument[j].c_str()));
482     std::vector<double> liste_tmp_4;
483     long nb_4=param[12].get_nombre();
484     for (long k=0;k<nb_4;k++)
485     liste_tmp_4.insert(liste_tmp_4.end(),atof(param[12].argument[k].c_str()));
486     std::vector<double> liste_tmp_5;
487     long nb_5=param[13].get_nombre();
488     for (long k=0;k<nb_5;k++)
489     liste_tmp_5.insert(liste_tmp_5.end(),atof(param[13].argument[k].c_str()));
490     ST_B_SPLINE_SURF *bsplines=new ST_B_SPLINE_SURF(id,param[2].argument[0],bs_degre_u,bs_degre_v,liste_tmp_1,liste_tmp_2,liste_tmp_3,liste_tmp_4,liste_tmp_5);
491     ajouter<TPL_MAP_ENTITE<ST_B_SPLINE_SURF*>,ST_B_SPLINE_SURF*>(lst_bsplines,bsplines,*this);
492     ajouter<TPL_MAP_ENTITE<ST_SURFACE*>,ST_SURFACE*>(lst_surface,bsplines,*this);
493     tabentite[B_SPLINE_SURFACE_WITH_KNOTS]++;
494     }
495     else entitenontraite.insert(entitenontraite.end(),entite);
496     }
497     }
498     while (param[0].argument[0]!="ENDSEC");
499     fclose(in);
500     initialiser();
501     return 1;
502     }
503    
504    
505    
506     void ST_GESTIONNAIRE::initialiser(void)
507     {
508     long nb_ligne=lst_line.get_nb();
509     for (long i=0;i<nb_ligne;i++)
510     {
511     ST_LINE* ligne=lst_line.get(i);
512     ligne->initialiser(this);
513     }
514     long nb_cercle=lst_circle.get_nb();
515     for (long i=0;i<nb_cercle;i++)
516     {
517     ST_CIRCLE* cercle=lst_circle.get(i);
518     cercle->initialiser(this);
519     }
520     long nb_ellipse=lst_ellipse.get_nb();
521     for (long i=0;i<nb_ellipse;i++)
522     {
523     ST_ELLIPSE* ellipse=lst_ellipse.get(i);
524     ellipse->initialiser(this);
525     }
526     long nb_plane=lst_plane.get_nb();
527     for (long i=0;i<nb_plane;i++)
528     {
529     ST_PLANE* plane=lst_plane.get(i);
530     plane->initialiser(this);
531     }
532     long nb_cylindrical=lst_cylindrical.get_nb();
533     for (long i=0;i<nb_cylindrical;i++)
534     {
535     ST_CYLINDRICAL* cylindrical=lst_cylindrical.get(i);
536     cylindrical->initialiser(this);
537     }
538     long nb_conical=lst_conical.get_nb();
539     for (long i=0;i<nb_conical;i++)
540     {
541     ST_CONICAL* conical=lst_conical.get(i);
542     conical->initialiser(this);
543     }
544     long nb_spherical=lst_spherical.get_nb();
545     for (long i=0;i<nb_spherical;i++)
546     {
547     ST_SPHERICAL* spherical=lst_spherical.get(i);
548     spherical->initialiser(this);
549     }
550     long nb_toroidal=lst_toroidal.get_nb();
551     for (long i=0;i<nb_toroidal;i++)
552     {
553     ST_TOROIDAL* toroidal=lst_toroidal.get(i);
554     toroidal->initialiser(this);
555     }
556     long nb_bspline=lst_bspline.get_nb();
557     for (long i=0;i<nb_bspline;i++)
558     {
559     ST_B_SPLINE* bspline=lst_bspline.get(i);
560     bspline->initialiser(this);
561     }
562     long nb_bsplines=lst_bsplines.get_nb();
563     for (long i=0;i<nb_bsplines;i++)
564     {
565     ST_B_SPLINE_SURF* bsplines=lst_bsplines.get(i);
566     bsplines->initialiser(this);
567     }
568     }
569