1 |
|
5 |
//------------------------------------------------------------
|
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 |
|
|
// sat_gestionnaire.cpp
|
16 |
|
|
//
|
17 |
|
|
//------------------------------------------------------------
|
18 |
|
|
//------------------------------------------------------------
|
19 |
|
|
// COPYRIGHT 2000
|
20 |
|
|
// Version du 02/03/2006 à 11H24
|
21 |
|
|
//------------------------------------------------------------
|
22 |
|
|
//------------------------------------------------------------
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
#include "gestionversion.h"
|
26 |
|
|
#include <stdio.h>
|
27 |
|
|
|
28 |
|
|
#include "sat_gestionnaire.h"
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
//---------------------------------------------------------------------------
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
template<class Y,class X> void ajouter(Y& y,X x,SAT_GESTIONNAIRE& gest)
|
37 |
|
|
{
|
38 |
|
|
y.ajouter(x);
|
39 |
|
|
gest.lst_entity.ajouter(x);
|
40 |
|
|
}
|
41 |
|
|
|
42 |
|
|
template<class Y,class X>void libere(Y& y)
|
43 |
|
|
{
|
44 |
|
|
for (long i=0;i<y.get_nb();i++)
|
45 |
|
|
{
|
46 |
|
|
X* x=y.get(i);
|
47 |
|
|
delete x;
|
48 |
|
|
}
|
49 |
|
|
y.vide();
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
SAT_GESTIONNAIRE::SAT_GESTIONNAIRE():FORWARD(1),REVERSED(-1),DOUBLE(2),SINGLE(1),IS_OUT(10),IS_IN(11),nom(NULL)
|
53 |
|
|
{
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
SAT_GESTIONNAIRE::SAT_GESTIONNAIRE(char *path):FORWARD(1),REVERSED(-1),DOUBLE(2),SINGLE(1),IS_OUT(10),IS_IN(11),nom(NULL)
|
57 |
|
|
{
|
58 |
|
|
int num=strlen(path);
|
59 |
|
|
nom=new char[num+1];
|
60 |
|
|
strcpy(nom,path);
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
SAT_GESTIONNAIRE::~SAT_GESTIONNAIRE()
|
64 |
|
|
{
|
65 |
|
|
libere<TPL_MAP_ENTITE<class SAT_ATTRIB*>,SAT_ATTRIB>(lst_attrib);
|
66 |
|
|
libere<TPL_MAP_ENTITE<class SAT_BODY*>,SAT_BODY>(lst_body);
|
67 |
|
|
libere<TPL_MAP_ENTITE<class SAT_COEDGE*>,SAT_COEDGE>(lst_coedge);
|
68 |
|
|
libere<TPL_MAP_ENTITE<class SAT_CONE*>,SAT_CONE>(lst_cone);
|
69 |
|
|
libere<TPL_MAP_ENTITE<class SAT_EDGE*>,SAT_EDGE>(lst_edge);
|
70 |
|
|
libere<TPL_MAP_ENTITE<class SAT_ELLIPSE*>,SAT_ELLIPSE>(lst_ellipse);
|
71 |
|
|
libere<TPL_MAP_ENTITE<class SAT_FACE*>,SAT_FACE>(lst_face);
|
72 |
|
|
libere<TPL_MAP_ENTITE<class SAT_LOOP*>,SAT_LOOP>(lst_loop);
|
73 |
|
|
libere<TPL_MAP_ENTITE<class SAT_LUMP*>,SAT_LUMP>(lst_lump);
|
74 |
|
|
//libere<TPL_MAP_ENTITE<class SAT_PCURVE*>,SAT_PCURVE>(lst_pcurve);
|
75 |
|
|
libere<TPL_MAP_ENTITE<class SAT_PLANE*>,SAT_PLANE>(lst_plane);
|
76 |
|
|
libere<TPL_MAP_ENTITE<class SAT_POINT*>,SAT_POINT>(lst_point);
|
77 |
|
|
libere<TPL_MAP_ENTITE<class SAT_SHELL*>,SAT_SHELL>(lst_shell);
|
78 |
|
|
libere<TPL_MAP_ENTITE<class SAT_STRAIGHT*>,SAT_STRAIGHT>(lst_straight);
|
79 |
|
|
libere<TPL_MAP_ENTITE<class SAT_SUBSHELL*>,SAT_SUBSHELL>(lst_subshell);
|
80 |
|
|
libere<TPL_MAP_ENTITE<class SAT_TRANSFORM*>,SAT_TRANSFORM>(lst_transform);
|
81 |
|
|
libere<TPL_MAP_ENTITE<class SAT_VERTEX*>,SAT_VERTEX>(lst_vertex);
|
82 |
|
|
libere<TPL_MAP_ENTITE<class SAT_WIRE*>,SAT_WIRE>(lst_wire);
|
83 |
|
|
lst_entity.vide();
|
84 |
|
|
if (nom!=NULL) delete [] nom;
|
85 |
|
|
}
|
86 |
|
|
|
87 |
|
|
void SAT_GESTIONNAIRE::change_nom(char *path)
|
88 |
|
|
{
|
89 |
|
|
int num=strlen(path);
|
90 |
|
|
nom=new char[num+1];
|
91 |
|
|
strcpy(nom,path);
|
92 |
|
|
}
|
93 |
|
|
|
94 |
|
|
char* SAT_GESTIONNAIRE::get_nom(void)
|
95 |
|
|
{
|
96 |
|
|
return nom;
|
97 |
|
|
}
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
int SAT_GESTIONNAIRE::lire(void)
|
101 |
|
|
{
|
102 |
|
|
FILE* fic=fopen(nom,"rt");
|
103 |
|
|
if (fic==NULL)
|
104 |
|
|
{
|
105 |
|
|
return 0;
|
106 |
|
|
}
|
107 |
|
|
int num=0;
|
108 |
|
|
int version;
|
109 |
|
|
char mess[255];
|
110 |
|
|
while (num<100)
|
111 |
|
|
{
|
112 |
|
|
fgets(mess,500,fic);
|
113 |
|
|
sscanf(mess,"%d",&num);
|
114 |
|
|
}
|
115 |
|
|
sscanf(mess,"%d %d",&version,&num);
|
116 |
|
|
unsigned long ident=0;
|
117 |
|
|
while (feof(fic)==0)
|
118 |
|
|
{
|
119 |
|
|
char type_entite[30];
|
120 |
|
|
fgets(mess,500,fic);
|
121 |
|
|
sscanf(mess,"%s",type_entite);
|
122 |
|
|
num=strlen(type_entite);
|
123 |
|
|
int commentaire=0;
|
124 |
|
|
if (num>6)
|
125 |
|
|
{
|
126 |
|
|
if (type_entite[num-1]=='b')
|
127 |
|
|
if (type_entite[num-2]=='i')
|
128 |
|
|
if (type_entite[num-3]=='r')
|
129 |
|
|
if (type_entite[num-4]=='t')
|
130 |
|
|
if (type_entite[num-5]=='t')
|
131 |
|
|
if (type_entite[num-6]=='a')
|
132 |
|
|
strcpy(type_entite,"attrib");
|
133 |
|
|
}
|
134 |
|
|
if (strcmp(type_entite,"body")==0)
|
135 |
|
|
{
|
136 |
|
|
SAT_BODY* body=new SAT_BODY(ident);
|
137 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_BODY*>,SAT_BODY*>(lst_body,body,*this);
|
138 |
|
|
}
|
139 |
|
|
else if (strcmp(type_entite,"attrib")==0)
|
140 |
|
|
{
|
141 |
|
|
SAT_ATTRIB* attrib=new SAT_ATTRIB(ident);
|
142 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_ATTRIB*>,SAT_ATTRIB*>(lst_attrib,attrib,*this);
|
143 |
|
|
}
|
144 |
|
|
else if (strcmp(type_entite,"lump")==0)
|
145 |
|
|
{
|
146 |
|
|
SAT_LUMP* lump=new SAT_LUMP(ident);
|
147 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_LUMP*>,SAT_LUMP*>(lst_lump,lump,*this);
|
148 |
|
|
}
|
149 |
|
|
else if (strcmp(type_entite,"shell")==0)
|
150 |
|
|
{
|
151 |
|
|
SAT_SHELL* shell=new SAT_SHELL(ident);
|
152 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_SHELL*>,SAT_SHELL*>(lst_shell,shell,*this);
|
153 |
|
|
}
|
154 |
|
|
else if (strcmp(type_entite,"face")==0)
|
155 |
|
|
{
|
156 |
|
|
SAT_FACE* face=new SAT_FACE(ident);
|
157 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_FACE*>,SAT_FACE*>(lst_face,face,*this);
|
158 |
|
|
}
|
159 |
|
|
else if (strcmp(type_entite,"loop")==0)
|
160 |
|
|
{
|
161 |
|
|
SAT_LOOP* loop=new SAT_LOOP(ident);
|
162 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_LOOP*>,SAT_LOOP*>(lst_loop,loop,*this);
|
163 |
|
|
}
|
164 |
|
|
else if (strcmp(type_entite,"subshell")==0)
|
165 |
|
|
{
|
166 |
|
|
SAT_SUBSHELL* subshell=new SAT_SUBSHELL(ident);
|
167 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_SUBSHELL*>,SAT_SUBSHELL*>(lst_subshell,subshell,*this);
|
168 |
|
|
}
|
169 |
|
|
else if (strcmp(type_entite,"wire")==0)
|
170 |
|
|
{
|
171 |
|
|
SAT_WIRE* wire=new SAT_WIRE(ident);
|
172 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_WIRE*>,SAT_WIRE*>(lst_wire,wire,*this);
|
173 |
|
|
}
|
174 |
|
|
else if (strcmp(type_entite,"coedge")==0)
|
175 |
|
|
{
|
176 |
|
|
SAT_COEDGE* coedge=new SAT_COEDGE(ident);
|
177 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_COEDGE*>,SAT_COEDGE*>(lst_coedge,coedge,*this);
|
178 |
|
|
}
|
179 |
|
|
else if (strcmp(type_entite,"edge")==0)
|
180 |
|
|
{
|
181 |
|
|
SAT_EDGE* edge=new SAT_EDGE(ident);
|
182 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_EDGE*>,SAT_EDGE*>(lst_edge,edge,*this);
|
183 |
|
|
}
|
184 |
|
|
else if (strcmp(type_entite,"vertex")==0)
|
185 |
|
|
{
|
186 |
|
|
SAT_VERTEX* vertex=new SAT_VERTEX(ident);
|
187 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_VERTEX*>,SAT_VERTEX*>(lst_vertex,vertex,*this);
|
188 |
|
|
}
|
189 |
|
|
else if (strcmp(type_entite,"cone-surface")==0)
|
190 |
|
|
{
|
191 |
|
|
SAT_CONE* cone=new SAT_CONE(ident);
|
192 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_CONE*>,SAT_CONE*>(lst_cone,cone,*this);
|
193 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_SURFACE*>,SAT_SURFACE*>(lst_surface,cone,*this);
|
194 |
|
|
}
|
195 |
|
|
else if (strcmp(type_entite,"ellipse-curve")==0)
|
196 |
|
|
{
|
197 |
|
|
SAT_ELLIPSE* ellipse=new SAT_ELLIPSE(ident);
|
198 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_ELLIPSE*>,SAT_ELLIPSE*>(lst_ellipse,ellipse,*this);
|
199 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_COURBE*>,SAT_COURBE*>(lst_courbe,ellipse,*this);
|
200 |
|
|
}
|
201 |
|
|
else if (strcmp(type_entite,"plane-surface")==0)
|
202 |
|
|
{
|
203 |
|
|
SAT_PLANE* plane=new SAT_PLANE(ident);
|
204 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_PLANE*>,SAT_PLANE*>(lst_plane,plane,*this);
|
205 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_SURFACE*>,SAT_SURFACE*>(lst_surface,plane,*this);
|
206 |
|
|
}
|
207 |
|
|
else if (strcmp(type_entite,"point")==0)
|
208 |
|
|
{
|
209 |
|
|
SAT_POINT* point=new SAT_POINT(ident);
|
210 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_POINT*>,SAT_POINT*>(lst_point,point,*this);
|
211 |
|
|
}
|
212 |
|
|
else if (strcmp(type_entite,"straight-curve")==0)
|
213 |
|
|
{
|
214 |
|
|
SAT_STRAIGHT* straight=new SAT_STRAIGHT(ident);
|
215 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_STRAIGHT*>,SAT_STRAIGHT*>(lst_straight,straight,*this);
|
216 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_COURBE*>,SAT_COURBE*>(lst_courbe,straight,*this);
|
217 |
|
|
}
|
218 |
|
|
else if (strcmp(type_entite,"transform")==0)
|
219 |
|
|
{
|
220 |
|
|
SAT_TRANSFORM* transform=new SAT_TRANSFORM(ident);
|
221 |
|
|
ajouter<TPL_MAP_ENTITE<SAT_TRANSFORM*>,SAT_TRANSFORM*>(lst_transform,transform,*this);
|
222 |
|
|
}
|
223 |
|
|
|
224 |
|
|
else if (ident==0) commentaire=1;
|
225 |
|
|
else
|
226 |
|
|
{
|
227 |
|
|
// entite non traite
|
228 |
|
|
}
|
229 |
|
|
if (commentaire==0) ident++;
|
230 |
|
|
}
|
231 |
|
|
fclose(fic);
|
232 |
|
|
// deuxieme passsage
|
233 |
|
|
fic=fopen(nom,"rt");
|
234 |
|
|
if (fic==NULL)
|
235 |
|
|
{
|
236 |
|
|
return -1;
|
237 |
|
|
}
|
238 |
|
|
num=0;
|
239 |
|
|
while (num<100)
|
240 |
|
|
{
|
241 |
|
|
fgets(mess,500,fic);
|
242 |
|
|
sscanf(mess,"%d",&num);
|
243 |
|
|
}
|
244 |
|
|
sscanf(mess,"%d %d",&version,&num);
|
245 |
|
|
ident=0;
|
246 |
|
|
while (feof(fic)==0)
|
247 |
|
|
{
|
248 |
|
|
int commentaire=0;
|
249 |
|
|
char type_entite[30];
|
250 |
|
|
fgets(mess,500,fic);
|
251 |
|
|
int num;
|
252 |
|
|
for (num=0;num<(int)strlen(mess);num++)
|
253 |
|
|
if (mess[num]=='I') mess[num]=' ';
|
254 |
|
|
sscanf(mess,"%s",type_entite);
|
255 |
|
|
num=strlen(type_entite);
|
256 |
|
|
if (num>6)
|
257 |
|
|
{
|
258 |
|
|
if (type_entite[num-1]=='b')
|
259 |
|
|
if (type_entite[num-2]=='i')
|
260 |
|
|
if (type_entite[num-3]=='r')
|
261 |
|
|
if (type_entite[num-4]=='t')
|
262 |
|
|
if (type_entite[num-5]=='t')
|
263 |
|
|
if (type_entite[num-6]=='a')
|
264 |
|
|
strcpy(type_entite,"attrib");
|
265 |
|
|
}
|
266 |
|
|
if (strcmp(type_entite,"body")==0)
|
267 |
|
|
{
|
268 |
|
|
int n1,n2,n3,n4;
|
269 |
|
|
char c;
|
270 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d %c%d",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4);
|
271 |
|
|
SAT_BODY* body=(SAT_BODY *)lst_entity.getid(ident);
|
272 |
|
|
if (n1!=-1) body->attrib=(SAT_ATTRIB*)lst_entity.getid(n1);
|
273 |
|
|
else body->attrib=NULL;
|
274 |
|
|
if (n2!=-1) body->first_lump=(SAT_LUMP*)lst_entity.getid(n2);
|
275 |
|
|
else body->first_lump=NULL;
|
276 |
|
|
if (n3!=-1) body->first_wire=(SAT_WIRE*)lst_entity.getid(n3);
|
277 |
|
|
else body->first_wire=NULL;
|
278 |
|
|
if (n4!=-1) body->transform=(SAT_TRANSFORM*)lst_entity.getid(n4);
|
279 |
|
|
else body->transform=NULL;
|
280 |
|
|
}
|
281 |
|
|
else if (strcmp(type_entite,"attrib")==0)
|
282 |
|
|
{
|
283 |
|
|
}
|
284 |
|
|
else if (strcmp(type_entite,"lump")==0)
|
285 |
|
|
{
|
286 |
|
|
int n1,n2,n3,n4;
|
287 |
|
|
char c;
|
288 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d %c%d",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4);
|
289 |
|
|
SAT_LUMP* lump=(SAT_LUMP*)lst_entity.getid(ident);
|
290 |
|
|
if (n1!=-1) lump->attrib=(SAT_ATTRIB*)lst_entity.getid(n1);
|
291 |
|
|
else lump->attrib=NULL;
|
292 |
|
|
if (n2!=-1) lump->next_lump=(SAT_LUMP*)lst_entity.getid(n2);
|
293 |
|
|
else lump->next_lump=NULL;
|
294 |
|
|
if (n3!=-1) lump->first_shell=(SAT_SHELL*)lst_entity.getid(n3);
|
295 |
|
|
else lump->first_shell=NULL;
|
296 |
|
|
if (n4!=-1) lump->body=(SAT_BODY*)lst_entity.getid(n4);
|
297 |
|
|
else lump->body=NULL;
|
298 |
|
|
}
|
299 |
|
|
else if (strcmp(type_entite,"shell")==0)
|
300 |
|
|
{
|
301 |
|
|
int n1,n2,n3,n4,n5;
|
302 |
|
|
char c;
|
303 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d %c%d %c%d",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4,&c,&n5);
|
304 |
|
|
SAT_SHELL* shell=(SAT_SHELL*)lst_entity.getid(ident);
|
305 |
|
|
if (n1!=-1) shell->attrib=(SAT_ATTRIB*)lst_entity.getid(n1);
|
306 |
|
|
else shell->attrib=NULL;
|
307 |
|
|
if (n2!=-1) shell->next_shell=(SAT_SHELL*)lst_entity.getid(n2);
|
308 |
|
|
else shell->next_shell=NULL;
|
309 |
|
|
if (n3!=-1) shell->first_subshell=(SAT_SUBSHELL*)lst_entity.getid(n3);
|
310 |
|
|
else shell->first_subshell=NULL;
|
311 |
|
|
if (n4!=-1) shell->first_face=(SAT_FACE*)lst_entity.getid(n4);
|
312 |
|
|
else shell->first_face=NULL;
|
313 |
|
|
if (n5!=-1) shell->owning_lump=(SAT_LUMP*)lst_entity.getid(n5);
|
314 |
|
|
else shell->owning_lump=NULL;
|
315 |
|
|
}
|
316 |
|
|
else if (strcmp(type_entite,"face")==0)
|
317 |
|
|
{
|
318 |
|
|
int n1,n2,n3,n4,n5,n6;
|
319 |
|
|
char string1[25];
|
320 |
|
|
char string2[25];
|
321 |
|
|
char string3[25];
|
322 |
|
|
char c;
|
323 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d %c%d %c%d %c%d %s %s %s",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4,&c,&n5,&c,&n6,string1,string2,string3);
|
324 |
|
|
SAT_FACE* face=(SAT_FACE*)lst_entity.getid(ident);
|
325 |
|
|
if (n1!=-1) face->attrib=(SAT_ATTRIB*)lst_entity.getid(n1);
|
326 |
|
|
else face->attrib=NULL;
|
327 |
|
|
if (n2!=-1) face->next_face=(SAT_FACE*)lst_entity.getid(n2);
|
328 |
|
|
else face->next_face=NULL;
|
329 |
|
|
if (n3!=-1) face->first_loop=(SAT_LOOP*)lst_entity.getid(n3);
|
330 |
|
|
else face->first_loop=NULL;
|
331 |
|
|
if (n4!=-1) face->owning_shell=(SAT_SHELL*)lst_entity.getid(n4);
|
332 |
|
|
else face->owning_shell=NULL;
|
333 |
|
|
if (n5!=-1) face->owning_subshell=(SAT_SUBSHELL*)lst_entity.getid(n5);
|
334 |
|
|
else face->owning_subshell=NULL;
|
335 |
|
|
if (n6!=-1) face->surface=(SAT_SURFACE*)lst_entity.getid(n6);
|
336 |
|
|
else face->surface=NULL;
|
337 |
|
|
if (strcmp(string1,"forward")==0) face->sense=FORWARD; else face->sense=REVERSED;
|
338 |
|
|
if (strcmp(string2,"single")==0) face->simple_face=SINGLE; else face->simple_face=DOUBLE;
|
339 |
|
|
if (strcmp(string3,"out")==0) face->exterieur=IS_OUT; else face->exterieur=IS_IN;
|
340 |
|
|
}
|
341 |
|
|
else if (strcmp(type_entite,"loop")==0)
|
342 |
|
|
{
|
343 |
|
|
int n1,n2,n3,n4;
|
344 |
|
|
char c;
|
345 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d %c%d",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4);
|
346 |
|
|
SAT_LOOP* loop=(SAT_LOOP*)lst_entity.getid(ident);
|
347 |
|
|
if (n1!=-1) loop->attrib=(SAT_ATTRIB*)lst_entity.getid(n1);
|
348 |
|
|
else loop->attrib=NULL;
|
349 |
|
|
if (n2!=-1) loop->next_loop=(SAT_LOOP*)lst_entity.getid(n2);
|
350 |
|
|
else loop->next_loop=NULL;
|
351 |
|
|
if (n3!=-1) loop->first_coedge=(SAT_COEDGE*)lst_entity.getid(n3);
|
352 |
|
|
else loop->first_coedge=NULL;
|
353 |
|
|
if (n4!=-1) loop->owning_face=(SAT_FACE*)lst_entity.getid(n4);
|
354 |
|
|
else loop->owning_face=NULL;
|
355 |
|
|
}
|
356 |
|
|
else if (strcmp(type_entite,"subshell")==0)
|
357 |
|
|
{
|
358 |
|
|
int n1,n2,n3,n4,n5,n6;
|
359 |
|
|
char c;
|
360 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d %c%d %c%d %c%d",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4,&c,&n5,&c,&n6);
|
361 |
|
|
SAT_SUBSHELL* subshell=(SAT_SUBSHELL*)lst_entity.getid(ident);
|
362 |
|
|
if (n1!=-1) subshell->attrib=(SAT_ATTRIB*)lst_entity.getid(n1);
|
363 |
|
|
else subshell->attrib=NULL;
|
364 |
|
|
if (n2!=-1) subshell->parent_subshell=(SAT_SUBSHELL*)lst_entity.getid(n2);
|
365 |
|
|
else subshell->parent_subshell=NULL;
|
366 |
|
|
if (n3!=-1) subshell->next_subshell=(SAT_SUBSHELL*)lst_entity.getid(n3);
|
367 |
|
|
else subshell->next_subshell=NULL;
|
368 |
|
|
if (n4!=-1) subshell->first_subshell=(SAT_SUBSHELL*)lst_entity.getid(n4);
|
369 |
|
|
else subshell->first_subshell=NULL;
|
370 |
|
|
if (n5!=-1) subshell->first_face=(SAT_FACE*)lst_entity.getid(n5);
|
371 |
|
|
else subshell->first_face=NULL;
|
372 |
|
|
if (n6!=-1) subshell->owning_wire=(SAT_WIRE*)lst_entity.getid(n6);
|
373 |
|
|
else subshell->owning_wire=NULL;
|
374 |
|
|
}
|
375 |
|
|
else if (strcmp(type_entite,"wire")==0)
|
376 |
|
|
{
|
377 |
|
|
int n1,n2,n3,n4;
|
378 |
|
|
char c;
|
379 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d %c%d",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4);
|
380 |
|
|
SAT_WIRE* wire=(SAT_WIRE*)lst_entity.getid(ident);
|
381 |
|
|
if (n1!=-1) wire->attrib=(SAT_ATTRIB*)lst_entity.getid(n1);
|
382 |
|
|
else wire->attrib=NULL;
|
383 |
|
|
if (n2!=-1) wire->next_wire=(SAT_WIRE*)lst_entity.getid(n2);
|
384 |
|
|
else wire->next_wire=NULL;
|
385 |
|
|
if (n3!=-1) wire->first_coedge=(SAT_COEDGE*)lst_entity.getid(n3);
|
386 |
|
|
else wire->first_coedge=NULL;
|
387 |
|
|
if (n4!=-1) wire->owning=(void *)lst_entity.getid(n4);
|
388 |
|
|
else wire->owning=NULL;
|
389 |
|
|
}
|
390 |
|
|
else if (strcmp(type_entite,"coedge")==0)
|
391 |
|
|
{
|
392 |
|
|
int n1,n2,n3,n4,n5,n6,n7;
|
393 |
|
|
int num;
|
394 |
|
|
char string1[30];
|
395 |
|
|
char c;
|
396 |
|
|
if (version<200)
|
397 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d %c%d %c%d %d %c%d %c%d",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4,&c,&n5,&num,&c,&n6,&c,&n7);
|
398 |
|
|
else sscanf(mess,"%s %c%d %c%d %c%d %c%d %c%d %s %c%d %c%d",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4,&c,&n5,string1,&c,&n6,&c,&n7);
|
399 |
|
|
|
400 |
|
|
SAT_COEDGE* coedge=(SAT_COEDGE*)lst_entity.getid(ident);
|
401 |
|
|
if (n1!=-1) coedge->attrib=(SAT_ATTRIB*)lst_entity.getid(n1);
|
402 |
|
|
else coedge->attrib=NULL;
|
403 |
|
|
if (n2!=-1) coedge->next_coedge=(SAT_COEDGE*)lst_entity.getid(n2);
|
404 |
|
|
else coedge->next_coedge=NULL;
|
405 |
|
|
if (n3!=-1) coedge->previous_coedge=(SAT_COEDGE*)lst_entity.getid(n3);
|
406 |
|
|
else coedge->previous_coedge=NULL;
|
407 |
|
|
if (n4!=-1) coedge->partner_coedge=(SAT_COEDGE*)lst_entity.getid(n4);
|
408 |
|
|
else coedge->partner_coedge=NULL;
|
409 |
|
|
if (n5!=-1) coedge->edge=(SAT_EDGE*)lst_entity.getid(n5);
|
410 |
|
|
else coedge->edge=NULL;
|
411 |
|
|
if (version<200) coedge->sense=-2*num+1;
|
412 |
|
|
else
|
413 |
|
|
if (strcmp(string1,"forward")==0) coedge->sense=FORWARD; else coedge->sense=REVERSED;
|
414 |
|
|
if (n6!=-1) coedge->owning_loop=(SAT_LOOP*)lst_entity.getid(n6);
|
415 |
|
|
else coedge->owning_loop=NULL;
|
416 |
|
|
if (n7!=-1) coedge->pcurve=(SAT_PCURVE*)lst_entity.getid(n7);
|
417 |
|
|
else coedge->pcurve=NULL;
|
418 |
|
|
}
|
419 |
|
|
else if (strcmp(type_entite,"edge")==0)
|
420 |
|
|
{
|
421 |
|
|
int n1,n2,n3,n4,n5;
|
422 |
|
|
double f1,f2;
|
423 |
|
|
int num;
|
424 |
|
|
char string1[30];
|
425 |
|
|
char c;
|
426 |
|
|
if (version<200)
|
427 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d %c%d %c%d %d",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4,&c,&n5,&num);
|
428 |
|
|
else if (version<500)
|
429 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d %c%d %c%d %s",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4,&c,&n5,string1);
|
430 |
|
|
else sscanf(mess,"%s %c%d %c%d %lf %c%d %lf %c%d %c%d %s",type_entite,&c,&n1,&c,&n2,&f1,&c,&n3,&f2,&c,&n4,&c,&n5,string1);
|
431 |
|
|
SAT_EDGE* edge=(SAT_EDGE*)lst_entity.getid(ident);
|
432 |
|
|
if (n1!=-1) edge->attrib=(SAT_ATTRIB*)lst_entity.getid(n1);
|
433 |
|
|
else edge->attrib=NULL;
|
434 |
|
|
if (n2!=-1) edge->start_vertex=(SAT_VERTEX*)lst_entity.getid(n2);
|
435 |
|
|
else edge->start_vertex=NULL;
|
436 |
|
|
if (n3!=-1) edge->end_vertex=(SAT_VERTEX*)lst_entity.getid(n3);
|
437 |
|
|
else edge->end_vertex=NULL;
|
438 |
|
|
if (n4!=-1) edge->owning_coedge=(SAT_COEDGE*)lst_entity.getid(n4);
|
439 |
|
|
else edge->owning_coedge=NULL;
|
440 |
|
|
if (n5!=-1) edge->curve=(SAT_COURBE*) lst_entity.getid(n5);
|
441 |
|
|
else edge->curve=NULL;
|
442 |
|
|
if (version<200)
|
443 |
|
|
if (num==0) edge->sense=1; else edge->sense=-1;
|
444 |
|
|
else
|
445 |
|
|
if (strcmp(string1,"forward")==0) edge->sense=FORWARD; else edge->sense=REVERSED;
|
446 |
|
|
}
|
447 |
|
|
else if (strcmp(type_entite,"vertex")==0)
|
448 |
|
|
{
|
449 |
|
|
int n1,n2,n3;
|
450 |
|
|
char c;
|
451 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d",type_entite,&c,&n1,&c,&n2,&c,&n3);
|
452 |
|
|
SAT_VERTEX* vertex=(SAT_VERTEX*)lst_entity.getid(ident);
|
453 |
|
|
if (n1!=-1) vertex->attrib=(SAT_ATTRIB*)lst_entity.getid(n1);
|
454 |
|
|
else vertex->attrib=NULL;
|
455 |
|
|
if (n2!=-1) vertex->owning_edge=(SAT_EDGE*)lst_entity.getid(n2);
|
456 |
|
|
else vertex->owning_edge=NULL;
|
457 |
|
|
if (n3!=-1) vertex->point=(SAT_POINT*)lst_entity.getid(n3);
|
458 |
|
|
else vertex->point=NULL;
|
459 |
|
|
}
|
460 |
|
|
else if (strcmp(type_entite,"cone-surface")==0)
|
461 |
|
|
{
|
462 |
|
|
int n1;
|
463 |
|
|
double f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12;
|
464 |
|
|
char c;
|
465 |
|
|
sscanf(mess,"%s %c%d %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf",type_entite,&c,&n1,&f1,&f2,&f3,&f4,&f5,&f6,&f7,&f8,&f9,&f10,&f11,&f12);
|
466 |
|
|
SAT_CONE* cone=(SAT_CONE*)lst_entity.getid(ident);
|
467 |
|
|
if (n1!=-1) cone->attrib=(SAT_ATTRIB*)lst_entity.getid(n1);
|
468 |
|
|
else cone->attrib=NULL;
|
469 |
|
|
cone->center[0]=f1;
|
470 |
|
|
cone->center[1]=f2;
|
471 |
|
|
cone->center[2]=f3;
|
472 |
|
|
cone->normal[0]=f4;
|
473 |
|
|
cone->normal[1]=f5;
|
474 |
|
|
cone->normal[2]=f6;
|
475 |
|
|
cone->major[0]=f7;
|
476 |
|
|
cone->major[1]=f8;
|
477 |
|
|
cone->major[2]=f9;
|
478 |
|
|
cone->ratio=f10;
|
479 |
|
|
cone->cosalpha=f12;
|
480 |
|
|
cone->sinalpha=f11;
|
481 |
|
|
cone->calcule_parametre();
|
482 |
|
|
}
|
483 |
|
|
else if (strcmp(type_entite,"ellipse-curve")==0)
|
484 |
|
|
{
|
485 |
|
|
int n1;
|
486 |
|
|
double f1,f2,f3,f4,f5,f6,f7,f8,f9,f10;
|
487 |
|
|
char c;
|
488 |
|
|
sscanf(mess,"%s %c%d %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf",type_entite,&c,&n1,&f1,&f2,&f3,&f4,&f5,&f6,&f7,&f8,&f9,&f10);
|
489 |
|
|
SAT_ELLIPSE* ellipse=(SAT_ELLIPSE*)lst_entity.getid(ident);
|
490 |
|
|
if (n1!=-1) ellipse->attrib=(SAT_ATTRIB*)lst_entity.getid(n1);
|
491 |
|
|
else ellipse->attrib=NULL;
|
492 |
|
|
ellipse->center[0]=f1;
|
493 |
|
|
ellipse->center[1]=f2;
|
494 |
|
|
ellipse->center[2]=f3;
|
495 |
|
|
ellipse->normal[0]=f4;
|
496 |
|
|
ellipse->normal[1]=f5;
|
497 |
|
|
ellipse->normal[2]=f6;
|
498 |
|
|
ellipse->major[0]=f7;
|
499 |
|
|
ellipse->major[1]=f8;
|
500 |
|
|
ellipse->major[2]=f9;
|
501 |
|
|
ellipse->ratio=f10;
|
502 |
|
|
ellipse->calcul_parametre();
|
503 |
|
|
}
|
504 |
|
|
else if (strcmp(type_entite,"pcurve")==0)
|
505 |
|
|
{
|
506 |
|
|
}
|
507 |
|
|
else if (strcmp(type_entite,"plane-surface")==0)
|
508 |
|
|
{
|
509 |
|
|
int n1;
|
510 |
|
|
double f1,f2,f3,f4,f5,f6,f7,f8,f9;
|
511 |
|
|
char c;
|
512 |
|
|
sscanf(mess,"%s %c%d %lf %lf %lf %lf %lf %lf %lf %lf %lf",type_entite,&c,&n1,&f1,&f2,&f3,&f4,&f5,&f6,&f7,&f8,&f9);
|
513 |
|
|
SAT_PLANE* plane=(SAT_PLANE*)lst_entity.getid(ident);
|
514 |
|
|
if (n1!=-1) plane->attrib=(SAT_ATTRIB*)lst_entity.getid(n1);
|
515 |
|
|
else plane->attrib=NULL;
|
516 |
|
|
plane->root[0]=f1;
|
517 |
|
|
plane->root[1]=f2;
|
518 |
|
|
plane->root[2]=f3;
|
519 |
|
|
plane->normal[0]=f4;
|
520 |
|
|
plane->normal[1]=f5;
|
521 |
|
|
plane->normal[2]=f6;
|
522 |
|
|
plane->u_deriv[0]=f7;
|
523 |
|
|
plane->u_deriv[1]=f8;
|
524 |
|
|
plane->u_deriv[2]=f9;
|
525 |
|
|
plane->calcule_parametre();
|
526 |
|
|
}
|
527 |
|
|
else if (strcmp(type_entite,"point")==0)
|
528 |
|
|
{
|
529 |
|
|
int n1;
|
530 |
|
|
double f1,f2,f3;
|
531 |
|
|
char c;
|
532 |
|
|
sscanf(mess,"%s %c%d %lf %lf %lf",type_entite,&c,&n1,&f1,&f2,&f3);
|
533 |
|
|
SAT_POINT* point=(SAT_POINT*)lst_entity.getid(ident);
|
534 |
|
|
if (n1!=-1) point->attrib=(SAT_ATTRIB*)lst_entity.getid(n1);
|
535 |
|
|
else point->attrib=NULL;
|
536 |
|
|
point->coord[0]=f1;
|
537 |
|
|
point->coord[1]=f2;
|
538 |
|
|
point->coord[2]=f3;
|
539 |
|
|
}
|
540 |
|
|
else if (strcmp(type_entite,"straight-curve")==0)
|
541 |
|
|
{
|
542 |
|
|
int n1;
|
543 |
|
|
double f1,f2,f3,f4,f5,f6;
|
544 |
|
|
char c;
|
545 |
|
|
sscanf(mess,"%s %c%d %lf %lf %lf %lf %lf %lf ",type_entite,&c,&n1,&f1,&f2,&f3,&f4,&f5,&f6);
|
546 |
|
|
SAT_STRAIGHT* straight=(SAT_STRAIGHT*)lst_entity.getid(ident);
|
547 |
|
|
if (n1!=-1) straight->attrib=(SAT_ATTRIB*)lst_entity.getid(n1);
|
548 |
|
|
else straight->attrib=NULL;
|
549 |
|
|
straight->root[0]=f1;
|
550 |
|
|
straight->root[1]=f2;
|
551 |
|
|
straight->root[2]=f3;
|
552 |
|
|
straight->dir[0]=f4;
|
553 |
|
|
straight->dir[1]=f5;
|
554 |
|
|
straight->dir[2]=f6;
|
555 |
|
|
}
|
556 |
|
|
else if (strcmp(type_entite,"transform")==0)
|
557 |
|
|
{
|
558 |
|
|
int n1,n2,n3,n4;
|
559 |
|
|
double f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13;
|
560 |
|
|
char c;
|
561 |
|
|
sscanf(mess,"%s %c%d %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %d %d %d",type_entite,&c,&n1,&f1,&f2,&f3,&f4,&f5,&f6,&f7,&f8,&f9,&f10,&f11,&f12,&f13,&n2,&n3,&n4);
|
562 |
|
|
SAT_TRANSFORM* transform=(SAT_TRANSFORM*)lst_entity.getid(ident);
|
563 |
|
|
if (n1!=-1) transform->attrib=(SAT_ATTRIB*)lst_entity.getid(n1);
|
564 |
|
|
else transform->attrib=NULL;
|
565 |
|
|
transform->rotation[0][0]=f1;
|
566 |
|
|
transform->rotation[0][1]=f2;
|
567 |
|
|
transform->rotation[0][2]=f3;
|
568 |
|
|
transform->rotation[1][0]=f4;
|
569 |
|
|
transform->rotation[1][1]=f5;
|
570 |
|
|
transform->rotation[1][2]=f6;
|
571 |
|
|
transform->rotation[2][0]=f7;
|
572 |
|
|
transform->rotation[2][1]=f8;
|
573 |
|
|
transform->rotation[2][2]=f9;
|
574 |
|
|
transform->trans[0]=f10;
|
575 |
|
|
transform->trans[1]=f11;
|
576 |
|
|
transform->trans[2]=f12;
|
577 |
|
|
transform->scaling_factor=f13;
|
578 |
|
|
transform->rotate=n2;
|
579 |
|
|
transform->reflection=n3;
|
580 |
|
|
transform->shear=n4;
|
581 |
|
|
}
|
582 |
|
|
else if (ident==0) commentaire=1;
|
583 |
|
|
if (commentaire==0) ident++;
|
584 |
|
|
}
|
585 |
|
|
fclose(fic);
|
586 |
|
|
return version;
|
587 |
|
|
}
|
588 |
|
|
|