1 |
//------------------------------------------------------------ |
2 |
//------------------------------------------------------------ |
3 |
// MAGiC |
4 |
// Jean Christophe Cuilli�e et Vincent FRANCOIS |
5 |
// D�artement de G�ie M�anique - UQTR |
6 |
//------------------------------------------------------------ |
7 |
// Le projet MAGIC est un projet de recherche du d�artement |
8 |
// de g�ie m�anique de l'Universit�du Qu�ec � |
9 |
// Trois Rivi�es |
10 |
// Les librairies ne peuvent �re utilis�s sans l'accord |
11 |
// des auteurs (contact : francois@uqtr.ca) |
12 |
//------------------------------------------------------------ |
13 |
//------------------------------------------------------------ |
14 |
// |
15 |
// main.cpp |
16 |
// |
17 |
//------------------------------------------------------------ |
18 |
//------------------------------------------------------------ |
19 |
// COPYRIGHT 2000 |
20 |
// Version du 02/03/2006 �11H25 |
21 |
//------------------------------------------------------------ |
22 |
//------------------------------------------------------------ |
23 |
#include "gestionversion.h" |
24 |
|
25 |
|
26 |
#include <iostream> |
27 |
#include "ndata.h" |
28 |
#include "vtkdisplay.h" |
29 |
#include "mg_file.h" |
30 |
#include "occ_import.h" |
31 |
#include <map> |
32 |
//--------------------------------------------------------------------------- |
33 |
|
34 |
void affiche(char* message) |
35 |
{ |
36 |
std::cout << message << std::endl; |
37 |
|
38 |
} |
39 |
|
40 |
|
41 |
|
42 |
|
43 |
void affiche_structure(color cface,color carete,color ctext,color cdeplacement,color cforce,color cpression,color ctemperature, color cflux,MG_GEOMETRIE* geo,MG_MAILLAGE* mai,data_container &data,bool idori) |
44 |
{ |
45 |
properties ptr=data.getproptriangles(); |
46 |
ptr.c=cface; |
47 |
ptr.edgeon=false; |
48 |
data.setproptriangles(ptr); |
49 |
ptr=data.getpropquads(); |
50 |
ptr.c=cface; |
51 |
ptr.edgeon=false; |
52 |
data.setpropquads(ptr); |
53 |
|
54 |
LISTE_MG_FACE::iterator itf; |
55 |
for (MG_FACE* face=geo->get_premier_face(itf);face!=NULL;face=geo->get_suivant_face(itf)) |
56 |
{ |
57 |
double xg=0.,yg=0.,zg=0.,deno=0.; |
58 |
int nbtri=face->get_lien_maillage()->get_nb(); |
59 |
for (int i=0;i<nbtri;i++) |
60 |
{ |
61 |
MG_ELEMENT_MAILLAGE* ele=face->get_lien_maillage()->get(i); |
62 |
color c=cface; |
63 |
int nbccf=ele->get_lien_topologie()->get_nb_ccf(); |
64 |
for (int i=0;i<nbccf;i++) |
65 |
{ |
66 |
char typ[2]; |
67 |
ele->get_lien_topologie()->get_type_ccf(i,typ); |
68 |
if (typ[0]=='D') c=cdeplacement; |
69 |
if (typ[0]=='R') c=cdeplacement; |
70 |
if (typ[0]=='F') c=cforce; |
71 |
if (typ[0]=='P') c=cpression; |
72 |
if (typ[0]=='T') c=ctemperature; |
73 |
if (typ[0]=='f') c=cflux; |
74 |
} |
75 |
if (ele->get_type_entite()==IDMG_TRIANGLE) |
76 |
{ |
77 |
properties ptr=data.getproptriangles(); |
78 |
ptr.c=c; |
79 |
data.setproptriangles(ptr); |
80 |
MG_TRIANGLE* tri=(MG_TRIANGLE*)ele; |
81 |
if (mai->get_mg_triangleid(tri->get_id())!=tri) continue; |
82 |
double *xyz1=tri->get_noeud1()->get_coord(); |
83 |
double *xyz2=tri->get_noeud2()->get_coord(); |
84 |
double *xyz3=tri->get_noeud3()->get_coord(); |
85 |
npoint p1(xyz1[0],xyz1[1],xyz1[2]); |
86 |
npoint p2(xyz2[0],xyz2[1],xyz2[2]); |
87 |
npoint p3(xyz3[0],xyz3[1],xyz3[2]); |
88 |
triangle tr; |
89 |
tr.pts[0]=p1; |
90 |
tr.pts[1]=p2; |
91 |
tr.pts[2]=p3; |
92 |
data.add_triangle(tr); |
93 |
OT_VECTEUR_3D vec1(xyz1,xyz2); |
94 |
OT_VECTEUR_3D vec2(xyz1,xyz3); |
95 |
OT_VECTEUR_3D sur=vec1&vec2; |
96 |
xg=xg+0.3333333333*(xyz1[0]+xyz2[0]+xyz3[0])*sur.get_longueur(); |
97 |
yg=yg+0.3333333333*(xyz1[1]+xyz2[1]+xyz3[1])*sur.get_longueur(); |
98 |
zg=zg+0.3333333333*(xyz1[2]+xyz2[2]+xyz3[2])*sur.get_longueur(); |
99 |
deno=deno+sur.get_longueur(); |
100 |
} |
101 |
if (ele->get_type_entite()==IDMG_QUADRANGLE) |
102 |
{ |
103 |
ptr=data.getpropquads(); |
104 |
ptr.c=c; |
105 |
data.setpropquads(ptr); |
106 |
MG_QUADRANGLE* qua=(MG_QUADRANGLE*)ele; |
107 |
if (mai->get_mg_quadrangleid(qua->get_id())!=qua) continue; |
108 |
double *xyz1=qua->get_noeud1()->get_coord(); |
109 |
double *xyz2=qua->get_noeud2()->get_coord(); |
110 |
double *xyz3=qua->get_noeud3()->get_coord(); |
111 |
double *xyz4=qua->get_noeud4()->get_coord(); |
112 |
npoint p1(xyz1[0],xyz1[1],xyz1[2]); |
113 |
npoint p2(xyz2[0],xyz2[1],xyz2[2]); |
114 |
npoint p3(xyz3[0],xyz3[1],xyz3[2]); |
115 |
npoint p4(xyz4[0],xyz4[1],xyz4[2]); |
116 |
quad qd; |
117 |
qd.pts[0]=p1; |
118 |
qd.pts[1]=p2; |
119 |
qd.pts[2]=p3; |
120 |
qd.pts[3]=p4; |
121 |
data.add_quad(qd); |
122 |
OT_VECTEUR_3D vec1(xyz1,xyz2); |
123 |
OT_VECTEUR_3D vec2(xyz1,xyz3); |
124 |
OT_VECTEUR_3D vec3(xyz1,xyz4); |
125 |
OT_VECTEUR_3D sur=vec1&vec2; |
126 |
OT_VECTEUR_3D sur2=vec2&vec3; |
127 |
xg=xg+0.3333333333*(xyz1[0]+xyz2[0]+xyz3[0])*sur.get_longueur(); |
128 |
yg=yg+0.3333333333*(xyz1[1]+xyz2[1]+xyz3[1])*sur.get_longueur(); |
129 |
zg=zg+0.3333333333*(xyz1[2]+xyz2[2]+xyz3[2])*sur.get_longueur(); |
130 |
xg=xg+0.3333333333*(xyz1[0]+xyz4[0]+xyz3[0])*sur2.get_longueur(); |
131 |
yg=yg+0.3333333333*(xyz1[1]+xyz4[1]+xyz3[1])*sur2.get_longueur(); |
132 |
zg=zg+0.3333333333*(xyz1[2]+xyz4[2]+xyz3[2])*sur2.get_longueur(); |
133 |
deno=deno+sur.get_longueur()+sur2.get_longueur(); |
134 |
} |
135 |
} |
136 |
xg=xg/deno; |
137 |
yg=yg/deno; |
138 |
zg=zg/deno; |
139 |
std::map<double,MG_ELEMENT_MAILLAGE*> classe; |
140 |
for (int i=0;i<nbtri;i++) |
141 |
{ |
142 |
MG_ELEMENT_MAILLAGE* ele=face->get_lien_maillage()->get(i); |
143 |
if (ele->get_type_entite()==IDMG_TRIANGLE) |
144 |
{ |
145 |
MG_TRIANGLE* tri=(MG_TRIANGLE*)ele; |
146 |
if (mai->get_mg_triangleid(tri->get_id())!=tri) continue; |
147 |
double *xyz1=tri->get_noeud1()->get_coord(); |
148 |
double *xyz2=tri->get_noeud2()->get_coord(); |
149 |
double *xyz3=tri->get_noeud3()->get_coord(); |
150 |
double x=0.3333333333*(xyz1[0]+xyz2[0]+xyz3[0]); |
151 |
double y=0.3333333333*(xyz1[1]+xyz2[1]+xyz3[1]); |
152 |
double z=0.3333333333*(xyz1[2]+xyz2[2]+xyz3[2]); |
153 |
OT_VECTEUR_3D vec(x-xg,y-yg,z-zg); |
154 |
classe.insert(std::pair<double,MG_ELEMENT_MAILLAGE*>(vec.get_longueur2(),tri)); |
155 |
} |
156 |
if (ele->get_type_entite()==IDMG_QUADRANGLE) |
157 |
{ |
158 |
MG_QUADRANGLE* qua=(MG_QUADRANGLE*)ele; |
159 |
if (mai->get_mg_quadrangleid(qua->get_id())!=qua) continue; |
160 |
double *xyz1=qua->get_noeud1()->get_coord(); |
161 |
double *xyz2=qua->get_noeud2()->get_coord(); |
162 |
double *xyz3=qua->get_noeud3()->get_coord(); |
163 |
double *xyz4=qua->get_noeud4()->get_coord(); |
164 |
double x=0.25*(xyz1[0]+xyz2[0]+xyz3[0]+xyz4[0]); |
165 |
double y=0.25*(xyz1[1]+xyz2[1]+xyz3[1]+xyz4[1]); |
166 |
double z=0.25*(xyz1[2]+xyz2[2]+xyz3[2]+xyz4[2]); |
167 |
OT_VECTEUR_3D vec(x-xg,y-yg,z-zg); |
168 |
classe.insert(std::pair<double,MG_ELEMENT_MAILLAGE*>(vec.get_longueur2(),qua)); |
169 |
} |
170 |
} |
171 |
if (classe.size()>0) |
172 |
{ |
173 |
MG_ELEMENT_MAILLAGE *ele=classe.begin()->second; |
174 |
if (ele->get_type_entite()==IDMG_TRIANGLE) |
175 |
{ |
176 |
MG_TRIANGLE *tri=(MG_TRIANGLE*)ele; |
177 |
double *xyz1=tri->get_noeud1()->get_coord(); |
178 |
double *xyz2=tri->get_noeud2()->get_coord(); |
179 |
double *xyz3=tri->get_noeud3()->get_coord(); |
180 |
npoint p(0.3333333333*(xyz1[0]+xyz2[0]+xyz3[0]),0.3333333333*(xyz1[1]+xyz2[1]+xyz3[1]),0.3333333333*(xyz1[2]+xyz2[2]+xyz3[2])); |
181 |
point pp; |
182 |
pp.pts=p; |
183 |
char mess[255]; |
184 |
if (idori==false) sprintf(mess,"F%lu",face->get_id()); else sprintf(mess,"%s",face->get_idoriginal().c_str()); |
185 |
pp.info=mess; |
186 |
std::pair<point,color> tmp(pp,ctext); |
187 |
data.add_text(2,tmp); |
188 |
} |
189 |
if (ele->get_type_entite()==IDMG_QUADRANGLE) |
190 |
{ |
191 |
MG_QUADRANGLE *qua=(MG_QUADRANGLE*)ele; |
192 |
double *xyz1=qua->get_noeud1()->get_coord(); |
193 |
double *xyz2=qua->get_noeud2()->get_coord(); |
194 |
double *xyz3=qua->get_noeud3()->get_coord(); |
195 |
double *xyz4=qua->get_noeud4()->get_coord(); |
196 |
npoint p(0.25*(xyz1[0]+xyz2[0]+xyz3[0]+xyz4[0]),0.25*(xyz1[1]+xyz2[1]+xyz3[1]+xyz4[1]),0.25*(xyz1[2]+xyz2[2]+xyz3[2]+xyz4[2])); |
197 |
point pp; |
198 |
pp.pts=p; |
199 |
char mess[255]; |
200 |
if (idori==false) sprintf(mess,"F%lu",face->get_id()); else sprintf(mess,"%s",face->get_idoriginal().c_str()); |
201 |
pp.info=mess; |
202 |
std::pair<point,color> tmp(pp,ctext); |
203 |
data.add_text(2,tmp); |
204 |
} |
205 |
} |
206 |
} |
207 |
|
208 |
ptr=data.getproplines(); |
209 |
ptr.c=carete; |
210 |
ptr.thickness=2; |
211 |
data.setproplines(ptr); |
212 |
|
213 |
LISTE_MG_ARETE::iterator ita; |
214 |
for (MG_ARETE* are=geo->get_premier_arete(ita);are!=NULL;are=geo->get_suivant_arete(ita)) |
215 |
{ |
216 |
int nbseg=are->get_lien_maillage()->get_nb(); |
217 |
double xg=0.,yg=0.,zg=0.,deno=0.; |
218 |
for (int i=0;i<nbseg;i++) |
219 |
{ |
220 |
MG_SEGMENT* seg=(MG_SEGMENT*)are->get_lien_maillage()->get(i); |
221 |
if (mai->get_mg_segmentid(seg->get_id())!=seg) continue; |
222 |
color c=carete; |
223 |
int nbccf=seg->get_lien_topologie()->get_nb_ccf(); |
224 |
for (int i=0;i<nbccf;i++) |
225 |
{ |
226 |
char typ[2]; |
227 |
seg->get_lien_topologie()->get_type_ccf(i,typ); |
228 |
if (typ[0]=='D') c=cdeplacement; |
229 |
if (typ[0]=='R') c=cdeplacement; |
230 |
if (typ[0]=='F') c=cforce; |
231 |
if (typ[0]=='P') c=cpression; |
232 |
if (typ[0]=='T') c=ctemperature; |
233 |
if (typ[0]=='f') c=cflux; |
234 |
} |
235 |
ptr=data.getproplines(); |
236 |
ptr.c=c; |
237 |
ptr.thickness=2; |
238 |
data.setproplines(ptr); |
239 |
double *xyz1=seg->get_noeud1()->get_coord(); |
240 |
double *xyz2=seg->get_noeud2()->get_coord(); |
241 |
npoint p1(xyz1[0],xyz1[1],xyz1[2]); |
242 |
npoint p2(xyz2[0],xyz2[1],xyz2[2]); |
243 |
line li; |
244 |
li.pts[0]=p1; |
245 |
li.pts[1]=p2; |
246 |
data.add_line(li); |
247 |
OT_VECTEUR_3D vec(xyz1,xyz2); |
248 |
xg=xg+0.5*(xyz1[0]+xyz2[0])*vec.get_longueur(); |
249 |
yg=yg+0.5*(xyz1[1]+xyz2[1])*vec.get_longueur(); |
250 |
zg=zg+0.5*(xyz1[2]+xyz2[2])*vec.get_longueur(); |
251 |
deno=deno+vec.get_longueur(); |
252 |
} |
253 |
xg=xg/deno; |
254 |
yg=yg/deno; |
255 |
zg=zg/deno; |
256 |
std::map<double,MG_SEGMENT*> classeseg; |
257 |
for (int i=0;i<nbseg;i++) |
258 |
{ |
259 |
MG_SEGMENT* seg=(MG_SEGMENT*)are->get_lien_maillage()->get(i); |
260 |
if (mai->get_mg_segmentid(seg->get_id())!=seg) continue; |
261 |
double *xyz1=seg->get_noeud1()->get_coord(); |
262 |
double *xyz2=seg->get_noeud2()->get_coord(); |
263 |
double x=0.5*(xyz1[0]+xyz2[0]); |
264 |
double y=0.5*(xyz1[1]+xyz2[1]); |
265 |
double z=0.5*(xyz1[2]+xyz2[2]); |
266 |
OT_VECTEUR_3D vec(x-xg,y-yg,z-zg); |
267 |
classeseg.insert(std::pair<double,MG_SEGMENT*>(vec.get_longueur2(),seg)); |
268 |
} |
269 |
if (classeseg.size()>0) |
270 |
{ |
271 |
MG_SEGMENT* seg=classeseg.begin()->second; |
272 |
double *xyz1=seg->get_noeud1()->get_coord(); |
273 |
double *xyz2=seg->get_noeud2()->get_coord(); |
274 |
npoint p(0.5*(xyz1[0]+xyz2[0]),0.5*(xyz1[1]+xyz2[1]),0.5*(xyz1[2]+xyz2[2])); |
275 |
point pp; |
276 |
pp.pts=p; |
277 |
char mess[255]; |
278 |
if (idori==false) sprintf(mess,"E%lu",are->get_id()); else sprintf(mess,"%s",are->get_idoriginal().c_str()); |
279 |
pp.info=mess; |
280 |
std::pair<point,color> tmp(pp,ctext); |
281 |
data.add_text(1,tmp); |
282 |
} |
283 |
} |
284 |
|
285 |
|
286 |
ptr=data.getproppoints(); |
287 |
ptr.c=carete; |
288 |
ptr.pointsize=10; |
289 |
data.setproppoints(ptr); |
290 |
LISTE_MG_SOMMET::iterator its; |
291 |
for (MG_SOMMET* som=geo->get_premier_sommet(its);som!=NULL;som=geo->get_suivant_sommet(its)) |
292 |
{ |
293 |
int nbpoint=som->get_lien_maillage()->get_nb(); |
294 |
for (int i=0;i<nbpoint;i++) |
295 |
{ |
296 |
MG_NOEUD* nd=(MG_NOEUD*)som->get_lien_maillage()->get(i); |
297 |
if (mai->get_mg_noeudid(nd->get_id())!=nd) continue; |
298 |
color c=carete; |
299 |
int nbccf=nd->get_lien_topologie()->get_nb_ccf(); |
300 |
for (int i=0;i<nbccf;i++) |
301 |
{ |
302 |
char typ[2]; |
303 |
nd->get_lien_topologie()->get_type_ccf(i,typ); |
304 |
if (typ[0]=='D') c=cdeplacement; |
305 |
if (typ[0]=='R') c=cdeplacement; |
306 |
if (typ[0]=='F') c=cforce; |
307 |
if (typ[0]=='P') c=cpression; |
308 |
if (typ[0]=='T') c=ctemperature; |
309 |
if (typ[0]=='f') c=cflux; |
310 |
} |
311 |
ptr=data.getproppoints(); |
312 |
ptr.c=c; |
313 |
data.setproppoints(ptr); |
314 |
double *xyz1=nd->get_coord(); |
315 |
npoint p1(xyz1[0],xyz1[1],xyz1[2]); |
316 |
data.add_point(p1); |
317 |
point pp; |
318 |
pp.pts=p1; |
319 |
char mess[255]; |
320 |
if (idori==false) sprintf(mess,"V%lu",som->get_id()); else sprintf(mess,"%s",som->get_idoriginal().c_str()); |
321 |
pp.info=mess; |
322 |
std::pair<point,color> tmp(pp,ctext); |
323 |
data.add_text(0,tmp); |
324 |
} |
325 |
} |
326 |
|
327 |
|
328 |
|
329 |
|
330 |
}; |
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 |
|
338 |
int main(int argc,char **argv) |
339 |
{ |
340 |
color base=color(0,0,0); |
341 |
color carete(255,255,255); |
342 |
color cface(125,125,125); |
343 |
color ctext(255,255,255); |
344 |
color cdeplacement(255,151,1); |
345 |
color cforce(255,1,1); |
346 |
color cpression(33,249,13); |
347 |
color ctemperature(246,07,193); |
348 |
color cflux(252,250,03); |
349 |
|
350 |
char chemin[1000]; |
351 |
sprintf(chemin,"%s/.vtkdisplay",getenv("HOME")); |
352 |
FILE *in=fopen(chemin,"rt"); |
353 |
if (in!=NULL) |
354 |
{ |
355 |
char mess[255]; |
356 |
fgets(mess,255,in); |
357 |
int R,G,B; |
358 |
int nb=sscanf(mess,"%d %d %d",&R,&G,&B); |
359 |
if (nb==3) base=color(R,G,B); |
360 |
if (!feof(in)) |
361 |
{ |
362 |
fgets(mess,255,in); |
363 |
nb=sscanf(mess,"%d %d %d",&R,&G,&B); |
364 |
if (nb==3) cface=color(R,G,B); |
365 |
if (!feof(in)) |
366 |
{ |
367 |
fgets(mess,255,in); |
368 |
nb=sscanf(mess,"%d %d %d",&R,&G,&B); |
369 |
if (nb==3) carete=color(R,G,B); |
370 |
if (!feof(in)) |
371 |
{ |
372 |
fgets(mess,255,in); |
373 |
nb=sscanf(mess,"%d %d %d",&R,&G,&B); |
374 |
if (nb==3) ctext=color(R,G,B); |
375 |
if (!feof(in)) |
376 |
{ |
377 |
fgets(mess,255,in); |
378 |
nb=sscanf(mess,"%d %d %d",&R,&G,&B); |
379 |
if (nb==3) cdeplacement=color(R,G,B); |
380 |
if (!feof(in)) |
381 |
{ |
382 |
fgets(mess,255,in); |
383 |
nb=sscanf(mess,"%d %d %d",&R,&G,&B); |
384 |
if (nb==3) cforce=color(R,G,B); |
385 |
if (!feof(in)) |
386 |
{ |
387 |
fgets(mess,255,in); |
388 |
nb=sscanf(mess,"%d %d %d",&R,&G,&B); |
389 |
if (nb==3) cpression=color(R,G,B); |
390 |
if (!feof(in)) |
391 |
{ |
392 |
fgets(mess,255,in); |
393 |
nb=sscanf(mess,"%d %d %d",&R,&G,&B); |
394 |
if (nb==3) ctemperature=color(R,G,B); |
395 |
if (!feof(in)) |
396 |
{ |
397 |
fgets(mess,255,in); |
398 |
nb=sscanf(mess,"%d %d %d",&R,&G,&B); |
399 |
if (nb==3) cflux=color(R,G,B); |
400 |
|
401 |
} |
402 |
} |
403 |
|
404 |
} |
405 |
|
406 |
} |
407 |
} |
408 |
} |
409 |
} |
410 |
} |
411 |
fclose(in); |
412 |
} |
413 |
printf("******************************\n"); |
414 |
printf("* Visualization *\n"); |
415 |
printf("* by *\n"); |
416 |
printf("* Jean-Christophe Cuillière *\n"); |
417 |
printf("* and *\n"); |
418 |
printf("* Vincent Francois *\n"); |
419 |
printf("* ERICCA-UQTR *\n"); |
420 |
printf("******************************\n\n\n"); |
421 |
|
422 |
|
423 |
|
424 |
if (!((argc==2) || (argc==3))) |
425 |
{ |
426 |
printf("Visumagic syntax error - Bad number arguments\n visumagic.exe fichier [numero du maillage]\n\n"); |
427 |
return 0; |
428 |
|
429 |
} |
430 |
char fichier[255]; |
431 |
strcpy(fichier,argv[1]); |
432 |
|
433 |
char *p=strchr(fichier,'.'); |
434 |
char extension[255]; |
435 |
strcpy(extension,p+1); |
436 |
|
437 |
bool idori; |
438 |
MG_GESTIONNAIRE *gest; |
439 |
if ((strcmp(extension,"step")==0) || (strcmp(extension,"stp")==0) || (strcmp(extension,"STP")==0) || (strcmp(extension,"STEP")==0)) |
440 |
{ |
441 |
MG_GESTIONNAIRE *gest2=new MG_GESTIONNAIRE; |
442 |
OCC_IMPORT occimport; |
443 |
MG_GEOMETRIE* mggeo=occimport.importer(*gest2,fichier,FICHIERSTEP,1e-6) ; |
444 |
occimport.importer(*gest2,mggeo,1,2); |
445 |
gest=gest2; |
446 |
idori=false; |
447 |
if (strcmp(argv[argc-1],"-s")==0) |
448 |
{ |
449 |
*(p+1)='m'; |
450 |
*(p+2)='a'; |
451 |
*(p+3)='g'; |
452 |
*(p+4)='i'; |
453 |
*(p+5)='c'; |
454 |
*(p+6)=0; |
455 |
gest->enregistrer(fichier); |
456 |
} |
457 |
} |
458 |
else |
459 |
{ |
460 |
MG_FILE* gest2=new MG_FILE(fichier); |
461 |
gest=gest2; |
462 |
idori=false; |
463 |
} |
464 |
|
465 |
|
466 |
int num=0; |
467 |
if (argc==3) num=atoi(argv[2]); |
468 |
MG_GEOMETRIE* geo=gest->get_mg_geometrie(num); |
469 |
data_container data; |
470 |
MG_MAILLAGE* mai=NULL; |
471 |
int nbmai=gest->get_nb_mg_maillage(); |
472 |
bool sommet=false,arete=false,face=false; |
473 |
for (int i=0;i<nbmai;i++) |
474 |
{ |
475 |
bool sommettmp=false,aretetmp=false,facetmp=false; |
476 |
MG_MAILLAGE* maitmp=gest->get_mg_maillage(i); |
477 |
if (maitmp->get_nb_mg_noeud()>0) sommettmp=true; |
478 |
if (maitmp->get_nb_mg_segment()>0) aretetmp=true; |
479 |
if (maitmp->get_nb_mg_triangle()>0) facetmp=true; |
480 |
int nbtruetmp=0,nbtrue=0; |
481 |
if (sommet==true) nbtrue++; |
482 |
if (arete==true) nbtrue++; |
483 |
if (face==true) nbtrue++; |
484 |
if (sommettmp==true) nbtruetmp++; |
485 |
if (aretetmp==true) nbtruetmp++; |
486 |
if (facetmp==true) nbtruetmp++; |
487 |
if (nbtruetmp>nbtrue) |
488 |
{ |
489 |
mai=maitmp; |
490 |
sommet=sommettmp; |
491 |
arete=aretetmp; |
492 |
face=facetmp; |
493 |
} |
494 |
} |
495 |
printf("\n\n"); |
496 |
printf("Command on keyboard : \n"); |
497 |
printf(" e : End of vizualisation\n"); |
498 |
printf(" r : Reset Camera\n"); |
499 |
printf(" 1 : Vertex Numbers visible on/off\n"); |
500 |
printf(" 4 : Edge Numbers visible on/off\n"); |
501 |
printf(" 7 : Face Numbers visible on/off\n"); |
502 |
printf(" v : Vertices visible on/off\n"); |
503 |
printf(" l : Edges visible on/off\n"); |
504 |
printf(" t : Faces visible on/off\n"); |
505 |
printf(" j : Save camera on current directory\n"); |
506 |
printf(" k : Load camera from current directory\n"); |
507 |
printf(" w : Wireframe\n"); |
508 |
printf(" s : Modelframe\n"); |
509 |
printf(" - : Decrease text size\n"); |
510 |
printf(" + : Increase text size\n"); |
511 |
printf(" 5 : Clipping plane off\n"); |
512 |
printf(" 8 : Clipping plane forward\n"); |
513 |
printf(" 9 : Clipping plane backward\n"); |
514 |
|
515 |
char titre [500]; |
516 |
strcpy(titre,"Visumagic "); |
517 |
strcat(titre,fichier); |
518 |
if (mai!=NULL) affiche_structure(cface,carete,ctext,cdeplacement,cforce,cpression,ctemperature,cflux,geo,mai,data,idori); |
519 |
delete gest; |
520 |
|
521 |
vtkdisplay d(base,titre); |
522 |
|
523 |
|
524 |
|
525 |
|
526 |
d.init_data(data); |
527 |
d.display(); |
528 |
|
529 |
|
530 |
return 0; |
531 |
} |
532 |
|
533 |
|
534 |
|
535 |
|