ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/app/VMM/VMM/win32/visuwin.cpp
Revision: 175
Committed: Thu Apr 23 19:38:52 2009 UTC (16 years, 4 months ago) by francois
File size: 258789 byte(s)
Log Message:
Verification de compatibilité borland + visu avec separation possible de l'origine des mailles + visu des solutions sur les elements + nouvelles origine pour tenir compte des resultats d'optimisation

File Contents

# Content
1 //------------------------------------------------------------
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 // visuwin.cpp
16 //
17 //------------------------------------------------------------
18 //------------------------------------------------------------
19 // COPYRIGHT 2000
20 // Version du 02/03/2006 à 11H26
21 //------------------------------------------------------------
22 //------------------------------------------------------------
23
24
25 #include "gestionversion.h"
26
27 #include <vcl.h>
28 #include <io.h>
29 #pragma hdrstop
30 #include "magicform.h"
31 #include "main.h"
32 #include "visuwin.h"
33 #include "veriwin.h"
34 #include "visuctt.h"
35 #include "visuarbre.h"
36 #include "config.h"
37 #include "ccfwin.h"
38 #include "carte3dform.h"
39 #include "matwin.h"
40 #include "importcosmos.h"
41 #include "importcarte.h"
42 #include "tpl_grille.h"
43 #include "ot_boite_3d.h"
44 #include "visuparametrique.h"
45 #include "solveur.h"
46 #include "recons.h"
47 #include "mg_export.h"
48 #include "vct.h"
49 #include "affmatrice.h"
50
51 //---------------------------------------------------------------------------
52 #pragma package(smart_init)
53 #pragma resource "*.dfm"
54 TVisuWinform *VisuWinform;
55 //---------------------------------------------------------------------------
56 __fastcall TVisuWinform::TVisuWinform(TComponent* Owner)
57 : TForm(Owner),zoom(0),dx(0.0),dy(0.0),debut_trans(false),shrink(0),facteur_shrink(0.8),qualite(0),render(0),axe(0),noeud(0),affnoeud(0),affmaille(0),maille(7),debut_rot(0)
58 {
59 }
60 //---------------------------------------------------------------------------
61 void __fastcall TVisuWinform::FormClose(TObject *Sender,
62 TCloseAction &Action)
63 {
64 MainForm->ToolBar1->Visible=false;
65 MainForm->ToolBar3->Visible=false;
66 lst_visu.clear();
67 if (gest!=NULL) delete gest;
68 MainForm->StatusBar->Panels->Items[3]->Text="";
69 MainForm->StatusBar->Panels->Items[4]->Text="";
70 Action=caFree;
71 }
72 //---------------------------------------------------------------------------
73
74 void __fastcall TVisuWinform::FormActivate(TObject *Sender)
75 {
76 MainForm->ToolBar1->Visible=true;
77 MainForm->ToolBar3->Visible=true;
78 MainForm->activewinform=this;
79 MainForm->ToolButton6->ImageIndex=iconeactive;
80 FILE* in=fopen(Caption.c_str(),"rt");
81 if (in!=NULL)
82 {
83 std::ftime ft;
84 getftime(fileno(in), &ft);
85 char mess[1000];
86 sprintf(mess,"Heure fichier: %02u:%02u:%02u\n",ft.ft_hour, ft.ft_min,ft.ft_tsec * 2);
87 MainForm->StatusBar->Panels->Items[3]->Text=mess;
88 sprintf(mess,"Jour fichier: %02u/%02u/%02u\n",ft.ft_day, ft.ft_month,ft.ft_year+1980);
89 MainForm->StatusBar->Panels->Items[4]->Text=mess;
90 fclose(in);
91 }
92 }
93 //---------------------------------------------------------------------------
94
95 void __fastcall TVisuWinform::FormDeactivate(TObject *Sender)
96 {
97 MainForm->ToolBar1->Visible=false;
98 MainForm->ToolBar3->Visible=false;
99 MainForm->activewinform=NULL;
100 iconeactive=MainForm->ToolButton6->ImageIndex;
101 MainForm->StatusBar->Panels->Items[3]->Text="";
102 MainForm->StatusBar->Panels->Items[4]->Text="";
103 }
104 //---------------------------------------------------------------------------
105
106
107 void __fastcall TVisuWinform::lancermagicExecute(TObject *Sender)
108 {
109 TVisuMagicform *Child;
110 Child = new TVisuMagicform(Application,MainForm,gest);
111 Child->Caption=Caption;
112 FILE* in=fopen(Caption.c_str(),"rt");
113 if (in!=NULL)
114 {
115 std::ftime ft;
116 getftime(fileno(in), &ft);
117 char mess[1000];
118 sprintf(mess,"Heure fichier: %02u:%02u:%02u\n",ft.ft_hour, ft.ft_min,ft.ft_tsec * 2);
119 MainForm->StatusBar->Panels->Items[3]->Text=mess;
120 sprintf(mess,"Jour fichier: %02u/%02u/%02u\n",ft.ft_day, ft.ft_month,ft.ft_year+1980);
121 MainForm->StatusBar->Panels->Items[4]->Text=mess;
122 fclose(in);
123 }
124 }
125 //---------------------------------------------------------------------------
126
127
128 void __fastcall TVisuWinform::miseajourarbre(void)
129 {
130 int nb_geometrie=gest->get_nb_mg_geometrie();
131 int nb_maillage=gest->get_nb_mg_maillage();
132 int nb_fem_maillage=gest->get_nb_fem_maillage();
133 TreeView1->Items->Clear();
134 TreeView1->Items->Add(NULL,"Modèle MAGiC");
135 TTreeNode *root = TreeView1->Items->Item[0];
136 root->ImageIndex=7;
137 root->SelectedIndex=7;
138 root->StateIndex=7;
139 TTreeNode *rootg= TreeView1->Items->AddChild(root,"Géométrie");
140 rootg->ImageIndex=7;
141 rootg->SelectedIndex=7;
142 rootg->StateIndex=7;
143 for (int i=0;i<nb_geometrie;i++)
144 {
145 MG_GEOMETRIE* mggeo=gest->get_mg_geometrie(i);
146 char mess[100];
147 sprintf(mess,"%lu",mggeo->get_id());
148 TTreeNode* georoot=TreeView1->Items->AddChild(rootg,mess);
149 georoot->ImageIndex=7;
150 georoot->SelectedIndex=7;
151 georoot->StateIndex=7;
152 TTreeNode* nodvol=TreeView1->Items->AddChild(georoot,"Volume");
153 nodvol->ImageIndex=7;
154 nodvol->SelectedIndex=7;
155 nodvol->StateIndex=7;
156 int nbvol=mggeo->get_nb_mg_volume();
157 for (int j=0;j<nbvol;j++)
158 {
159 MG_VOLUME* mgvol=mggeo->get_mg_volume(j);
160 char mess[100];
161 sprintf(mess,"%lu",mgvol->get_id());
162 TTreeNode* node=TreeView1->Items->AddChild(nodvol,mess);
163 node->ImageIndex=-1;
164 node->SelectedIndex=-1;
165 node->StateIndex=-1;
166 }
167 TTreeNode* nodfac=TreeView1->Items->AddChild(georoot,"Face");
168 nodfac->ImageIndex=7;
169 nodfac->SelectedIndex=7;
170 nodfac->StateIndex=7;
171 int nbface=mggeo->get_nb_mg_face();
172 for (int j=0;j<nbface;j++)
173 {
174 MG_FACE* mgface=mggeo->get_mg_face(j);
175 char mess[100];
176 sprintf(mess,"%lu",mgface->get_id());
177 TTreeNode* node=TreeView1->Items->AddChild(nodfac,mess);
178 node->ImageIndex=-1;
179 node->SelectedIndex=-1;
180 node->StateIndex=-1;
181 }
182 TTreeNode* nodare=TreeView1->Items->AddChild(georoot,"Arête");
183 nodare->ImageIndex=7;
184 nodare->SelectedIndex=7;
185 nodare->StateIndex=7;
186 int nbare=mggeo->get_nb_mg_arete();
187 for (int j=0;j<nbare;j++)
188 {
189 MG_ARETE* mgare=mggeo->get_mg_arete(j);
190 char mess[100];
191 sprintf(mess,"%lu",mgare->get_id());
192 TTreeNode* node=TreeView1->Items->AddChild(nodare,mess);
193 node->ImageIndex=-1;
194 node->SelectedIndex=-1;
195 node->StateIndex=-1;
196 }
197 TTreeNode* nodsom=TreeView1->Items->AddChild(georoot,"Sommet");
198 nodsom->ImageIndex=7;
199 nodsom->SelectedIndex=7;
200 nodsom->StateIndex=7;
201 int nbsommet=mggeo->get_nb_mg_sommet();
202 for (int j=0;j<nbsommet;j++)
203 {
204 MG_SOMMET* mgsom=mggeo->get_mg_sommet(j);
205 char mess[100];
206 sprintf(mess,"%lu",mgsom->get_id());
207 TTreeNode* node=TreeView1->Items->AddChild(nodsom,mess);
208 node->ImageIndex=-1;
209 node->SelectedIndex=-1;
210 node->StateIndex=-1;
211 }
212 }
213 TTreeNode *rootm= TreeView1->Items->AddChild(root,"Maillage géométrique");
214 rootm->ImageIndex=7;
215 rootm->SelectedIndex=7;
216 rootm->StateIndex=7;
217 for (int i=0;i<nb_maillage;i++)
218 {
219 MG_MAILLAGE* mgmai=gest->get_mg_maillage(i);
220 char mess[100];
221 sprintf(mess,"%lu",mgmai->get_id());
222 TTreeNode* mairoot=TreeView1->Items->AddChild(rootm,mess);
223 mairoot->ImageIndex=7;
224 mairoot->SelectedIndex=7;
225 mairoot->StateIndex=7;
226 TTreeNode* node=TreeView1->Items->AddChild(mairoot,"Maillage 1D");
227 node->ImageIndex=-1;
228 node->SelectedIndex=-1;
229 node->StateIndex=-1;
230 node=TreeView1->Items->AddChild(mairoot,"Maillage 2D");
231 node->ImageIndex=-1;
232 node->SelectedIndex=-1;
233 node->StateIndex=-1;
234 node=TreeView1->Items->AddChild(mairoot,"Maillage 3D");
235 node->ImageIndex=-1;
236 node->SelectedIndex=-1;
237 node->StateIndex=-1;
238 }
239 TTreeNode *rootmfem=TreeView1->Items->AddChild(root,"Maillage FEM");
240 rootmfem->ImageIndex=7;
241 rootmfem->SelectedIndex=7;
242 rootmfem->StateIndex=7;
243 for (int i=0;i<nb_fem_maillage;i++)
244 {
245 FEM_MAILLAGE* femmai=gest->get_fem_maillage(i);
246 char mess[100];
247 sprintf(mess,"%lu",femmai->get_id());
248 TTreeNode* mairoot=TreeView1->Items->AddChild(rootmfem,mess);
249 mairoot->ImageIndex=7;
250 mairoot->SelectedIndex=7;
251 mairoot->StateIndex=7;
252 TTreeNode* node=TreeView1->Items->AddChild(mairoot,"Maillage 1D");
253 node->ImageIndex=-1;
254 node->SelectedIndex=-1;
255 node->StateIndex=-1;
256 node=TreeView1->Items->AddChild(mairoot,"Maillage 2D");
257 node->ImageIndex=-1;
258 node->SelectedIndex=-1;
259 node->StateIndex=-1;
260 node=TreeView1->Items->AddChild(mairoot,"Maillage 3D");
261 node->ImageIndex=-1;
262 node->SelectedIndex=-1;
263 node->StateIndex=-1;
264 }
265 changeimage(rootg,46);
266 initliste();
267 ComboBox1->Clear();
268 int nb=gest->get_nb_mg_solution();
269 for (int i=0;i<nb;i++)
270 {
271 MG_SOLUTION* sol=gest->get_mg_solution(i);
272 ComboBox1->Items->Add(sol->get_nom().c_str());
273 }
274 nb=gest->get_nb_fem_solution();
275 for (int i=0;i<nb;i++)
276 {
277 FEM_SOLUTION* sol=gest->get_fem_solution(i);
278 ComboBox1->Items->Add(sol->get_nom().c_str());
279 }
280 }
281
282 void __fastcall TVisuWinform::initliste(void)
283 {
284 lst_face.vide();
285 lst_arete.vide();
286 lst_sommet.vide();
287 lst_volume.vide();
288 lst_m1d.vide();
289 lst_m2d.vide();
290 lst_m3d.vide();
291 lst_segment.clear();
292 lst_triangle.clear();
293 lst_tetra.clear();
294 lst_noeud.clear();
295 lst_m1d_fem.vide();
296 lst_m2d_fem.vide();
297 lst_m3d_fem.vide();
298 lst_segment_fem.clear();
299 lst_triangle_fem.clear();
300 lst_tetra_fem.clear();
301 lst_noeud_fem.clear();
302 TTreeNode *root = TreeView1->Items->Item[0];
303 TTreeNode *rootg = root->Item[0];
304 int nb_geo=rootg->Count;
305 if (nb_geo>0)
306 {
307 for (int i=0;i<nb_geo;i++)
308 {
309 TTreeNode *geo = rootg->Item[i];
310 MG_GEOMETRIE* mggeo=gest->get_mg_geometrieid(atol(geo->Text.c_str()));
311 TTreeNode *geovol = geo->Item[0];
312 int nb=geovol->Count;
313 for (int j=0;j<nb;j++)
314 {
315 TTreeNode *node=geovol->Item[j];
316 if (node->ImageIndex==46)
317 {
318 MG_VOLUME* mgvol=mggeo->get_mg_volumeid(atol(node->Text.c_str()));
319 lst_volume.ajouter(mgvol);
320 }
321 }
322 TTreeNode *geoface = geo->Item[1];
323 nb=geoface->Count;
324 for (int j=0;j<nb;j++)
325 {
326 TTreeNode *node=geoface->Item[j];
327 if (node->ImageIndex==46)
328 {
329 MG_FACE* mgfac=mggeo->get_mg_faceid(atol(node->Text.c_str()));
330 lst_face.ajouter(mgfac);
331 }
332 }
333 TTreeNode *geoarete = geo->Item[2];
334 nb=geoarete->Count;
335 for (int j=0;j<nb;j++)
336 {
337 TTreeNode *node=geoarete->Item[j];
338 if (node->ImageIndex==46)
339 {
340 MG_ARETE* mgarete=mggeo->get_mg_areteid(atol(node->Text.c_str()));
341 lst_arete.ajouter(mgarete);
342 }
343 }
344 TTreeNode *geosommet = geo->Item[3];
345 nb=geosommet->Count;
346 for (int j=0;j<nb;j++)
347 {
348 TTreeNode *node=geosommet->Item[j];
349 if (node->ImageIndex==46)
350 {
351 MG_SOMMET* mgsommet=mggeo->get_mg_sommetid(atol(node->Text.c_str()));
352 lst_sommet.ajouter(mgsommet);
353 }
354 }
355
356 }
357
358 TTreeNode *rootm = root->Item[1];
359 int nb_mai=rootm->Count;
360 for (int i=0;i<nb_mai;i++)
361 {
362 TTreeNode *mai = rootm->Item[i];
363 MG_MAILLAGE* mgmai=gest->get_mg_maillageid(atol(mai->Text.c_str()));
364 if ((ListBox1->ItemIndex!=-1) && (CheckBox1->Checked==true) )
365 {
366 MG_SOLUTION* sol=gest->get_mg_solution(ComboBox1->ItemIndex);
367 if (sol==NULL) continue;
368 unsigned long idmai=sol->get_maillage()->get_id();
369 if (mgmai->get_id()!=idmai) continue;
370 }
371 TTreeNode *mai1d = mai->Item[0];
372 if (mai1d->ImageIndex==46) lst_m1d.ajouter(mgmai);
373 TTreeNode *mai2d = mai->Item[1];
374 if (mai2d->ImageIndex==46) lst_m2d.ajouter(mgmai);
375 TTreeNode *mai3d = mai->Item[2];
376 if (mai3d->ImageIndex==46) lst_m3d.ajouter(mgmai);
377 }
378
379 TTreeNode *rootmfem = root->Item[2];
380 int nb_mai_fem=rootmfem->Count;
381 for (int i=0;i<nb_mai_fem;i++)
382 {
383 TTreeNode *mai = rootmfem->Item[i];
384 FEM_MAILLAGE* femmai=gest->get_fem_maillageid(atol(mai->Text.c_str()));
385 if ((ListBox1->ItemIndex!=-1) && (CheckBox1->Checked==true) )
386 {
387 FEM_SOLUTION* sol=gest->get_fem_solution(ComboBox1->ItemIndex-gest->get_nb_mg_solution());
388 if (sol==NULL) continue;
389 unsigned long idmai=sol->get_maillage()->get_id();
390 if (femmai->get_id()!=idmai) continue;
391 }
392 TTreeNode *mai1d = mai->Item[0];
393 if (mai1d->ImageIndex==46) lst_m1d_fem.ajouter(femmai);
394 TTreeNode *mai2d = mai->Item[1];
395 if (mai2d->ImageIndex==46) lst_m2d_fem.ajouter(femmai);
396 TTreeNode *mai3d = mai->Item[2];
397 if (mai3d->ImageIndex==46) lst_m3d_fem.ajouter(femmai);
398 }
399
400 for (int i=0;i<lst_volume.get_nb();i++)
401 {
402 MG_VOLUME* mgvol=lst_volume.get(i);
403 int nb_m3d=lst_m3d.get_nb();
404 TPL_SET<MG_ELEMENT_MAILLAGE*>::ITERATEUR it_tet;
405 for (MG_TETRA* mgtet=(MG_TETRA*)mgvol->get_lien_maillage()->get_premier(it_tet);mgtet;mgtet=(MG_TETRA*)mgvol->get_lien_maillage()->get_suivant(it_tet))
406 {
407 if (CheckListBox1->Checked[(mgtet->get_origine()-1000)/10]==false) continue;
408 if ((CheckListBox1->Checked[(mgtet->get_origine()-1000)/10]==true) && ((CheckListBox1->Checked[(mgtet->get_origine()-1000)/10+24])==false)) continue;
409 int ok=0;
410 for (int k=0;k<nb_m3d;k++)
411 {
412 MG_MAILLAGE* mgmai=lst_m3d.get(k);
413 MG_TETRA* tetemp=mgmai->get_mg_tetraid(mgtet->get_id());
414 if (tetemp!=NULL) ok=1;
415 }
416 if (ok==1)
417 {
418 lst_tetra.insert(lst_tetra.end(),mgtet);
419 MG_NOEUD* noeud1=mgtet->get_noeud1();
420 MG_NOEUD* noeud2=mgtet->get_noeud2();
421 MG_NOEUD* noeud3=mgtet->get_noeud3();
422 MG_NOEUD* noeud4=mgtet->get_noeud4();
423 lst_noeud.insert(lst_noeud.end(),noeud1);
424 lst_noeud.insert(lst_noeud.end(),noeud2);
425 lst_noeud.insert(lst_noeud.end(),noeud3);
426 lst_noeud.insert(lst_noeud.end(),noeud4);
427 }
428 }
429 int nb_tet_fem=mgvol->get_lien_fem_maillage()->get_nb();
430 int nb_m3d_fem=lst_m3d_fem.get_nb();
431 for (int j=0;j<nb_tet_fem;j++)
432 {
433 FEM_TETRA* femtet=(FEM_TETRA*)mgvol->get_lien_fem_maillage()->get(j);
434 if (CheckListBox1->Checked[(femtet->get_mg_element_maillage()->get_origine()-1000)/10]==false) continue;
435 int ok=0;
436 for (int k=0;k<nb_m3d_fem;k++)
437 {
438 FEM_MAILLAGE* femmai=lst_m3d_fem.get(k);
439 FEM_TETRA* tetemp=femmai->get_fem_tetraid(femtet->get_id());
440 if (tetemp!=NULL) ok=1;
441 }
442 if (ok==1)
443 {
444 lst_tetra_fem.insert(lst_tetra_fem.end(),femtet);
445 int nb_noeud=femtet->get_nb_fem_noeud();
446 for (int k=0;k<nb_noeud;k++)
447 {
448 FEM_NOEUD* noeud=femtet->get_fem_noeud(k);
449 lst_noeud_fem.insert(lst_noeud_fem.end(),noeud);
450 }
451 }
452 }
453 }
454 for (int i=0;i<lst_face.get_nb();i++)
455 {
456 MG_FACE* mgface=lst_face.get(i);
457 int nb_m2d=lst_m2d.get_nb();
458 TPL_SET<MG_ELEMENT_MAILLAGE*>::ITERATEUR it_tri;
459 for (MG_TRIANGLE* mgtri=(MG_TRIANGLE*)mgface->get_lien_maillage()->get_premier(it_tri);mgtri;mgtri=(MG_TRIANGLE*)mgface->get_lien_maillage()->get_suivant(it_tri))
460 {
461 if (CheckListBox1->Checked[(mgtri->get_origine()-1000)/10]==false) continue;
462 if ((CheckListBox1->Checked[(mgtri->get_origine()-1000)/10]==true) && ((CheckListBox1->Checked[(mgtri->get_origine()-1000)/10+24])==false)) continue;
463 int ok=0;
464 for (int k=0;k<nb_m2d;k++)
465 {
466 MG_MAILLAGE* mgmai=lst_m2d.get(k);
467 MG_TRIANGLE* tritemp=mgmai->get_mg_triangleid(mgtri->get_id());
468 if (tritemp!=NULL) ok=1;
469 }
470 if (ok==1)
471 {
472 lst_triangle.insert(lst_triangle.end(),mgtri);
473 MG_NOEUD* noeud1=mgtri->get_noeud1();
474 MG_NOEUD* noeud2=mgtri->get_noeud2();
475 MG_NOEUD* noeud3=mgtri->get_noeud3();
476 lst_noeud.insert(lst_noeud.end(),noeud1);
477 lst_noeud.insert(lst_noeud.end(),noeud2);
478 lst_noeud.insert(lst_noeud.end(),noeud3);
479 }
480 }
481 int nb_tri_fem=mgface->get_lien_fem_maillage()->get_nb();
482 int nb_m2d_fem=lst_m2d_fem.get_nb();
483 for (int j=0;j<nb_tri_fem;j++)
484 {
485 FEM_TRIANGLE* femtri=(FEM_TRIANGLE*)mgface->get_lien_fem_maillage()->get(j);
486 if (CheckListBox1->Checked[(femtri->get_mg_element_maillage()->get_origine()-1000)/10]==false) continue;
487 int ok=0;
488 for (int k=0;k<nb_m2d_fem;k++)
489 {
490 FEM_MAILLAGE* femmai=lst_m2d_fem.get(k);
491 FEM_TRIANGLE* tritemp=femmai->get_fem_triangleid(femtri->get_id());
492 if (tritemp!=NULL) ok=1;
493 }
494 if (ok==1)
495 {
496 lst_triangle_fem.insert(lst_triangle_fem.end(),femtri);
497 int nb_noeud=femtri->get_nb_fem_noeud();
498 for (int k=0;k<nb_noeud;k++)
499 {
500 FEM_NOEUD* noeud=femtri->get_fem_noeud(k);
501 lst_noeud_fem.insert(lst_noeud_fem.end(),noeud);
502 }
503 }
504 }
505 }
506 for (int i=0;i<lst_arete.get_nb();i++)
507 {
508 MG_ARETE* mgarete=lst_arete.get(i);
509 int nb_m1d=lst_m1d.get_nb();
510 TPL_SET<MG_ELEMENT_MAILLAGE*>::ITERATEUR it_are;
511 for (MG_SEGMENT* mgsegment=(MG_SEGMENT*)mgarete->get_lien_maillage()->get_premier(it_are);mgsegment;mgsegment=(MG_SEGMENT*)mgarete->get_lien_maillage()->get_suivant(it_are))
512 {
513 if (CheckListBox1->Checked[(mgsegment->get_origine()-1000)/10]==false) continue;
514 if ((CheckListBox1->Checked[(mgsegment->get_origine()-1000)/10]==true) && ((CheckListBox1->Checked[(mgsegment->get_origine()-1000)/10+12])==false)) continue;
515 int ok=0;
516 for (int k=0;k<nb_m1d;k++)
517 {
518 MG_MAILLAGE* mgmai=lst_m1d.get(k);
519 MG_SEGMENT* segtemp=mgmai->get_mg_segmentid(mgsegment->get_id());
520 if (segtemp!=NULL) ok=1;
521 }
522 if (ok==1)
523 {
524 lst_segment.insert(lst_segment.end(),mgsegment);
525 MG_NOEUD* noeud1=mgsegment->get_noeud1();
526 MG_NOEUD* noeud2=mgsegment->get_noeud2();
527 lst_noeud.insert(lst_noeud.end(),noeud1);
528 lst_noeud.insert(lst_noeud.end(),noeud2);
529 }
530 }
531 int nb_seg_fem=mgarete->get_lien_fem_maillage()->get_nb();
532 int nb_m1d_fem=lst_m1d_fem.get_nb();
533 for (int j=0;j<nb_seg_fem;j++)
534 {
535 FEM_SEGMENT* femseg=(FEM_SEGMENT*)mgarete->get_lien_fem_maillage()->get(j);
536 if (CheckListBox1->Checked[(femseg->get_mg_element_maillage()->get_origine()-1000)/10]==false) continue;
537 int ok=0;
538 for (int k=0;k<nb_m1d_fem;k++)
539 {
540 FEM_MAILLAGE* femmai=lst_m1d_fem.get(k);
541 FEM_SEGMENT* segtemp=femmai->get_fem_segmentid(femseg->get_id());
542 if (segtemp!=NULL) ok=1;
543 }
544 if (ok==1)
545 {
546 lst_segment_fem.insert(lst_segment_fem.end(),femseg);
547 int nb_noeud=femseg->get_nb_fem_noeud();
548 for (int k=0;k<nb_noeud;k++)
549 {
550 FEM_NOEUD* noeud=femseg->get_fem_noeud(k);
551 lst_noeud_fem.insert(lst_noeud_fem.end(),noeud);
552 }
553 }
554 }
555 }
556 }
557 else
558 {
559 TTreeNode *rootm = root->Item[1];
560 int nb_mai=rootm->Count;
561 for (int i=0;i<nb_mai;i++)
562 {
563 TTreeNode *mai = rootm->Item[i];
564 MG_MAILLAGE* mgmai=gest->get_mg_maillageid(atol(mai->Text.c_str()));
565 if ((ListBox1->ItemIndex!=-1) && (CheckBox1->Checked==true) )
566 {
567 MG_SOLUTION* sol=gest->get_mg_solution(ComboBox1->ItemIndex);
568 if (sol==NULL) continue;
569 unsigned long idmai=sol->get_maillage()->get_id();
570 if (mgmai->get_id()!=idmai) continue;
571 }
572 TTreeNode *mai1d = mai->Item[0];
573 if (mai1d->ImageIndex==46)
574 {
575 int nbseg=mgmai->get_nb_mg_segment();
576 for (int k=0;k<nbseg;k++)
577 {
578 MG_SEGMENT* seg=mgmai->get_mg_segment(k);
579 if (CheckListBox1->Checked[(seg->get_origine()-1000)/10]==false) continue;
580 if ((CheckListBox1->Checked[(seg->get_origine()-1000)/10]==true) && ((CheckListBox1->Checked[(seg->get_origine()-1000)/10+12])==false)) continue;
581 MG_NOEUD* noeud1=seg->get_noeud1();
582 MG_NOEUD* noeud2=seg->get_noeud2();
583 lst_noeud.insert(lst_noeud.end(),noeud1);
584 lst_noeud.insert(lst_noeud.end(),noeud2);
585 lst_segment.insert(lst_segment.end(),seg);
586 }
587 }
588 TTreeNode *mai2d = mai->Item[1];
589 if (mai2d->ImageIndex==46)
590 {
591 int nbtri=mgmai->get_nb_mg_triangle();
592 for (int k=0;k<nbtri;k++)
593 {
594 MG_TRIANGLE* tri=mgmai->get_mg_triangle(k);
595 if (CheckListBox1->Checked[(tri->get_origine()-1000)/10]==false) continue;
596 if ((CheckListBox1->Checked[(tri->get_origine()-1000)/10]==true) && ((CheckListBox1->Checked[(tri->get_origine()-1000)/10+18])==false)) continue;
597 MG_NOEUD* noeud1=tri->get_noeud1();
598 MG_NOEUD* noeud2=tri->get_noeud2();
599 MG_NOEUD* noeud3=tri->get_noeud3();
600 lst_noeud.insert(lst_noeud.end(),noeud1);
601 lst_noeud.insert(lst_noeud.end(),noeud2);
602 lst_noeud.insert(lst_noeud.end(),noeud3);
603 lst_triangle.insert(lst_triangle.end(),tri);
604 }
605 }
606 TTreeNode *mai3d = mai->Item[2];
607 if (mai3d->ImageIndex==46)
608 {
609 int nbtet=mgmai->get_nb_mg_tetra();
610 for (int k=0;k<nbtet;k++)
611 {
612 MG_TETRA* tet=mgmai->get_mg_tetra(k);
613 if (CheckListBox1->Checked[(tet->get_origine()-1000)/10]==false) continue;
614 if ((CheckListBox1->Checked[(tet->get_origine()-1000)/10]==true) && ((CheckListBox1->Checked[(tet->get_origine()-1000)/10+24])==false)) continue;
615 MG_NOEUD* noeud1=tet->get_noeud1();
616 MG_NOEUD* noeud2=tet->get_noeud2();
617 MG_NOEUD* noeud3=tet->get_noeud3();
618 MG_NOEUD* noeud4=tet->get_noeud4();
619 lst_noeud.insert(lst_noeud.end(),noeud1);
620 lst_noeud.insert(lst_noeud.end(),noeud2);
621 lst_noeud.insert(lst_noeud.end(),noeud3);
622 lst_noeud.insert(lst_noeud.end(),noeud4);
623 lst_tetra.insert(lst_tetra.end(),tet);
624 }
625 }
626 }
627 TTreeNode *rootmfem = root->Item[2];
628 int nb_mai_fem=rootmfem->Count;
629 for (int i=0;i<nb_mai_fem;i++)
630 {
631 TTreeNode *mai = rootm->Item[i];
632 FEM_MAILLAGE* femmai=gest->get_fem_maillageid(atol(mai->Text.c_str()));
633 if ((ListBox1->ItemIndex!=-1) && (CheckBox1->Checked==true) )
634 {
635 FEM_SOLUTION* sol=gest->get_fem_solution(ComboBox1->ItemIndex-gest->get_nb_mg_solution());
636 if (sol==NULL) continue;
637 unsigned long idmai=sol->get_maillage()->get_id();
638 if (femmai->get_id()!=idmai) continue;
639 }
640 TTreeNode *mai1d = mai->Item[0];
641 if (mai1d->ImageIndex==46)
642 {
643 int nbseg=femmai->get_nb_fem_segment();
644 for (int k=0;k<nbseg;k++)
645 {
646 FEM_SEGMENT* seg=femmai->get_fem_segment(k);
647 if (CheckListBox1->Checked[(seg->get_mg_element_maillage()->get_origine()-1000)/10]==false) continue;
648 lst_segment_fem.insert(lst_segment_fem.end(),seg);
649 int nb_noeud=seg->get_nb_fem_noeud();
650 for (int l=0;l<nb_noeud;l++)
651 {
652 FEM_NOEUD* noeud=seg->get_fem_noeud(l);
653 lst_noeud_fem.insert(lst_noeud_fem.end(),noeud);
654 }
655 }
656 }
657 TTreeNode *mai2d = mai->Item[1];
658 if (mai2d->ImageIndex==46)
659 {
660 int nbtri=femmai->get_nb_fem_triangle();
661 for (int k=0;k<nbtri;k++)
662 {
663 FEM_TRIANGLE* tri=femmai->get_fem_triangle(k);
664 if (CheckListBox1->Checked[(tri->get_mg_element_maillage()->get_origine()-1000)/10]==false) continue;
665 lst_triangle_fem.insert(lst_triangle_fem.end(),tri);
666 int nb_noeud=tri->get_nb_fem_noeud();
667 for (int l=0;l<nb_noeud;l++)
668 {
669 FEM_NOEUD* noeud=tri->get_fem_noeud(l);
670 lst_noeud_fem.insert(lst_noeud_fem.end(),noeud);
671 }
672 }
673 }
674 TTreeNode *mai3d = mai->Item[2];
675 if (mai3d->ImageIndex==46)
676 {
677 int nbtet=femmai->get_nb_fem_tetra();
678 for (int k=0;k<nbtet;k++)
679 {
680 FEM_TETRA* tet=femmai->get_fem_tetra(k);
681 if (CheckListBox1->Checked[(tet->get_mg_element_maillage()->get_origine()-1000)/10]==false) continue;
682 lst_tetra_fem.insert(lst_tetra_fem.end(),tet);
683 int nb_noeud=tet->get_nb_fem_noeud();
684 for (int l=0;l<nb_noeud;l++)
685 {
686 FEM_NOEUD* noeud=tet->get_fem_noeud(l);
687 lst_noeud_fem.insert(lst_noeud_fem.end(),noeud);
688 }
689 }
690
691 }
692 }
693 }
694 }
695 //---------------------------------------------------------------------------
696
697 void __fastcall TVisuWinform::Slectionner1Click(TObject *Sender)
698 {
699 TTreeNode* node=TreeView1->Selected;
700 changeimage(node,46);
701 initliste();
702 redess();
703 TreeView1->Enabled=false;
704 TreeView1->Enabled=true;
705 }
706 //---------------------------------------------------------------------------
707
708
709 void __fastcall TVisuWinform::changeimage(TTreeNode* node,int num)
710 {
711 if (node==NULL) return;
712 if (node->Count==0)
713 {
714 node->ImageIndex=num;
715 node->SelectedIndex=num;
716 node->StateIndex=num;
717 }
718 else
719 {
720 int nb=node->Count;
721 for (int i=0;i<nb;i++)
722 changeimage(node->Item[i],num);
723 }
724 }
725 //---------------------------------------------------------------------------
726
727 void __fastcall TVisuWinform::Dselectionner1Click(TObject *Sender)
728 {
729 TTreeNode* node=TreeView1->Selected;
730 changeimage(node,-1);
731 initliste();
732 redess();
733 TreeView1->Enabled=false;
734 TreeView1->Enabled=true;
735 }
736 //---------------------------------------------------------------------------
737
738 void __fastcall TVisuWinform::InverserSelection1Click(TObject *Sender)
739 {
740 TTreeNode* node=TreeView1->Selected;
741 inverseimage(node,-1,46);
742 initliste();
743 redess();
744 TreeView1->Enabled=false;
745 TreeView1->Enabled=true;
746 }
747 //---------------------------------------------------------------------------
748 void __fastcall TVisuWinform::inverseimage(TTreeNode* node,int num1,int num2)
749 {
750 if (node==NULL) return;
751 if (node->Count==0)
752 {
753 int num;
754 if (node->ImageIndex==num1) num=num2; else num=num1;
755 node->ImageIndex=num;
756 node->SelectedIndex=num;
757 node->StateIndex=num;
758 }
759 else
760 {
761 int nb=node->Count;
762 for (int i=0;i<nb;i++)
763 inverseimage(node->Item[i],num1,num2);
764 }
765 }
766 //---------------------------------------------------------------------------
767
768 void __fastcall TVisuWinform::Etendre1Click(TObject *Sender)
769 {
770 TreeView1->FullExpand();
771 TreeView1->Enabled=false;
772 TreeView1->Enabled=true;
773 }
774 //---------------------------------------------------------------------------
775
776 void __fastcall TVisuWinform::Rduire1Click(TObject *Sender)
777 {
778 TreeView1->FullCollapse();
779 TreeView1->Enabled=false;
780 TreeView1->Enabled=true;
781 }
782 //---------------------------------------------------------------------------
783
784 void __fastcall TVisuWinform::miseajourmodeleExecute(TObject *Sender)
785 {
786 Screen->Cursor=crHourGlass;
787 Invalidate();
788 if (gest!=NULL) delete gest;
789 tabcouleur.clear();
790 tabnode.clear();
791 gest=new MG_FILE(Caption.c_str());
792 if (gest->get_code_de_lecture()==0)
793 {
794 MessageBox(Handle,"Erreur de lecture du fichier","Erreur", MB_OK);
795 delete gest;
796 gest=NULL;
797 Screen->Cursor=crDefault;
798 Invalidate();
799 Close();
800 return;
801 }
802 lst_visu.clear();
803 miseajourarbre();
804 Screen->Cursor=crDefault;
805 TreeView1->FullCollapse();
806 Invalidate();
807 ChangemodeExecute(Sender);
808 ChangemodeExecute(Sender);
809 TrackBar1->Min=0;
810 TrackBar1->Max=100;
811 TrackBar1->Position=0;
812 TrackBar2->Min=0;
813 TrackBar2->Max=100;
814 TrackBar2->Position=100;
815 TrackBar3->Min=0;
816 TrackBar3->Max=100;
817 TrackBar3->Position=0;
818 TrackBar4->Min=0;
819 TrackBar4->Max=100;
820 TrackBar4->Position=100;
821 TrackBar5->Min=0;
822 TrackBar5->Max=100;
823 TrackBar5->Position=0;
824 TrackBar6->Min=0;
825 TrackBar6->Max=100;
826 TrackBar6->Position=100;
827 FILE* in=fopen(Caption.c_str(),"rt");
828 if (in!=NULL)
829 {
830 std::ftime ft;
831 getftime(fileno(in), &ft);
832 char mess[1000];
833 sprintf(mess,"Heure fichier: %u:%u:%u\n",ft.ft_hour, ft.ft_min,ft.ft_tsec * 2);
834 MainForm->StatusBar->Panels->Items[3]->Text=mess;
835 sprintf(mess,"Jour fichier: %u/%u/%u\n",ft.ft_month, ft.ft_day,ft.ft_year+1980);
836 MainForm->StatusBar->Panels->Items[4]->Text=mess;
837 fclose(in);
838 }
839
840 }
841 //---------------------------------------------------------------------------
842
843 void __fastcall TVisuWinform::lancerverimeshExecute(TObject *Sender)
844 {
845 Tverimesh *Child;
846 Child = new Tverimesh(Application,*gest,boite,*this);
847 Child->Caption=Caption;
848 }
849 //---------------------------------------------------------------------------
850
851 void __fastcall TVisuWinform::FormCreate(TObject *Sender)
852 {
853 hdc = GetDC(Handle);
854 SetPixelFormatDescriptor();
855 hrc = wglCreateContext(hdc);
856 if (hrc == NULL)
857 ShowMessage(":-)~ hrc == NULL");
858 if(wglMakeCurrent(hdc, hrc) == false)
859 ShowMessage("Could not MakeCurrent");
860 wglMakeCurrent (hdc, hrc);
861 SelectObject (hdc, GetStockObject (SYSTEM_FONT));
862 wglUseFontBitmaps (hdc, 0, 255, 1000);
863 glClearColor(MainForm->valeurconfig[11],MainForm->valeurconfig[12],MainForm->valeurconfig[13], 0.0f);
864 ListBox1->Height=TabSheet2->ClientHeight-ListBox1->Top-Label2->Height-Button3->Height;
865 ListBox3->Height=TabSheet6->ClientHeight-ListBox3->Top-5*Button3->Height;
866 Button6->Top=ListBox3->Top+ListBox3->Height+Button6->Height;
867 Button7->Top=ListBox3->Top+ListBox3->Height+3*Button6->Height;
868 Button3->Top=ListBox1->Top+ListBox1->Height;
869 TabSheet3->TabVisible=false;
870 TabSheet6->TabVisible=false;
871 TabSheet7->TabVisible=false;
872 PageControl1->ActivePage=TabSheet1;
873 TrackBar1->Min=0;
874 TrackBar1->Max=100;
875 TrackBar1->Position=0;
876 TrackBar2->Min=0;
877 TrackBar2->Max=100;
878 TrackBar2->Position=100;
879 TrackBar3->Min=0;
880 TrackBar3->Max=100;
881 TrackBar3->Position=0;
882 TrackBar4->Min=0;
883 TrackBar4->Max=100;
884 TrackBar4->Position=100;
885 TrackBar5->Min=0;
886 TrackBar5->Max=100;
887 TrackBar5->Position=0;
888 TrackBar6->Min=0;
889 TrackBar6->Max=100;
890 TrackBar6->Position=100;
891 CheckListBox1->Checked[0]=true;
892 CheckListBox1->Checked[1]=true;
893 CheckListBox1->Checked[2]=true;
894 CheckListBox1->Checked[3]=true;
895 CheckListBox1->Checked[4]=true;
896 CheckListBox1->Checked[5]=true;
897 CheckListBox1->Checked[6]=true;
898 CheckListBox1->Checked[7]=true;
899 CheckListBox1->Checked[8]=true;
900 CheckListBox1->Checked[9]=true;
901 CheckListBox1->Checked[10]=true;
902 CheckListBox1->Checked[11]=true;
903 CheckListBox1->Checked[12]=true;
904 CheckListBox1->Checked[13]=true;
905 CheckListBox1->Checked[14]=true;
906 CheckListBox1->Checked[15]=true;
907 CheckListBox1->Checked[16]=true;
908 CheckListBox1->Checked[17]=true;
909 CheckListBox1->Checked[18]=true;
910 CheckListBox1->Checked[19]=true;
911 CheckListBox1->Checked[20]=true;
912 CheckListBox1->Checked[21]=true;
913 CheckListBox1->Checked[22]=true;
914 CheckListBox1->Checked[23]=true;
915 CheckListBox1->Checked[24]=true;
916 CheckListBox1->Checked[25]=true;
917 CheckListBox1->Checked[26]=true;
918 CheckListBox1->Checked[27]=true;
919 CheckListBox1->Checked[28]=true;
920 CheckListBox1->Checked[29]=true;
921 Width=950;
922 Height=710;
923 }
924 //---------------------------------------------------------------------------
925 void __fastcall TVisuWinform::SetPixelFormatDescriptor(void)
926 {
927 PIXELFORMATDESCRIPTOR pfd = {
928 sizeof(PIXELFORMATDESCRIPTOR),
929 1,
930 PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,
931 PFD_TYPE_RGBA,
932 24,
933 0,0,0,0,0,0,
934 0,0,
935 0,0,0,0,0,
936 32,
937 0,
938 0,
939 PFD_MAIN_PLANE,
940 0,
941 0,0,
942 };
943 int PixelFormat = ChoosePixelFormat(hdc, &pfd);
944 SetPixelFormat(hdc, PixelFormat, &pfd);
945 }
946 //---------------------------------------------------------------------------
947 void __fastcall TVisuWinform::FormPaint(TObject *Sender)
948 {
949 wglMakeCurrent(hdc,hrc);
950 glClearColor(MainForm->valeurconfig[11],MainForm->valeurconfig[12],MainForm->valeurconfig[13], 0.0f);
951 for (int i=0;i<14;i++)
952 {
953 RGB_r[i]=MainForm->valeurconfig[66+3*i]*255.;
954 RGB_g[i]=MainForm->valeurconfig[67+3*i]*255.;
955 RGB_b[i]=MainForm->valeurconfig[68+3*i]*255.;
956 }
957 redess();
958 TreeView1Click(Sender);
959 }
960 //---------------------------------------------------------------------------
961
962 void __fastcall TVisuWinform::FormResize(TObject *Sender)
963 {
964 int w=ClientWidth-PageControl1->Width;
965 int h=ClientHeight;
966 while(w==0)
967 {
968 Width++;
969 w=ClientWidth-PageControl1->Width;
970 }
971 while(h==0)
972 {
973 Height++;
974 h=ClientHeight;
975 }
976
977 recadre(dx,dy,0);
978 redess();
979 ListBox1->Height=TabSheet2->ClientHeight-ListBox1->Top-Label2->Height-Button3->Height;
980 Button3->Top=ListBox1->Top+ListBox1->Height;
981 ListBox3->Height=TabSheet6->ClientHeight-ListBox3->Top-5*Button3->Height;
982 Button6->Top=ListBox3->Top+ListBox3->Height+Button6->Height;
983 Button7->Top=ListBox3->Top+ListBox3->Height+3*Button6->Height;
984 }
985 //---------------------------------------------------------------------------
986
987 void __fastcall TVisuWinform::ChangemodeExecute(TObject *Sender)
988 {
989 int passe2=0;
990 double xmin,xmax;
991 double ymin,ymax;
992 double zmin,zmax;
993 int passe=lst_visu.size();
994 if (passe==0)
995 {
996 int nbgeo=gest->get_nb_mg_geometrie();
997 //if (nbgeo>0)
998 for (int i=0;i<nbgeo;i++)
999 {
1000 MG_GEOMETRIE* mggeo=gest->get_mg_geometrie(i);
1001 mggeo->cree_entite_visuel();
1002 long nb=mggeo->get_nb_mg_visu_courbe();
1003 for (long j=0;j<nb;j++)
1004 {
1005 double xyz1[3],xyz2[3];
1006 MG_VISU_COURBE* mgvcrb=mggeo->get_mg_visu_courbe(j);
1007 lst_visu.insert(lst_visu.end(),mgvcrb);
1008 mgvcrb->get_coord(xyz1,xyz2);
1009 if (passe2==0)
1010 {
1011 xmin=xyz1[0];
1012 xmax=xyz1[0];
1013 ymin=xyz1[1];
1014 ymax=xyz1[1];
1015 zmin=xyz1[2];
1016 zmax=xyz1[2];
1017 passe2=1;
1018 }
1019 if (xyz1[0]<xmin) xmin=xyz1[0];
1020 if (xyz1[0]>xmax) xmax=xyz1[0];
1021 if (xyz1[1]<ymin) ymin=xyz1[1];
1022 if (xyz1[1]>ymax) ymax=xyz1[1];
1023 if (xyz1[2]<zmin) zmin=xyz1[2];
1024 if (xyz1[2]>zmax) zmax=xyz1[2];
1025 }
1026 // boite.reinit(xmin,ymin,zmin,xmax,ymax,zmax);
1027 }
1028 //else
1029 for (unsigned long i=0;i<gest->get_nb_mg_maillage();i++)
1030 {
1031 MG_MAILLAGE* mai=gest->get_mg_maillage(i);
1032 LISTE_MG_NOEUD::iterator it;
1033 for (MG_NOEUD* noeud=mai->get_premier_noeud(it);noeud;noeud=mai->get_suivant_noeud(it))
1034 {
1035 double *xyz=noeud->get_coord();
1036 if (xyz[0]<xmin) xmin=xyz[0];
1037 if (xyz[0]>xmax) xmax=xyz[0];
1038 if (xyz[1]<ymin) ymin=xyz[1];
1039 if (xyz[1]>ymax) ymax=xyz[1];
1040 if (xyz[2]<zmin) zmin=xyz[2];
1041 if (xyz[2]>zmax) zmax=xyz[2];
1042 }
1043
1044 }
1045 for (unsigned long i=0;i<gest->get_nb_fem_maillage();i++)
1046 {
1047 FEM_MAILLAGE* mai=gest->get_fem_maillage(i);
1048 LISTE_FEM_NOEUD::iterator it;
1049 for (FEM_NOEUD* noeud=mai->get_premier_noeud(it);noeud;noeud=mai->get_suivant_noeud(it))
1050 {
1051 double *xyz=noeud->get_coord();
1052 if (xyz[0]<xmin) xmin=xyz[0];
1053 if (xyz[0]>xmax) xmax=xyz[0];
1054 if (xyz[1]<ymin) ymin=xyz[1];
1055 if (xyz[1]>ymax) ymax=xyz[1];
1056 if (xyz[2]<zmin) zmin=xyz[2];
1057 if (xyz[2]>zmax) zmax=xyz[2];
1058 }
1059
1060 }
1061 boite.reinit(xmin,ymin,zmin,xmax,ymax,zmax);
1062
1063 }
1064 if (TreeView1->Enabled==true)
1065 {
1066 TreeView1->Enabled=false;
1067 MainForm->ToolButton6->ImageIndex=48;
1068 }
1069 else
1070 {
1071 TreeView1->Enabled=true;
1072 MainForm->ToolButton6->ImageIndex=43;
1073 }
1074 recadre(dx,dy,0);
1075 if (passe==0) initvue();
1076 redess();
1077 }
1078 //---------------------------------------------------------------------------
1079 void __fastcall TVisuWinform::dessinegeo(void)
1080 {
1081 glLineWidth(MainForm->valeurconfig[29]);
1082
1083 glBegin(GL_LINES);
1084 glColor3f(MainForm->valeurconfig[26],MainForm->valeurconfig[27],MainForm->valeurconfig[28] );
1085 double x1=boite.get_xmin()+TrackBar1->Position*(boite.get_xmax()-boite.get_xmin())/100.;
1086 double y1=boite.get_ymin()+TrackBar3->Position*(boite.get_ymax()-boite.get_ymin())/100.;
1087 double z1=boite.get_zmin()+TrackBar5->Position*(boite.get_zmax()-boite.get_zmin())/100.;
1088 double x2=boite.get_xmin()+TrackBar2->Position*(boite.get_xmax()-boite.get_xmin())/100.;
1089 double y2=boite.get_ymin()+TrackBar4->Position*(boite.get_ymax()-boite.get_ymin())/100.;
1090 double z2=boite.get_zmin()+TrackBar6->Position*(boite.get_zmax()-boite.get_zmin())/100.;
1091 double dx=(x2-x1)*1.01;
1092 double dy=(y2-y1)*1.01;
1093 double dz=(z2-z1)*1.01;
1094 double xm=(x1+x2)/2.;
1095 x1=xm-dx/2.;x2=xm+dx/2.;
1096 double ym=(y1+y2)/2.;
1097 y1=ym-dy/2.;y2=ym+dy/2.;
1098 double zm=(z1+z2)/2.;
1099 z1=zm-dz/2.;z2=zm+dz/2.;
1100 BOITE_3D boite2(x1,y1,z1,x2,y2,z2);
1101 int nb=lst_visu.size();
1102 for (int i=0;i<nb;i++)
1103 {
1104 MG_VISU_COURBE* mgvcrb=lst_visu[i];
1105 double xyz1[3];
1106 double xyz2[3];
1107 mgvcrb->get_coord(xyz1,xyz2);
1108 BOITE_3D boitmp=mgvcrb->get_boite_3D();
1109 if (boite2*boitmp)
1110 {
1111 glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
1112 glVertex3f(xyz2[0],xyz2[1],xyz2[2]);
1113 }
1114 }
1115 glEnd();
1116 }
1117 //---------------------------------------------------------------------------
1118 void __fastcall TVisuWinform::dessinemai(void)
1119 {
1120 glLineWidth(1.);
1121 double x1=boite.get_xmin()+TrackBar1->Position*(boite.get_xmax()-boite.get_xmin())/100.;
1122 double y1=boite.get_ymin()+TrackBar3->Position*(boite.get_ymax()-boite.get_ymin())/100.;
1123 double z1=boite.get_zmin()+TrackBar5->Position*(boite.get_zmax()-boite.get_zmin())/100.;
1124 double x2=boite.get_xmin()+TrackBar2->Position*(boite.get_xmax()-boite.get_xmin())/100.;
1125 double y2=boite.get_ymin()+TrackBar4->Position*(boite.get_ymax()-boite.get_ymin())/100.;
1126 double z2=boite.get_zmin()+TrackBar6->Position*(boite.get_zmax()-boite.get_zmin())/100.;
1127 double dx=(x2-x1)*1.01;
1128 double dy=(y2-y1)*1.01;
1129 double dz=(z2-z1)*1.01;
1130 double xm=(x1+x2)/2.;
1131 x1=xm-dx/2.;x2=xm+dx/2.;
1132 double ym=(y1+y2)/2.;
1133 y1=ym-dy/2.;y2=ym+dy/2.;
1134 double zm=(z1+z2)/2.;
1135 z1=zm-dz/2.;z2=zm+dz/2.;
1136 BOITE_3D boite2(x1,y1,z1,x2+1e-8,y2+1e-8,z2+1e-8);
1137
1138 if (noeud)
1139 {
1140 glColor3f(MainForm->valeurconfig[30],MainForm->valeurconfig[31],MainForm->valeurconfig[32]);
1141 glPointSize(MainForm->valeurconfig[33]);
1142 glBegin(GL_POINTS);
1143 int nb=lst_noeud.size();
1144 for (int i=0;i<nb;i++)
1145 {
1146 MG_NOEUD* noeud1=lst_noeud[i];
1147 if (N12->Checked)
1148 if (!estdansfiltre(noeud1->get_id())) continue;
1149 if (CheckListBox1->Checked[(noeud1->get_origine()-1000)/10]==false) continue;
1150 if ((CheckListBox1->Checked[(noeud1->get_origine()-1000)/10]==true) && ((CheckListBox1->Checked[(noeud1->get_origine()-1000)/10+6])==false)) continue;
1151 BOITE_3D boitmp=noeud1->get_boite_3D();
1152 if (!(boitmp*boite2)) continue;
1153 int dim;
1154 if (noeud1->get_lien_topologie()==NULL) dim=-1;
1155 else dim=noeud1->get_lien_topologie()->get_dimension();
1156 /*if (dim==0) dim=1;
1157 dim--;*/
1158 if (dim>-1)
1159 {
1160 int binoeud[4];
1161 binoeud[0]=noeud%2;
1162 binoeud[1]=(noeud/2)%2;
1163 binoeud[2]=(noeud/4)%2;
1164 binoeud[3]=(noeud/8)%2;
1165 if (binoeud[dim])
1166 {
1167 double *xyz1=noeud1->get_coord();
1168 glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
1169 }
1170 }
1171 else
1172 {
1173 double *xyz1=noeud1->get_coord();
1174 glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
1175 }
1176 }
1177 glEnd();
1178 if (affnoeud)
1179 {
1180 for (int i=0;i<nb;i++)
1181 {
1182 MG_NOEUD* noeud1=lst_noeud[i];
1183 if (N12->Checked)
1184 if (!estdansfiltre(noeud1->get_id())) continue;
1185 if (CheckListBox1->Checked[(noeud1->get_origine()-1000)/10]==false) continue;
1186 if ((CheckListBox1->Checked[(noeud1->get_origine()-1000)/10]==true) && ((CheckListBox1->Checked[(noeud1->get_origine()-1000)/10+6])==false)) continue;
1187 BOITE_3D boitmp=noeud1->get_boite_3D();
1188 if (!(boitmp*boite2)) continue;
1189 int dim;
1190 if (noeud1->get_lien_topologie()==NULL) dim=-1;
1191 else dim=noeud1->get_lien_topologie()->get_dimension();
1192 /*if (dim==0) dim=1;
1193 dim--;*/
1194 int binoeud[4];
1195 binoeud[0]=noeud%2;
1196 binoeud[1]=(noeud/2)%2;
1197 binoeud[2]=(noeud/4)%2;
1198 binoeud[3]=(noeud/8)%2;
1199 if (dim>-1)
1200 {
1201 if (binoeud[dim])
1202 {
1203 unsigned long id=noeud1->get_id();
1204 double *xyz=noeud1->get_coord();
1205 char mess[30];
1206 sprintf(mess,"%lu",id);
1207 glRasterPos3f(xyz[0],xyz[1],xyz[2]);
1208 glListBase (1000);
1209 glCallLists (strlen(mess), GL_UNSIGNED_BYTE, mess);
1210 }
1211
1212 }
1213 else
1214 {
1215 unsigned long id=noeud1->get_id();
1216 double *xyz=noeud1->get_coord();
1217 char mess[30];
1218 sprintf(mess,"%lu",id);
1219 glRasterPos3f(xyz[0],xyz[1],xyz[2]);
1220 glListBase (1000);
1221 glCallLists (strlen(mess), GL_UNSIGNED_BYTE, mess);
1222 }
1223 }
1224
1225 }
1226 }
1227 int bmaille[3];
1228 bmaille[0]=maille%2;
1229 bmaille[1]=(maille/2)%2;
1230 bmaille[2]=(maille/4)%2;
1231 if (bmaille[0])
1232 {
1233 glLineWidth(MainForm->valeurconfig[17]);
1234 glColor3f(MainForm->valeurconfig[14],MainForm->valeurconfig[15],MainForm->valeurconfig[16]);
1235 glBegin(GL_LINES);
1236 int nb=lst_segment.size();
1237 for (int i=0;i<nb;i++)
1238 {
1239 glColor3f(MainForm->valeurconfig[14],MainForm->valeurconfig[15],MainForm->valeurconfig[16]);
1240 MG_SEGMENT* mgsegment=lst_segment[i];
1241 if (N12->Checked)
1242 if (!estdansfiltre(mgsegment->get_id())) continue;
1243 if (CheckListBox1->Checked[(mgsegment->get_origine()-1000)/10]==false) continue;
1244 if ((CheckListBox1->Checked[(mgsegment->get_origine()-1000)/10]==true) && ((CheckListBox1->Checked[(mgsegment->get_origine()-1000)/10+12])==false)) continue;
1245 BOITE_3D boitmp=mgsegment->get_boite_3D();
1246 if (!(boitmp*boite2)) continue;
1247 MG_NOEUD* noeud1=mgsegment->get_noeud1();
1248 MG_NOEUD* noeud2=mgsegment->get_noeud2();
1249 double *xyz1=noeud1->get_coord();
1250 double *xyz2=noeud2->get_coord();
1251 if (qualite==2)
1252 {
1253 int pos=(int) ((mgsegment->get_origine()-1000)/10);
1254 glColor3f(MainForm->valeurconfig[108+3*pos],MainForm->valeurconfig[109+3*pos],MainForm->valeurconfig[110+3*pos]);
1255 }
1256 MG_ELEMENT_TOPOLOGIQUE* toposel=NULL;
1257 TColor coul;
1258 if (mgsegment->get_lien_topologie()!=NULL)
1259 {
1260 std::map<unsigned long,TColor,std::less<unsigned long> >::iterator j=tabcouleur.find(mgsegment->get_lien_topologie()->get_id());
1261 if (j!=tabcouleur.end())
1262 {
1263 toposel=mgsegment->get_lien_topologie();
1264 coul=tabcouleur[mgsegment->get_lien_topologie()->get_id()];
1265 }
1266 }
1267 if ((mgsegment->get_lien_topologie()==toposel) && (mgsegment->get_lien_topologie()!=NULL) )
1268 glColor3f((coul & 0x000000FF)/255.,((coul & 0x0000FF00)>>8)/255.,((coul & 0x00FF0000)>>16)/255.);
1269 if ((CheckBox1->Checked==true) && (typesolution!=ENTITE_NOEUD)) mgsegment->extrapoler_solution_noeud();
1270 if (CheckBox1->Checked==true)
1271 {
1272 int pos=(int) ((noeud1->get_solution()-lmin)*12./(lmax-lmin));
1273 if (pos>11) pos=11;
1274 if (pos<0) pos=0;
1275 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1276 }
1277 glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
1278 if (CheckBox1->Checked==true)
1279 {
1280 int pos=(int) ((noeud2->get_solution()-lmin)*12./(lmax-lmin));
1281 if (pos>11) pos=11;
1282 if (pos<0) pos=0;
1283 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1284 }
1285 glVertex3f(xyz2[0],xyz2[1],xyz2[2]);
1286 }
1287 glEnd();
1288 if (affmaille)
1289 {
1290 for (int i=0;i<nb;i++)
1291 {
1292 MG_SEGMENT* mgsegment=lst_segment[i];
1293 if (N12->Checked)
1294 if (!estdansfiltre(mgsegment->get_id())) continue;
1295 if (CheckListBox1->Checked[(mgsegment->get_origine()-1000)/10]==false) continue;
1296 if ((CheckListBox1->Checked[(mgsegment->get_origine()-1000)/10]==true) && ((CheckListBox1->Checked[(mgsegment->get_origine()-1000)/10+12])==false)) continue;
1297 BOITE_3D boitmp=mgsegment->get_boite_3D();
1298 if (!(boitmp*boite2)) continue;
1299 MG_NOEUD* noeud1=mgsegment->get_noeud1();
1300 MG_NOEUD* noeud2=mgsegment->get_noeud2();
1301 if (qualite==2)
1302 {
1303 int pos=(int) ((mgsegment->get_origine()-1000)/10);
1304 glColor3f(MainForm->valeurconfig[108+3*pos],MainForm->valeurconfig[109+3*pos],MainForm->valeurconfig[110+3*pos]);
1305 }
1306 unsigned long id=mgsegment->get_id();
1307 double *xyz1=noeud1->get_coord();
1308 double *xyz2=noeud2->get_coord();
1309 char mess[30];
1310 sprintf(mess,"%lu",id);
1311 glRasterPos3f(0.5*(xyz1[0]+xyz2[0]),0.5*(xyz1[1]+xyz2[1]),0.5*(xyz1[2]+xyz2[2]));
1312 glListBase (1000);
1313 glCallLists (strlen(mess), GL_UNSIGNED_BYTE, mess);
1314 }
1315 }
1316 }
1317 //triangle
1318 if (bmaille[1])
1319 {
1320 if (render>0)
1321 {
1322 if (render>1) InitShading();
1323 glColor3f(MainForm->valeurconfig[34],MainForm->valeurconfig[35],MainForm->valeurconfig[36]);
1324 glEnable(GL_DEPTH_TEST);
1325 glEnable(GL_POLYGON_OFFSET_FILL);
1326 glPolygonOffset(1.0,1.0);
1327 glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
1328 glBegin(GL_TRIANGLES);
1329 glEdgeFlag(GL_TRUE);
1330 int nb=lst_triangle.size();
1331 for (int i=0;i<nb;i++)
1332 {
1333 glColor3f(MainForm->valeurconfig[34],MainForm->valeurconfig[35],MainForm->valeurconfig[36]);
1334 MG_TRIANGLE* mgtri=lst_triangle[i];
1335 if (N12->Checked)
1336 if (!estdansfiltre(mgtri->get_id())) continue;
1337 if (CheckListBox1->Checked[(mgtri->get_origine()-1000)/10]==false) continue;
1338 if ((CheckListBox1->Checked[(mgtri->get_origine()-1000)/10]==true) && ((CheckListBox1->Checked[(mgtri->get_origine()-1000)/10+18])==false)) continue;
1339 BOITE_3D boitmp=mgtri->get_boite_3D();
1340 if (!(boitmp*boite2)) continue;
1341 MG_NOEUD* noeud1=mgtri->get_noeud1();
1342 MG_NOEUD* noeud2=mgtri->get_noeud2();
1343 MG_NOEUD* noeud3=mgtri->get_noeud3();
1344 double *xyz1=noeud1->get_coord();
1345 double *xyz2=noeud2->get_coord();
1346 double *xyz3=noeud3->get_coord();
1347 MG_ELEMENT_TOPOLOGIQUE* toposel=NULL;
1348 TColor coul;
1349 if (mgtri->get_lien_topologie()!=NULL)
1350 {
1351 std::map<unsigned long,TColor,std::less<unsigned long> >::iterator j=tabcouleur.find(mgtri->get_lien_topologie()->get_id());
1352 if (j!=tabcouleur.end())
1353 {
1354 toposel=mgtri->get_lien_topologie();
1355 coul=tabcouleur[mgtri->get_lien_topologie()->get_id()];
1356 }
1357 }
1358 if ((mgtri->get_lien_topologie()==toposel) && (mgtri->get_lien_topologie()!=NULL) )
1359 glColor3f((coul & 0x000000FF)/255.,((coul & 0x0000FF00)>>8)/255.,((coul & 0x00FF0000)>>16)/255.);
1360 if (qualite==1)
1361 {
1362 double qual=OPERATEUR::qualite_triangle(xyz1,xyz2,xyz3);
1363 if (qual>MainForm->valeurconfig[53]) glColor3f(MainForm->valeurconfig[41],MainForm->valeurconfig[42],MainForm->valeurconfig[43]);
1364 else if (qual>MainForm->valeurconfig[54]) glColor3f(MainForm->valeurconfig[44],MainForm->valeurconfig[45],MainForm->valeurconfig[46]);
1365 else if (qual>MainForm->valeurconfig[55]) glColor3f(MainForm->valeurconfig[47],MainForm->valeurconfig[48],MainForm->valeurconfig[49]);
1366 else glColor3f(MainForm->valeurconfig[50],MainForm->valeurconfig[51],MainForm->valeurconfig[52]);
1367 }
1368 if (qualite==2)
1369 {
1370 int pos=(int) ((mgtri->get_origine()-1000)/10);
1371 glColor3f(MainForm->valeurconfig[108+3*pos],MainForm->valeurconfig[109+3*pos],MainForm->valeurconfig[110+3*pos]);
1372 }
1373 if ((CheckBox1->Checked==true) && (typesolution!=ENTITE_NOEUD)) mgtri->extrapoler_solution_noeud();
1374 if (shrink)
1375 {
1376 double xg=0.33333333333333*(xyz1[0]+xyz2[0]+xyz3[0]);
1377 double yg=0.33333333333333*(xyz1[1]+xyz2[1]+xyz3[1]);
1378 double zg=0.33333333333333*(xyz1[2]+xyz2[2]+xyz3[2]);
1379 double x1=xg+facteur_shrink*(xyz1[0]-xg);
1380 double y1=yg+facteur_shrink*(xyz1[1]-yg);
1381 double z1=zg+facteur_shrink*(xyz1[2]-zg);
1382 double x2=xg+facteur_shrink*(xyz2[0]-xg);
1383 double y2=yg+facteur_shrink*(xyz2[1]-yg);
1384 double z2=zg+facteur_shrink*(xyz2[2]-zg);
1385 double x3=xg+facteur_shrink*(xyz3[0]-xg);
1386 double y3=yg+facteur_shrink*(xyz3[1]-yg);
1387 double z3=zg+facteur_shrink*(xyz3[2]-zg);
1388 if (CheckBox1->Checked==true)
1389 {
1390 int pos=(int) ((noeud1->get_solution()-lmin)*12./(lmax-lmin));
1391 if (pos>11) pos=11;
1392 if (pos<0) pos=0;
1393 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1394 }
1395 glVertex3f(x1,y1,z1);
1396 if (CheckBox1->Checked==true)
1397 {
1398 int pos=(int) ((noeud3->get_solution()-lmin)*12./(lmax-lmin));
1399 if (pos>11) pos=11;
1400 if (pos<0) pos=0;
1401 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1402 }
1403 glVertex3f(x3,y3,z3);
1404 if (CheckBox1->Checked==true)
1405 {
1406 int pos=(int) ((noeud2->get_solution()-lmin)*12./(lmax-lmin));
1407 if (pos>11) pos=11;
1408 if (pos<0) pos=0;
1409 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1410 }
1411 glVertex3f(x2,y2,z2);
1412 }
1413 else
1414 {
1415 if (CheckBox1->Checked==true)
1416 {
1417 int pos=(int) ((noeud1->get_solution()-lmin)*12./(lmax-lmin));
1418 if (pos>11) pos=11;
1419 if (pos<0) pos=0;
1420 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1421 }
1422 glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
1423 if (CheckBox1->Checked==true)
1424 {
1425 int pos=(int) ((noeud3->get_solution()-lmin)*12./(lmax-lmin));
1426 if (pos>11) pos=11;
1427 if (pos<0) pos=0;
1428 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1429 }
1430 glVertex3f(xyz3[0],xyz3[1],xyz3[2]);
1431 if (CheckBox1->Checked==true)
1432 {
1433 int pos=(int) ((noeud2->get_solution()-lmin)*12./(lmax-lmin));
1434 if (pos>11) pos=11;
1435 if (pos<0) pos=0;
1436 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1437 }
1438 glVertex3f(xyz2[0],xyz2[1],xyz2[2]);
1439 }
1440 }
1441 glEnd();
1442 }
1443
1444 glFlush();
1445 if (render>0)
1446 {
1447 glColor3f(MainForm->valeurconfig[37],MainForm->valeurconfig[38],MainForm->valeurconfig[39]);
1448 glLineWidth(MainForm->valeurconfig[40]);
1449 if (render>1) InitShading();
1450 }
1451 else
1452 {
1453 glColor3f(MainForm->valeurconfig[18],MainForm->valeurconfig[19],MainForm->valeurconfig[20]);
1454 glLineWidth(MainForm->valeurconfig[21]);
1455 }
1456
1457 int nb=lst_triangle.size();
1458 if (!( (render>0) && (Cacherlemaillageenrendu1->Checked==true)))
1459 {
1460 glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
1461 glBegin(GL_TRIANGLES);
1462 glEdgeFlag(GL_TRUE);
1463 for (int i=0;i<nb;i++)
1464 {
1465 if (render>0)
1466 glColor3f(MainForm->valeurconfig[37],MainForm->valeurconfig[38],MainForm->valeurconfig[39]);
1467 else
1468 glColor3f(MainForm->valeurconfig[18],MainForm->valeurconfig[19],MainForm->valeurconfig[20]);
1469 MG_TRIANGLE* mgtri=lst_triangle[i];
1470 if (N12->Checked)
1471 if (!estdansfiltre(mgtri->get_id())) continue;
1472 if (CheckListBox1->Checked[(mgtri->get_origine()-1000)/10]==false) continue;
1473 if ((CheckListBox1->Checked[(mgtri->get_origine()-1000)/10]==true) && ((CheckListBox1->Checked[(mgtri->get_origine()-1000)/10+18])==false)) continue;
1474 BOITE_3D boitmp=mgtri->get_boite_3D();
1475 if (!(boitmp*boite2)) continue;
1476 MG_NOEUD* noeud1=mgtri->get_noeud1();
1477 MG_NOEUD* noeud2=mgtri->get_noeud2();
1478 MG_NOEUD* noeud3=mgtri->get_noeud3();
1479 double *xyz1=noeud1->get_coord();
1480 double *xyz2=noeud2->get_coord();
1481 double *xyz3=noeud3->get_coord();
1482 MG_ELEMENT_TOPOLOGIQUE* toposel=NULL;
1483 TColor coul;
1484 if (mgtri->get_lien_topologie()!=NULL)
1485 {
1486 std::map<unsigned long,TColor,std::less<unsigned long> >::iterator j=tabcouleur.find(mgtri->get_lien_topologie()->get_id());
1487 if (j!=tabcouleur.end())
1488 {
1489 toposel=mgtri->get_lien_topologie();
1490 coul=tabcouleur[mgtri->get_lien_topologie()->get_id()];
1491 }
1492 }
1493 if ( ((mgtri->get_lien_topologie()==toposel)&& (mgtri->get_lien_topologie()!=NULL) && (render==0)) || ((mgtri->get_lien_topologie()==toposel)&&(render==1) && (mgtri->get_lien_topologie()!=NULL) && (MainForm->valeurconfig[56]==0.)))
1494 glColor3f((coul & 0x000000FF)/255.,((coul & 0x0000FF00)>>8)/255.,((coul & 0x00FF0000)>>16)/255.);
1495 if ( ((qualite==1)&&(render==0)) || ((qualite==1)&&(render==1) && (MainForm->valeurconfig[56]==0.)))
1496 {
1497 double qual=OPERATEUR::qualite_triangle(xyz1,xyz2,xyz3);
1498 if (qual>MainForm->valeurconfig[53]) glColor3f(MainForm->valeurconfig[41],MainForm->valeurconfig[42],MainForm->valeurconfig[43]);
1499 else if (qual>MainForm->valeurconfig[54]) glColor3f(MainForm->valeurconfig[44],MainForm->valeurconfig[45],MainForm->valeurconfig[46]);
1500 else if (qual>MainForm->valeurconfig[55]) glColor3f(MainForm->valeurconfig[47],MainForm->valeurconfig[48],MainForm->valeurconfig[49]);
1501 else glColor3f(MainForm->valeurconfig[50],MainForm->valeurconfig[51],MainForm->valeurconfig[52]);
1502 }
1503 if ( ((qualite==2)&&(render==0)) || ((qualite==2)&&(render==1) && (MainForm->valeurconfig[56]==0.)))
1504 {
1505 int pos=(int) ((mgtri->get_origine()-1000)/10);
1506 glColor3f(MainForm->valeurconfig[108+3*pos],MainForm->valeurconfig[109+3*pos],MainForm->valeurconfig[110+3*pos]);
1507 }
1508
1509 if ((CheckBox1->Checked==true) && (typesolution!=ENTITE_NOEUD)) mgtri->extrapoler_solution_noeud();
1510 if (shrink)
1511 {
1512 double xg=0.33333333333333*(xyz1[0]+xyz2[0]+xyz3[0]);
1513 double yg=0.33333333333333*(xyz1[1]+xyz2[1]+xyz3[1]);
1514 double zg=0.33333333333333*(xyz1[2]+xyz2[2]+xyz3[2]);
1515 double x1=xg+facteur_shrink*(xyz1[0]-xg);
1516 double y1=yg+facteur_shrink*(xyz1[1]-yg);
1517 double z1=zg+facteur_shrink*(xyz1[2]-zg);
1518 double x2=xg+facteur_shrink*(xyz2[0]-xg);
1519 double y2=yg+facteur_shrink*(xyz2[1]-yg);
1520 double z2=zg+facteur_shrink*(xyz2[2]-zg);
1521 double x3=xg+facteur_shrink*(xyz3[0]-xg);
1522 double y3=yg+facteur_shrink*(xyz3[1]-yg);
1523 double z3=zg+facteur_shrink*(xyz3[2]-zg);
1524 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
1525 {
1526 int pos=(int) ((noeud1->get_solution()-lmin)*12./(lmax-lmin));
1527 if (pos>11) pos=11;
1528 if (pos<0) pos=0;
1529 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1530 }
1531 glVertex3f(x1,y1,z1);
1532 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
1533 {
1534 int pos=(int) ((noeud3->get_solution()-lmin)*12./(lmax-lmin));
1535 if (pos>11) pos=11;
1536 if (pos<0) pos=0;
1537 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1538 }
1539 glVertex3f(x3,y3,z3);
1540 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
1541 {
1542 int pos=(int) ((noeud2->get_solution()-lmin)*12./(lmax-lmin));
1543 if (pos>11) pos=11;
1544 if (pos<0) pos=0;
1545 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1546 }
1547 glVertex3f(x2,y2,z2);
1548 }
1549 else
1550 {
1551 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
1552 {
1553 int pos=(int) ((noeud1->get_solution()-lmin)*12./(lmax-lmin));
1554 if (pos>11) pos=11;
1555 if (pos<0) pos=0;
1556 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1557 }
1558 glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
1559 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
1560 {
1561 int pos=(int) ((noeud3->get_solution()-lmin)*12./(lmax-lmin));
1562 if (pos>11) pos=11;
1563 if (pos<0) pos=0;
1564 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1565 }
1566 glVertex3f(xyz3[0],xyz3[1],xyz3[2]);
1567 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
1568 {
1569 int pos=(int) ((noeud2->get_solution()-lmin)*12./(lmax-lmin));
1570 if (pos>11) pos=11;
1571 if (pos<0) pos=0;
1572 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1573 }
1574 glVertex3f(xyz2[0],xyz2[1],xyz2[2]);
1575 }
1576 }
1577 glEnd();
1578 }
1579 if (affmaille)
1580 {
1581 for (int i=0;i<nb;i++)
1582 {
1583 MG_TRIANGLE* mgtri=lst_triangle[i];
1584 if (N12->Checked)
1585 if (!estdansfiltre(mgtri->get_id())) continue;
1586 if (CheckListBox1->Checked[(mgtri->get_origine()-1000)/10]==false) continue;
1587 if ((CheckListBox1->Checked[(mgtri->get_origine()-1000)/10]==true) && ((CheckListBox1->Checked[(mgtri->get_origine()-1000)/10+18])==false)) continue;
1588 BOITE_3D boitmp=mgtri->get_boite_3D();
1589 if (!(boitmp*boite2)) continue;
1590 MG_NOEUD* noeud1=mgtri->get_noeud1();
1591 MG_NOEUD* noeud2=mgtri->get_noeud2();
1592 MG_NOEUD* noeud3=mgtri->get_noeud3();
1593 double *xyz1=noeud1->get_coord();
1594 double *xyz2=noeud2->get_coord();
1595 double *xyz3=noeud3->get_coord();
1596 unsigned long id=mgtri->get_id();
1597 char mess[30];
1598 sprintf(mess,"%lu",id);
1599 if ( ((qualite==1)&&(render==0)) || ((qualite==1)&&(render==1) && (MainForm->valeurconfig[56]==0.)))
1600 {
1601 double qual=OPERATEUR::qualite_triangle(xyz1,xyz2,xyz3);
1602 if (qual>MainForm->valeurconfig[53]) glColor3f(MainForm->valeurconfig[41],MainForm->valeurconfig[42],MainForm->valeurconfig[43]);
1603 else if (qual>MainForm->valeurconfig[54]) glColor3f(MainForm->valeurconfig[44],MainForm->valeurconfig[45],MainForm->valeurconfig[46]);
1604 else if (qual>MainForm->valeurconfig[55]) glColor3f(MainForm->valeurconfig[47],MainForm->valeurconfig[48],MainForm->valeurconfig[49]);
1605 else glColor3f(MainForm->valeurconfig[50],MainForm->valeurconfig[51],MainForm->valeurconfig[52]);
1606 }
1607 if ( ((qualite==2)&&(render==0)) || ((qualite==2)&&(render==1) && (MainForm->valeurconfig[56]==0.)))
1608 {
1609 int pos=(int) ((mgtri->get_origine()-1000)/10);
1610 glColor3f(MainForm->valeurconfig[108+3*pos],MainForm->valeurconfig[109+3*pos],MainForm->valeurconfig[110+3*pos]);
1611 }
1612 glRasterPos3f((xyz1[0]+xyz2[0]+xyz3[0])/3.,(xyz1[1]+xyz2[1]+xyz3[1])/3.,(xyz1[2]+xyz2[2]+xyz3[2])/3.);
1613 glListBase (1000);
1614 glCallLists (strlen(mess), GL_UNSIGNED_BYTE, mess);
1615 }
1616 }
1617 if (render==2)
1618 {
1619 glDisable(GL_LIGHTING);
1620 glDisable(GL_LIGHT0);
1621 glDisable(GL_LIGHT1);
1622 }
1623 }
1624 //tetra
1625 if (bmaille[2])
1626 {
1627 if (render==1)
1628 {
1629 glColor3f(MainForm->valeurconfig[34],MainForm->valeurconfig[35],MainForm->valeurconfig[36]);
1630 glEnable(GL_DEPTH_TEST);
1631 glEnable(GL_POLYGON_OFFSET_FILL);
1632 glPolygonOffset(1.0,1.0);
1633 glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
1634 glBegin(GL_TRIANGLES);
1635 glEdgeFlag(GL_TRUE);
1636 int nb=lst_tetra.size();
1637 for (int i=0;i<nb;i++)
1638 {
1639 glColor3f(MainForm->valeurconfig[34],MainForm->valeurconfig[35],MainForm->valeurconfig[36]);
1640 MG_TETRA* mgtri=lst_tetra[i];
1641 if (N12->Checked)
1642 if (!estdansfiltre(mgtri->get_id())) continue;
1643 if (CheckListBox1->Checked[(mgtri->get_origine()-1000)/10]==false) continue;
1644 if ((CheckListBox1->Checked[(mgtri->get_origine()-1000)/10]==true) && ((CheckListBox1->Checked[(mgtri->get_origine()-1000)/10+24])==false)) continue;
1645 BOITE_3D boitmp=mgtri->get_boite_3D();
1646 if (!(boitmp*boite2)) continue;
1647 MG_NOEUD* noeud1=mgtri->get_noeud1();
1648 MG_NOEUD* noeud2=mgtri->get_noeud2();
1649 MG_NOEUD* noeud3=mgtri->get_noeud3();
1650 MG_NOEUD* noeud4=mgtri->get_noeud4();
1651 double *xyz1=noeud1->get_coord();
1652 double *xyz2=noeud2->get_coord();
1653 double *xyz3=noeud3->get_coord();
1654 double *xyz4=noeud4->get_coord();
1655 MG_ELEMENT_TOPOLOGIQUE* toposel=NULL;
1656 TColor coul;
1657 if (mgtri->get_lien_topologie()!=NULL)
1658 {
1659 std::map<unsigned long,TColor,std::less<unsigned long> >::iterator j=tabcouleur.find(mgtri->get_lien_topologie()->get_id());
1660 if (j!=tabcouleur.end())
1661 {
1662 toposel=mgtri->get_lien_topologie();
1663 coul=tabcouleur[mgtri->get_lien_topologie()->get_id()];
1664 }
1665 }
1666 if ((mgtri->get_lien_topologie()==toposel) && (mgtri->get_lien_topologie()!=NULL) )
1667 glColor3f((coul & 0x000000FF)/255.,((coul & 0x0000FF00)>>8)/255.,((coul & 0x00FF0000)>>16)/255.);
1668 if (qualite==1)
1669 {
1670 double qual=OPERATEUR::qualite_tetra(xyz1,xyz2,xyz3,xyz4);
1671 if (qual>MainForm->valeurconfig[53]) glColor3f(MainForm->valeurconfig[41],MainForm->valeurconfig[42],MainForm->valeurconfig[43]);
1672 else if (qual>MainForm->valeurconfig[54]) glColor3f(MainForm->valeurconfig[44],MainForm->valeurconfig[45],MainForm->valeurconfig[46]);
1673 else if (qual>MainForm->valeurconfig[55]) glColor3f(MainForm->valeurconfig[47],MainForm->valeurconfig[48],MainForm->valeurconfig[49]);
1674 else glColor3f(MainForm->valeurconfig[50],MainForm->valeurconfig[51],MainForm->valeurconfig[52]);
1675 }
1676 if (qualite==2)
1677 {
1678 int pos=(int) ((mgtri->get_origine()-1000)/10);
1679 glColor3f(MainForm->valeurconfig[108+3*pos],MainForm->valeurconfig[109+3*pos],MainForm->valeurconfig[110+3*pos]);
1680 }
1681 if ((CheckBox1->Checked==true) && (typesolution!=ENTITE_NOEUD)) mgtri->extrapoler_solution_noeud();
1682 if (shrink)
1683 {
1684 double xg=0.25*(xyz1[0]+xyz2[0]+xyz3[0]+xyz4[0]);
1685 double yg=0.25*(xyz1[1]+xyz2[1]+xyz3[1]+xyz4[1]);
1686 double zg=0.25*(xyz1[2]+xyz2[2]+xyz3[2]+xyz4[2]);
1687 double x1=xg+facteur_shrink*(xyz1[0]-xg);
1688 double y1=yg+facteur_shrink*(xyz1[1]-yg);
1689 double z1=zg+facteur_shrink*(xyz1[2]-zg);
1690 double x2=xg+facteur_shrink*(xyz2[0]-xg);
1691 double y2=yg+facteur_shrink*(xyz2[1]-yg);
1692 double z2=zg+facteur_shrink*(xyz2[2]-zg);
1693 double x3=xg+facteur_shrink*(xyz3[0]-xg);
1694 double y3=yg+facteur_shrink*(xyz3[1]-yg);
1695 double z3=zg+facteur_shrink*(xyz3[2]-zg);
1696 double x4=xg+facteur_shrink*(xyz4[0]-xg);
1697 double y4=yg+facteur_shrink*(xyz4[1]-yg);
1698 double z4=zg+facteur_shrink*(xyz4[2]-zg);
1699 if (CheckBox1->Checked==true)
1700 {
1701 int pos=(int) ((noeud1->get_solution()-lmin)*12./(lmax-lmin));
1702 if (pos>11) pos=11;
1703 if (pos<0) pos=0;
1704 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1705 }
1706 glVertex3f(x1,y1,z1);
1707 if (CheckBox1->Checked==true)
1708 {
1709 int pos=(int) ((noeud3->get_solution()-lmin)*12./(lmax-lmin));
1710 if (pos>11) pos=11;
1711 if (pos<0) pos=0;
1712 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1713 }
1714 glVertex3f(x3,y3,z3);
1715 if (CheckBox1->Checked==true)
1716 {
1717 int pos=(int) ((noeud2->get_solution()-lmin)*12./(lmax-lmin));
1718 if (pos>11) pos=11;
1719 if (pos<0) pos=0;
1720 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1721 }
1722 glVertex3f(x2,y2,z2);
1723 if (CheckBox1->Checked==true)
1724 {
1725 int pos=(int) ((noeud1->get_solution()-lmin)*12./(lmax-lmin));
1726 if (pos>11) pos=11;
1727 if (pos<0) pos=0;
1728 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1729 }
1730 glVertex3f(x1,y1,z1);
1731 if (CheckBox1->Checked==true)
1732 {
1733 int pos=(int) ((noeud2->get_solution()-lmin)*12./(lmax-lmin));
1734 if (pos>11) pos=11;
1735 if (pos<0) pos=0;
1736 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1737 }
1738 glVertex3f(x2,y2,z2);
1739 if (CheckBox1->Checked==true)
1740 {
1741 int pos=(int) ((noeud4->get_solution()-lmin)*12./(lmax-lmin));
1742 if (pos>11) pos=11;
1743 if (pos<0) pos=0;
1744 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1745 }
1746 glVertex3f(x4,y4,z4);
1747 if (CheckBox1->Checked==true)
1748 {
1749 int pos=(int) ((noeud2->get_solution()-lmin)*12./(lmax-lmin));
1750 if (pos>11) pos=11;
1751 if (pos<0) pos=0;
1752 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1753 }
1754 glVertex3f(x2,y2,z2);
1755 if (CheckBox1->Checked==true)
1756 {
1757 int pos=(int) ((noeud3->get_solution()-lmin)*12./(lmax-lmin));
1758 if (pos>11) pos=11;
1759 if (pos<0) pos=0;
1760 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1761 }
1762 glVertex3f(x3,y3,z3);
1763 if (CheckBox1->Checked==true)
1764 {
1765 int pos=(int) ((noeud4->get_solution()-lmin)*12./(lmax-lmin));
1766 if (pos>11) pos=11;
1767 if (pos<0) pos=0;
1768 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1769 }
1770 glVertex3f(x4,y4,z4);
1771 if (CheckBox1->Checked==true)
1772 {
1773 int pos=(int) ((noeud1->get_solution()-lmin)*12./(lmax-lmin));
1774 if (pos>11) pos=11;
1775 if (pos<0) pos=0;
1776 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1777 }
1778 glVertex3f(x1,y1,z1);
1779 if (CheckBox1->Checked==true)
1780 {
1781 int pos=(int) ((noeud4->get_solution()-lmin)*12./(lmax-lmin));
1782 if (pos>11) pos=11;
1783 if (pos<0) pos=0;
1784 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1785 }
1786 glVertex3f(x4,y4,z4);
1787 if (CheckBox1->Checked==true)
1788 {
1789 int pos=(int) ((noeud3->get_solution()-lmin)*12./(lmax-lmin));
1790 if (pos>11) pos=11;
1791 if (pos<0) pos=0;
1792 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1793 }
1794 glVertex3f(x3,y3,z3);
1795 }
1796 else
1797 {
1798 if (CheckBox1->Checked==true)
1799 {
1800 int pos=(int) ((noeud1->get_solution()-lmin)*12./(lmax-lmin));
1801 if (pos>11) pos=11;
1802 if (pos<0) pos=0;
1803 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1804 }
1805 glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
1806 if (CheckBox1->Checked==true)
1807 {
1808 int pos=(int) ((noeud3->get_solution()-lmin)*12./(lmax-lmin));
1809 if (pos>11) pos=11;
1810 if (pos<0) pos=0;
1811 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1812 }
1813 glVertex3f(xyz3[0],xyz3[1],xyz3[2]);
1814 if (CheckBox1->Checked==true)
1815 {
1816 int pos=(int) ((noeud2->get_solution()-lmin)*12./(lmax-lmin));
1817 if (pos>11) pos=11;
1818 if (pos<0) pos=0;
1819 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1820 }
1821 glVertex3f(xyz2[0],xyz2[1],xyz2[2]);
1822 if (CheckBox1->Checked==true)
1823 {
1824 int pos=(int) ((noeud1->get_solution()-lmin)*12./(lmax-lmin));
1825 if (pos>11) pos=11;
1826 if (pos<0) pos=0;
1827 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1828 }
1829 glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
1830 if (CheckBox1->Checked==true)
1831 {
1832 int pos=(int) ((noeud2->get_solution()-lmin)*12./(lmax-lmin));
1833 if (pos>11) pos=11;
1834 if (pos<0) pos=0;
1835 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1836 }
1837 glVertex3f(xyz2[0],xyz2[1],xyz2[2]);
1838 if (CheckBox1->Checked==true)
1839 {
1840 int pos=(int) ((noeud4->get_solution()-lmin)*12./(lmax-lmin));
1841 if (pos>11) pos=11;
1842 if (pos<0) pos=0;
1843 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1844 }
1845 glVertex3f(xyz4[0],xyz4[1],xyz4[2]);
1846 if (CheckBox1->Checked==true)
1847 {
1848 int pos=(int) ((noeud2->get_solution()-lmin)*12./(lmax-lmin));
1849 if (pos>11) pos=11;
1850 if (pos<0) pos=0;
1851 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1852 }
1853 glVertex3f(xyz2[0],xyz2[1],xyz2[2]);
1854 if (CheckBox1->Checked==true)
1855 {
1856 int pos=(int) ((noeud3->get_solution()-lmin)*12./(lmax-lmin));
1857 if (pos>11) pos=11;
1858 if (pos<0) pos=0;
1859 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1860 }
1861 glVertex3f(xyz3[0],xyz3[1],xyz3[2]);
1862 if (CheckBox1->Checked==true)
1863 {
1864 int pos=(int) ((noeud4->get_solution()-lmin)*12./(lmax-lmin));
1865 if (pos>11) pos=11;
1866 if (pos<0) pos=0;
1867 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1868 }
1869 glVertex3f(xyz4[0],xyz4[1],xyz4[2]);
1870 if (CheckBox1->Checked==true)
1871 {
1872 int pos=(int) ((noeud1->get_solution()-lmin)*12./(lmax-lmin));
1873 if (pos>11) pos=11;
1874 if (pos<0) pos=0;
1875 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1876 }
1877 glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
1878 if (CheckBox1->Checked==true)
1879 {
1880 int pos=(int) ((noeud4->get_solution()-lmin)*12./(lmax-lmin));
1881 if (pos>11) pos=11;
1882 if (pos<0) pos=0;
1883 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1884 }
1885 glVertex3f(xyz4[0],xyz4[1],xyz4[2]);
1886 if (CheckBox1->Checked==true)
1887 {
1888 int pos=(int) ((noeud3->get_solution()-lmin)*12./(lmax-lmin));
1889 if (pos>11) pos=11;
1890 if (pos<0) pos=0;
1891 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1892 }
1893 glVertex3f(xyz3[0],xyz3[1],xyz3[2]);
1894 }
1895 }
1896 glEnd();
1897 }
1898
1899 glFlush();
1900 if (render==1)
1901 {
1902 glColor3f(MainForm->valeurconfig[37],MainForm->valeurconfig[38],MainForm->valeurconfig[39]);
1903 glLineWidth(MainForm->valeurconfig[40]);
1904 }
1905 else
1906 {
1907 glColor3f(MainForm->valeurconfig[22],MainForm->valeurconfig[23],MainForm->valeurconfig[24]);
1908 glLineWidth(MainForm->valeurconfig[25]);
1909 }
1910
1911 int nb=lst_tetra.size();
1912 if (!( (render>0) && (Cacherlemaillageenrendu1->Checked==true)))
1913 {
1914 glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
1915 glBegin(GL_TRIANGLES);
1916 glEdgeFlag(GL_TRUE);
1917 for (int i=0;i<nb;i++)
1918 {
1919 if (render==1)
1920 glColor3f(MainForm->valeurconfig[37],MainForm->valeurconfig[38],MainForm->valeurconfig[39]);
1921 else
1922 glColor3f(MainForm->valeurconfig[22],MainForm->valeurconfig[23],MainForm->valeurconfig[24]);
1923 MG_TETRA* mgtri=lst_tetra[i];
1924 if (N12->Checked)
1925 if (!estdansfiltre(mgtri->get_id())) continue;
1926 if (CheckListBox1->Checked[(mgtri->get_origine()-1000)/10]==false) continue;
1927 if ((CheckListBox1->Checked[(mgtri->get_origine()-1000)/10]==true) && ((CheckListBox1->Checked[(mgtri->get_origine()-1000)/10+24])==false)) continue;
1928 BOITE_3D boitmp=mgtri->get_boite_3D();
1929 if (!(boitmp*boite2)) continue;
1930 MG_NOEUD* noeud1=mgtri->get_noeud1();
1931 MG_NOEUD* noeud2=mgtri->get_noeud2();
1932 MG_NOEUD* noeud3=mgtri->get_noeud3();
1933 MG_NOEUD* noeud4=mgtri->get_noeud4();
1934 double *xyz1=noeud1->get_coord();
1935 double *xyz2=noeud2->get_coord();
1936 double *xyz3=noeud3->get_coord();
1937 double *xyz4=noeud4->get_coord();
1938 MG_ELEMENT_TOPOLOGIQUE* toposel=NULL;
1939 TColor coul;
1940 if (mgtri->get_lien_topologie()!=NULL)
1941 {
1942 std::map<unsigned long,TColor,std::less<unsigned long> >::iterator j=tabcouleur.find(mgtri->get_lien_topologie()->get_id());
1943 if (j!=tabcouleur.end())
1944 {
1945 toposel=mgtri->get_lien_topologie();
1946 coul=tabcouleur[mgtri->get_lien_topologie()->get_id()];
1947 }
1948 }
1949 if ( ((mgtri->get_lien_topologie()==toposel) && (mgtri->get_lien_topologie()!=NULL) && (render==0)) || ((mgtri->get_lien_topologie()==toposel)&& (mgtri->get_lien_topologie()!=NULL) &&(render==1) && (MainForm->valeurconfig[56]==0.)))
1950 glColor3f((coul & 0x000000FF)/255.,((coul & 0x0000FF00)>>8)/255.,((coul & 0x00FF0000)>>16)/255.);
1951 if ( ((qualite==1)&&(render==0)) || ((qualite==1)&&(render==1) && (MainForm->valeurconfig[56]==0.)))
1952 {
1953 double qual=OPERATEUR::qualite_tetra(xyz1,xyz2,xyz3,xyz4);
1954 if (qual>MainForm->valeurconfig[53]) glColor3f(MainForm->valeurconfig[41],MainForm->valeurconfig[42],MainForm->valeurconfig[43]);
1955 else if (qual>MainForm->valeurconfig[54]) glColor3f(MainForm->valeurconfig[44],MainForm->valeurconfig[45],MainForm->valeurconfig[46]);
1956 else if (qual>MainForm->valeurconfig[55]) glColor3f(MainForm->valeurconfig[47],MainForm->valeurconfig[48],MainForm->valeurconfig[49]);
1957 else glColor3f(MainForm->valeurconfig[50],MainForm->valeurconfig[51],MainForm->valeurconfig[52]);
1958 }
1959 if ( ((qualite==2)&&(render==0)) || ((qualite==2)&&(render==1) && (MainForm->valeurconfig[56]==0.)))
1960 {
1961 int pos=(int) ((mgtri->get_origine()-1000)/10);
1962 glColor3f(MainForm->valeurconfig[108+3*pos],MainForm->valeurconfig[109+3*pos],MainForm->valeurconfig[110+3*pos]);
1963 }
1964 if ((CheckBox1->Checked==true) && (typesolution!=ENTITE_NOEUD)) mgtri->extrapoler_solution_noeud();
1965 if (shrink)
1966 {
1967 double xg=0.25*(xyz1[0]+xyz2[0]+xyz3[0]+xyz4[0]);
1968 double yg=0.25*(xyz1[1]+xyz2[1]+xyz3[1]+xyz4[1]);
1969 double zg=0.25*(xyz1[2]+xyz2[2]+xyz3[2]+xyz4[2]);
1970 double x1=xg+facteur_shrink*(xyz1[0]-xg);
1971 double y1=yg+facteur_shrink*(xyz1[1]-yg);
1972 double z1=zg+facteur_shrink*(xyz1[2]-zg);
1973 double x2=xg+facteur_shrink*(xyz2[0]-xg);
1974 double y2=yg+facteur_shrink*(xyz2[1]-yg);
1975 double z2=zg+facteur_shrink*(xyz2[2]-zg);
1976 double x3=xg+facteur_shrink*(xyz3[0]-xg);
1977 double y3=yg+facteur_shrink*(xyz3[1]-yg);
1978 double z3=zg+facteur_shrink*(xyz3[2]-zg);
1979 double x4=xg+facteur_shrink*(xyz4[0]-xg);
1980 double y4=yg+facteur_shrink*(xyz4[1]-yg);
1981 double z4=zg+facteur_shrink*(xyz4[2]-zg);
1982 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
1983 {
1984 int pos=(int) ((noeud1->get_solution()-lmin)*12./(lmax-lmin));
1985 if (pos>11) pos=11;
1986 if (pos<0) pos=0;
1987 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1988 }
1989 glVertex3f(x1,y1,z1);
1990 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
1991 {
1992 int pos=(int) ((noeud3->get_solution()-lmin)*12./(lmax-lmin));
1993 if (pos>11) pos=11;
1994 if (pos<0) pos=0;
1995 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
1996 }
1997 glVertex3f(x3,y3,z3);
1998 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
1999 {
2000 int pos=(int) ((noeud2->get_solution()-lmin)*12./(lmax-lmin));
2001 if (pos>11) pos=11;
2002 if (pos<0) pos=0;
2003 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2004 }
2005 glVertex3f(x2,y2,z2);
2006 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2007 {
2008 int pos=(int) ((noeud1->get_solution()-lmin)*12./(lmax-lmin));
2009 if (pos>11) pos=11;
2010 if (pos<0) pos=0;
2011 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2012 }
2013 glVertex3f(x1,y1,z1);
2014 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2015 {
2016 int pos=(int) ((noeud2->get_solution()-lmin)*12./(lmax-lmin));
2017 if (pos>11) pos=11;
2018 if (pos<0) pos=0;
2019 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2020 }
2021 glVertex3f(x2,y2,z2);
2022 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2023 {
2024 int pos=(int) ((noeud4->get_solution()-lmin)*12./(lmax-lmin));
2025 if (pos>11) pos=11;
2026 if (pos<0) pos=0;
2027 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2028 }
2029 glVertex3f(x4,y4,z4);
2030 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2031 {
2032 int pos=(int) ((noeud2->get_solution()-lmin)*12./(lmax-lmin));
2033 if (pos>11) pos=11;
2034 if (pos<0) pos=0;
2035 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2036 }
2037 glVertex3f(x2,y2,z2);
2038 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2039 {
2040 int pos=(int) ((noeud3->get_solution()-lmin)*12./(lmax-lmin));
2041 if (pos>11) pos=11;
2042 if (pos<0) pos=0;
2043 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2044 }
2045 glVertex3f(x3,y3,z3);
2046 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2047 {
2048 int pos=(int) ((noeud4->get_solution()-lmin)*12./(lmax-lmin));
2049 if (pos>11) pos=11;
2050 if (pos<0) pos=0;
2051 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2052 }
2053 glVertex3f(x4,y4,z4);
2054 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2055 {
2056 int pos=(int) ((noeud1->get_solution()-lmin)*12./(lmax-lmin));
2057 if (pos>11) pos=11;
2058 if (pos<0) pos=0;
2059 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2060 }
2061 glVertex3f(x1,y1,z1);
2062 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2063 {
2064 int pos=(int) ((noeud4->get_solution()-lmin)*12./(lmax-lmin));
2065 if (pos>11) pos=11;
2066 if (pos<0) pos=0;
2067 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2068 }
2069 glVertex3f(x4,y4,z4);
2070 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2071 {
2072 int pos=(int) ((noeud3->get_solution()-lmin)*12./(lmax-lmin));
2073 if (pos>11) pos=11;
2074 if (pos<0) pos=0;
2075 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2076 }
2077 glVertex3f(x3,y3,z3);
2078 }
2079 else
2080 {
2081 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2082 {
2083 int pos=(int) ((noeud1->get_solution()-lmin)*12./(lmax-lmin));
2084 if (pos>11) pos=11;
2085 if (pos<0) pos=0;
2086 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2087 }
2088 glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
2089 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2090 {
2091 int pos=(int) ((noeud3->get_solution()-lmin)*12./(lmax-lmin));
2092 if (pos>11) pos=11;
2093 if (pos<0) pos=0;
2094 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2095 }
2096 glVertex3f(xyz3[0],xyz3[1],xyz3[2]);
2097 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2098 {
2099 int pos=(int) ((noeud2->get_solution()-lmin)*12./(lmax-lmin));
2100 if (pos>11) pos=11;
2101 if (pos<0) pos=0;
2102 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2103 }
2104 glVertex3f(xyz2[0],xyz2[1],xyz2[2]);
2105 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2106 {
2107 int pos=(int) ((noeud1->get_solution()-lmin)*12./(lmax-lmin));
2108 if (pos>11) pos=11;
2109 if (pos<0) pos=0;
2110 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2111 }
2112 glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
2113 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2114 {
2115 int pos=(int) ((noeud2->get_solution()-lmin)*12./(lmax-lmin));
2116 if (pos>11) pos=11;
2117 if (pos<0) pos=0;
2118 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2119 }
2120 glVertex3f(xyz2[0],xyz2[1],xyz2[2]);
2121 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2122 {
2123 int pos=(int) ((noeud4->get_solution()-lmin)*12./(lmax-lmin));
2124 if (pos>11) pos=11;
2125 if (pos<0) pos=0;
2126 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2127 }
2128 glVertex3f(xyz4[0],xyz4[1],xyz4[2]);
2129 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2130 {
2131 int pos=(int) ((noeud2->get_solution()-lmin)*12./(lmax-lmin));
2132 if (pos>11) pos=11;
2133 if (pos<0) pos=0;
2134 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2135 }
2136 glVertex3f(xyz2[0],xyz2[1],xyz2[2]);
2137 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2138 {
2139 int pos=(int) ((noeud3->get_solution()-lmin)*12./(lmax-lmin));
2140 if (pos>11) pos=11;
2141 if (pos<0) pos=0;
2142 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2143 }
2144 glVertex3f(xyz3[0],xyz3[1],xyz3[2]);
2145 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2146 {
2147 int pos=(int) ((noeud4->get_solution()-lmin)*12./(lmax-lmin));
2148 if (pos>11) pos=11;
2149 if (pos<0) pos=0;
2150 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2151 }
2152 glVertex3f(xyz4[0],xyz4[1],xyz4[2]);
2153 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2154 {
2155 int pos=(int) ((noeud1->get_solution()-lmin)*12./(lmax-lmin));
2156 if (pos>11) pos=11;
2157 if (pos<0) pos=0;
2158 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2159 }
2160 glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
2161 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2162 {
2163 int pos=(int) ((noeud4->get_solution()-lmin)*12./(lmax-lmin));
2164 if (pos>11) pos=11;
2165 if (pos<0) pos=0;
2166 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2167 }
2168 glVertex3f(xyz4[0],xyz4[1],xyz4[2]);
2169 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
2170 {
2171 int pos=(int) ((noeud3->get_solution()-lmin)*12./(lmax-lmin));
2172 if (pos>11) pos=11;
2173 if (pos<0) pos=0;
2174 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
2175 }
2176 glVertex3f(xyz3[0],xyz3[1],xyz3[2]);
2177 }
2178 }
2179 glEnd();
2180 }
2181 if (affmaille)
2182 {
2183 for (int i=0;i<nb;i++)
2184 {
2185 MG_TETRA* mgtri=lst_tetra[i];
2186 if (N12->Checked)
2187 if (!estdansfiltre(mgtri->get_id())) continue;
2188 if (CheckListBox1->Checked[(mgtri->get_origine()-1000)/10]==false) continue;
2189 if ((CheckListBox1->Checked[(mgtri->get_origine()-1000)/10]==true) && ((CheckListBox1->Checked[(mgtri->get_origine()-1000)/10+24])==false)) continue;
2190 BOITE_3D boitmp=mgtri->get_boite_3D();
2191 if (!(boitmp*boite2)) continue;
2192 MG_NOEUD* noeud1=mgtri->get_noeud1();
2193 MG_NOEUD* noeud2=mgtri->get_noeud2();
2194 MG_NOEUD* noeud3=mgtri->get_noeud3();
2195 MG_NOEUD* noeud4=mgtri->get_noeud4();
2196 double *xyz1=noeud1->get_coord();
2197 double *xyz2=noeud2->get_coord();
2198 double *xyz3=noeud3->get_coord();
2199 double *xyz4=noeud4->get_coord();
2200 unsigned long id=mgtri->get_id();
2201 char mess[30];
2202 sprintf(mess,"%lu",id);
2203 if ( ((qualite==1)&&(render==0)) || ((qualite==1)&&(render==1) && (MainForm->valeurconfig[56]==0.)))
2204 {
2205 double qual=OPERATEUR::qualite_tetra(xyz1,xyz2,xyz3,xyz4);
2206 if (qual>MainForm->valeurconfig[53]) glColor3f(MainForm->valeurconfig[41],MainForm->valeurconfig[42],MainForm->valeurconfig[43]);
2207 else if (qual>MainForm->valeurconfig[54]) glColor3f(MainForm->valeurconfig[44],MainForm->valeurconfig[45],MainForm->valeurconfig[46]);
2208 else if (qual>MainForm->valeurconfig[55]) glColor3f(MainForm->valeurconfig[47],MainForm->valeurconfig[48],MainForm->valeurconfig[49]);
2209 else glColor3f(MainForm->valeurconfig[50],MainForm->valeurconfig[51],MainForm->valeurconfig[52]);
2210 }
2211 if ( ((qualite==2)&&(render==0)) || ((qualite==2)&&(render==1) && (MainForm->valeurconfig[56]==0.)))
2212 {
2213 int pos=(int) ((mgtri->get_origine()-1000)/10);
2214 glColor3f(MainForm->valeurconfig[108+3*pos],MainForm->valeurconfig[109+3*pos],MainForm->valeurconfig[110+3*pos]);
2215 }
2216 glRasterPos3f((xyz1[0]+xyz2[0]+xyz3[0]+xyz4[0])/4.,(xyz1[1]+xyz2[1]+xyz3[1]+xyz4[1])/4.,(xyz1[2]+xyz2[2]+xyz3[2]+xyz4[2])/4.);
2217 glListBase (1000);
2218 glCallLists (strlen(mess), GL_UNSIGNED_BYTE, mess);
2219 }
2220 }
2221 if (render==2)
2222 {
2223 glDisable(GL_LIGHTING);
2224 glDisable(GL_LIGHT0);
2225 glDisable(GL_LIGHT1);
2226 }
2227 }
2228 }
2229 //---------------------------------------------------------------------------
2230 void __fastcall TVisuWinform::dessineaxe(void)
2231 {
2232 double d=max(boite.get_xmax()-boite.get_xmin(),boite.get_ymax()-boite.get_ymin());
2233 d=max(d,boite.get_zmax()-boite.get_zmin());
2234 d=d*MainForm->valeurconfig[10];
2235 glLineWidth(MainForm->valeurconfig[9]);
2236 glBegin(GL_LINES);
2237 glColor3f(MainForm->valeurconfig[0],MainForm->valeurconfig[1],MainForm->valeurconfig[2]);
2238 glVertex3f(0.0,0.0,0.0);
2239 glVertex3f(d,0.0,0.0);
2240 glColor3f(MainForm->valeurconfig[3],MainForm->valeurconfig[4],MainForm->valeurconfig[5]);
2241 glVertex3f(0.0,0.0,0.0);
2242 glVertex3f(0.0,d,0.0);
2243 glColor3f(MainForm->valeurconfig[6],MainForm->valeurconfig[7],MainForm->valeurconfig[8]);
2244 glVertex3f(0.0,0.0,0.0);
2245 glVertex3f(0.0,0.0,d);
2246 glEnd();
2247
2248 }
2249 //---------------------------------------------------------------------------
2250
2251 void __fastcall TVisuWinform::FormKeyDown(TObject *Sender, WORD &Key,
2252 TShiftState Shift)
2253 {
2254 transformation(Sender,Key,Shift);
2255 }
2256 //---------------------------------------------------------------------------
2257 void __fastcall TVisuWinform::redess(void)
2258 {
2259 wglMakeCurrent(hdc,hrc);
2260 glClearColor(MainForm->valeurconfig[11],MainForm->valeurconfig[12],MainForm->valeurconfig[13], 0.0f);
2261 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
2262 if (TreeView1->Enabled==false) dessinegeo(); else {dessinemai();dessinemaifem();}
2263 if (axe==1) dessineaxe();
2264 glFlush();
2265 SwapBuffers(hdc);
2266 }
2267
2268 //---------------------------------------------------------------------------
2269 void __fastcall TVisuWinform::recadre(double dx,double dy,int etat)
2270 {
2271 wglMakeCurrent(hdc,hrc);
2272 GLfloat w = ClientWidth-PageControl1->Width;
2273 GLfloat h = ClientHeight;
2274 char mess[255];
2275 if (etat==0) glViewport(0, 0, w, h);
2276 glMatrixMode(GL_PROJECTION);
2277 glLoadIdentity();
2278 double d=max(boite.get_xmax()-boite.get_xmin(),boite.get_ymax()-boite.get_ymin());
2279 d=max(d,boite.get_zmax()-boite.get_zmin());
2280 d=d*1.5/2.;
2281 double aspect=w/h;
2282 double xmin,ymin,xmax,ymax;
2283 if (w<h) xmin=boite.get_xcentre()-d+dx; else xmin=boite.get_xcentre()-d*aspect+dx;
2284 if (w<h) ymin=boite.get_ycentre()-d/aspect+dy; else ymin=boite.get_ycentre()-d+dy;
2285 double zmin=boite.get_zcentre()-100*d;
2286 if (w<h) xmax=xmin+2.*d; else xmax=xmin+2.*d*aspect;
2287 if (w<h) ymax=ymin+2.*d/aspect; else ymax=ymin+2.*d;
2288 double zmax=zmin+200.*d;
2289 glOrtho(xmin,xmax,ymin,ymax,zmin,zmax);
2290 }
2291 //---------------------------------------------------------------------------
2292
2293 void __fastcall TVisuWinform::initvue(void)
2294 {
2295 wglMakeCurrent(hdc,hrc);
2296 glMatrixMode(GL_MODELVIEW);
2297 glLoadIdentity();
2298 glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
2299 /*glRotatef(-90., 0.0, 1.0, 0.0);
2300 glRotatef(-90., 1.0, 0.0, 0.0);
2301 glRotatef(45., 0.0, 1.0, 0.0);
2302 glRotatef(-45., 0.0, 0.0, 1.0);*/
2303 glRotatef(35.26, 1.0, 0.0, 0.0);
2304 glRotatef(45., 0.0, 1.0, 0.0);
2305 glRotatef(-90., 1.0, 0.0, 0.0);
2306 glRotatef(180., 0.0, 0.0, 1.0);
2307
2308
2309 glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
2310 }
2311
2312
2313 void __fastcall TVisuWinform::FormMouseWheelDown(TObject *Sender,
2314 TShiftState Shift, TPoint &MousePos, bool &Handled)
2315 {
2316 wglMakeCurrent(hdc,hrc);
2317 glMatrixMode(GL_MODELVIEW);
2318 zoom++;
2319 glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
2320 glScalef(1.1,1.1,1.1);
2321 glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
2322 redess();
2323 }
2324 //---------------------------------------------------------------------------
2325
2326
2327 void __fastcall TVisuWinform::FormMouseWheelUp(TObject *Sender,
2328 TShiftState Shift, TPoint &MousePos, bool &Handled)
2329 {
2330 wglMakeCurrent(hdc,hrc);
2331 glMatrixMode(GL_MODELVIEW);
2332 zoom--;
2333 glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
2334 glScalef(1./1.1,1./1.1,1./1.1);
2335 glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
2336 redess();
2337 }
2338 //---------------------------------------------------------------------------
2339
2340 void __fastcall TVisuWinform::Fermer1Click(TObject *Sender)
2341 {
2342 Close();
2343 }
2344 //---------------------------------------------------------------------------
2345
2346
2347 void __fastcall TVisuWinform::FormMouseDown(TObject *Sender,
2348 TMouseButton Button, TShiftState Shift, int X, int Y)
2349 {
2350 if (Button==mbRight)
2351 {
2352 if (Shift.Contains(ssCtrl))
2353 {
2354 TPoint pt(X,Y);
2355 TPoint pt2=ClientToScreen(pt);
2356 PopupMenu2->Popup(pt2.x,pt2.y);
2357 }
2358 else if (debut_trans==false)
2359 {
2360 debut_trans=true;
2361 xdepart=X;
2362 ydepart=Y;
2363 }
2364 }
2365 if (Button==mbMiddle)
2366 if (debut_rot==false)
2367 {
2368 debut_rot=true;
2369 xrot=X;
2370 yrot=Y;
2371 }
2372
2373 }
2374 //---------------------------------------------------------------------------
2375
2376 void __fastcall TVisuWinform::FormMouseUp(TObject *Sender,
2377 TMouseButton Button, TShiftState Shift, int X, int Y)
2378 {
2379 if (Button==mbRight)
2380 if (debut_trans==true)
2381 {
2382 GLfloat w = ClientWidth-PageControl1->Width;
2383 GLfloat h = ClientHeight;
2384 double aspect=w/h;
2385 debut_trans=false;
2386 double d=max(boite.get_xmax()-boite.get_xmin(),boite.get_ymax()-boite.get_ymin());
2387 d=max(d,boite.get_zmax()-boite.get_zmin());
2388 d=d*1.5;
2389 double xmin,ymin,xmax,ymax;
2390 if (w<h) xmin=boite.get_xcentre()-d+dx; else xmin=boite.get_xcentre()-d*aspect+dx;
2391 if (w<h) ymin=boite.get_ycentre()-d/aspect+dy; else ymin=boite.get_ycentre()-d+dy;
2392 if (w<h) xmax=xmin+2.*d; else xmax=xmin+2.*d*aspect;
2393 if (w<h) ymax=ymin+2.*d/aspect; else ymax=ymin+2.*d;
2394 dx=dx+(xdepart-X)/2./w*(xmax-xmin);
2395 dy=dy-(ydepart-Y)/2./h*(ymax-ymin);
2396 recadre(dx,dy,1);
2397 redess();
2398 xdepart=X;
2399 ydepart=Y;
2400 }
2401
2402 if (Button==mbMiddle) debut_rot=false;
2403 }
2404 //---------------------------------------------------------------------------
2405
2406 void __fastcall TVisuWinform::FormMouseMove(TObject *Sender,
2407 TShiftState Shift, int X, int Y)
2408 {
2409 if (debut_trans==true)
2410 {
2411 GLfloat w = ClientWidth-PageControl1->Width;
2412 GLfloat h = ClientHeight;
2413 double aspect=w/h;
2414 double d=max(boite.get_xmax()-boite.get_xmin(),boite.get_ymax()-boite.get_ymin());
2415 d=max(d,boite.get_zmax()-boite.get_zmin());
2416 d=d*1.5;
2417 double xmin,ymin,xmax,ymax;
2418 if (w<h) xmin=boite.get_xcentre()-d+dx; else xmin=boite.get_xcentre()-d*aspect+dx;
2419 if (w<h) ymin=boite.get_ycentre()-d/aspect+dy; else ymin=boite.get_ycentre()-d+dy;
2420 if (w<h) xmax=xmin+2.*d; else xmax=xmin+2.*d*aspect;
2421 if (w<h) ymax=ymin+2.*d/aspect; else ymax=ymin+2.*d;
2422 dx=dx+(xdepart-X)/2./w*(xmax-xmin);
2423 dy=dy-(ydepart-Y)/2./h*(ymax-ymin);
2424 recadre(dx,dy,1);
2425 redess();
2426 xdepart=X;
2427 ydepart=Y;
2428 }
2429 if (debut_rot==true)
2430 {
2431 GLfloat w = ClientWidth-PageControl1->Width;
2432 GLfloat h = ClientHeight;
2433 double deltax=X-xrot;
2434 double deltay=Y-yrot;
2435 double norme=deltax*deltax+deltay*deltay;
2436 norme=sqrt(norme);
2437 if (norme>=1.)
2438 {
2439 glMatrixMode(GL_MODELVIEW);
2440 deltax=deltax*1.0/norme;
2441 deltay=deltay*1.0/norme;
2442 GLdouble matriceproj[16],matricevue[16];
2443 GLint matriceport[4];
2444 glGetIntegerv(GL_VIEWPORT,matriceport);
2445 glGetDoublev(GL_MODELVIEW_MATRIX,matricevue);
2446 glGetDoublev(GL_PROJECTION_MATRIX,matriceproj);
2447 double orx,ory,orz;
2448 double rx,ry,rz;
2449 gluUnProject((GLdouble)xrot,(GLdouble)yrot,0.,matricevue,matriceproj,matriceport,&orx,&ory,&orz);
2450 gluUnProject(xrot+deltay,yrot+deltax,0.,matricevue,matriceproj,matriceport,&rx,&ry,&rz);
2451 rx=rx-orx;
2452 ry=ry-ory;
2453 rz=rz-orz;
2454 double norme2=sqrt(rx*rx+ry*ry+rz*rz);
2455 rx=rx/norme2;
2456 ry=ry/norme2;
2457 rz=rz/norme2;
2458 glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
2459 glRotatef(norme/sqrt(w*h)*360, rx, ry, rz);
2460 glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
2461 redess();
2462 }
2463 xrot=X;
2464 yrot=Y;
2465 }
2466
2467 }
2468 //---------------------------------------------------------------------------
2469
2470
2471
2472
2473
2474 void __fastcall TVisuWinform::TreeView1KeyDown(TObject *Sender, WORD &Key,
2475 TShiftState Shift)
2476 {
2477 transformation(Sender,Key,Shift);
2478 }
2479 //---------------------------------------------------------------------------
2480 void __fastcall TVisuWinform::transformation(TObject *Sender, WORD &Key,TShiftState Shift)
2481 {
2482 wglMakeCurrent(hdc,hrc);
2483 GLfloat w = ClientWidth-PageControl1->Width;
2484 GLfloat h = ClientHeight;
2485 glMatrixMode(GL_MODELVIEW);
2486 double un=0.005*min(w,h);
2487 if (Key==VK_LEFT)
2488 {
2489 dx=dx+un;
2490 recadre(dx,dy,1);
2491 }
2492 if (Key==VK_RIGHT)
2493 {
2494 dx=dx-un;
2495 recadre(dx,dy,1);
2496 }
2497 if (Key==VK_UP)
2498 {
2499 dy=dy-un;
2500 recadre(dx,dy,1);
2501 }
2502 if (Key==VK_DOWN)
2503 {
2504 dy=dy+un;
2505 recadre(dx,dy,1);
2506 }
2507 if(Key == VK_F1)
2508 {
2509 zoom++;
2510 glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
2511 glScalef(1.1,1.1,1.1);
2512 glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
2513 }
2514 if(Key == VK_F2)
2515 {
2516 zoom--;
2517 glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
2518 glScalef(1./1.1,1./1.1,1./1.1);
2519 glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
2520 }
2521 if(Key == VK_F3)
2522 {
2523 dx=0.;
2524 dy=0.;
2525 zoom=0;
2526 recadre(dx,dy,1);
2527 initvue();
2528 }
2529 if(Key == VK_F4)
2530 {
2531 if (zoom>0)
2532 glScalef(1./pow(1.1,zoom),1./pow(1.1,zoom),1./pow(1.1,zoom));
2533 if (zoom<0)
2534 glScalef(pow(1.1,-zoom),pow(1.1,-zoom),pow(1.1,-zoom));
2535 zoom=0;
2536 dx=0;
2537 dy=0;
2538 recadre(dx,dy,1);
2539 }
2540 if(Key == VK_HOME)
2541 {
2542 glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
2543 glRotatef(-5, 0.0, 1.0, 0.0);
2544 glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
2545 }
2546 if(Key == VK_END)
2547 {
2548 glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
2549 glRotatef(5, 0.0, 1.0, 0.0);
2550 glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
2551 }
2552 if(Key == VK_INSERT)
2553 {
2554 glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
2555 glRotatef(-5, 1.0, 0.0, 0.0);
2556 glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
2557 }
2558 if(Key == VK_DELETE)
2559 {
2560 glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
2561 glRotatef(5, 1.0, 0.0, 0.0);
2562 glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
2563 }
2564 if(Key == VK_PRIOR)
2565 {
2566 glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
2567 glRotatef(-5, 0.0, 0.0, 1.0);
2568 glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
2569 }
2570 if(Key == VK_NEXT)
2571 {
2572 glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
2573 glRotatef(5, 0.0, 0.0, 1.0);
2574 glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
2575 }
2576 if (Key==VK_ADD)
2577 {
2578 facteur_shrink=facteur_shrink+0.05;
2579 if (facteur_shrink>1.) facteur_shrink=1;
2580 }
2581 if (Key==VK_SUBTRACT)
2582 {
2583 facteur_shrink=facteur_shrink-0.05;
2584 if (facteur_shrink<0.) facteur_shrink=0.;
2585 }
2586
2587 redess();
2588 }
2589 //---------------------------------------------------------------------------
2590
2591
2592
2593 void __fastcall TVisuWinform::shrinkonExecute(TObject *Sender)
2594 {
2595 shrink=1;
2596 redess();
2597 }
2598 //---------------------------------------------------------------------------
2599
2600 void __fastcall TVisuWinform::shrinkoffExecute(TObject *Sender)
2601 {
2602 shrink=0;
2603 redess();
2604 }
2605 //---------------------------------------------------------------------------
2606
2607 void __fastcall TVisuWinform::renderfilExecute(TObject *Sender)
2608 {
2609 render=0;
2610 redess();
2611 }
2612 //---------------------------------------------------------------------------
2613
2614 void __fastcall TVisuWinform::rendershadeExecute(TObject *Sender)
2615 {
2616 render=1;
2617 redess();
2618 }
2619 //---------------------------------------------------------------------------
2620
2621 void __fastcall TVisuWinform::axeonExecute(TObject *Sender)
2622 {
2623 axe=1;
2624 redess();
2625 }
2626 //---------------------------------------------------------------------------
2627
2628 void __fastcall TVisuWinform::axeoffExecute(TObject *Sender)
2629 {
2630 axe=0;
2631 redess();
2632 }
2633 //---------------------------------------------------------------------------
2634
2635 void __fastcall TVisuWinform::qualiteonExecute(TObject *Sender)
2636 {
2637 qualite=1;
2638 redess();
2639 }
2640 //---------------------------------------------------------------------------
2641
2642 void __fastcall TVisuWinform::qualiteoffExecute(TObject *Sender)
2643 {
2644 qualite=0;
2645 redess();
2646 }
2647 //---------------------------------------------------------------------------
2648
2649 void __fastcall TVisuWinform::renderlightExecute(TObject *Sender)
2650 {
2651 render=2;
2652 redess();
2653 }
2654 //---------------------------------------------------------------------------
2655
2656 void __fastcall TVisuWinform::noeudonExecute(TObject *Sender)
2657 {
2658 noeud=1;
2659 redess();
2660 }
2661 //---------------------------------------------------------------------------
2662
2663 void __fastcall TVisuWinform::noeudoffExecute(TObject *Sender)
2664 {
2665 noeud=0;
2666 redess();
2667 }
2668 //---------------------------------------------------------------------------
2669
2670 void __fastcall TVisuWinform::configExecute(TObject *Sender)
2671 {
2672 configwin->ShowModal();
2673 }
2674 //---------------------------------------------------------------------------
2675
2676 void __fastcall TVisuWinform::FileExitItemClick(TObject *Sender)
2677 {
2678 TerminateProcess(GetCurrentProcess(),0);
2679 }
2680 //---------------------------------------------------------------------------
2681
2682 void __fastcall TVisuWinform::f3Execute(TObject *Sender)
2683 {
2684 dx=0.;
2685 dy=0.;
2686 zoom=0;
2687 recadre(dx,dy,1);
2688 initvue();
2689 redess();
2690 }
2691 //---------------------------------------------------------------------------
2692
2693 void __fastcall TVisuWinform::f4Execute(TObject *Sender)
2694 {
2695 glMatrixMode(GL_MODELVIEW);
2696 if (zoom>0)
2697 glScalef(1./pow(1.1,zoom),1./pow(1.1,zoom),1./pow(1.1,zoom));
2698 if (zoom<0)
2699 glScalef(pow(1.1,-zoom),pow(1.1,-zoom),pow(1.1,-zoom));
2700 zoom=0;
2701 dx=0;
2702 dy=0;
2703 recadre(dx,dy,1);
2704 redess();
2705 }
2706 //---------------------------------------------------------------------------
2707
2708 void __fastcall TVisuWinform::xmExecute(TObject *Sender)
2709 {
2710 glMatrixMode(GL_MODELVIEW);
2711 glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
2712 glRotatef(-5, 1.0, 0.0, 0.0);
2713 glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
2714 redess();
2715 }
2716 //---------------------------------------------------------------------------
2717
2718 void __fastcall TVisuWinform::xpExecute(TObject *Sender)
2719 {
2720 glMatrixMode(GL_MODELVIEW);
2721 glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
2722 glRotatef(5, 1.0, 0.0, 0.0);
2723 glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
2724 redess();
2725 }
2726 //---------------------------------------------------------------------------
2727
2728 void __fastcall TVisuWinform::ymExecute(TObject *Sender)
2729 {
2730 glMatrixMode(GL_MODELVIEW);
2731 glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
2732 glRotatef(-5, 0.0, 1.0, 0.0);
2733 glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
2734 redess();
2735 }
2736 //---------------------------------------------------------------------------
2737
2738 void __fastcall TVisuWinform::ypExecute(TObject *Sender)
2739 {
2740 glMatrixMode(GL_MODELVIEW);
2741 glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
2742 glRotatef(5, 0.0, 1.0, 0.0);
2743 glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
2744 redess();
2745 }
2746 //---------------------------------------------------------------------------
2747
2748 void __fastcall TVisuWinform::zmExecute(TObject *Sender)
2749 {
2750 glMatrixMode(GL_MODELVIEW);
2751 glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
2752 glRotatef(-5, 0.0, 0.0, 1.0);
2753 glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
2754 redess();
2755 }
2756 //---------------------------------------------------------------------------
2757
2758 void __fastcall TVisuWinform::zpExecute(TObject *Sender)
2759 {
2760 glMatrixMode(GL_MODELVIEW);
2761 glTranslated(boite.get_xcentre(),boite.get_ycentre(),boite.get_zcentre());
2762 glRotatef(5, 0.0, 0.0, 1.0);
2763 glTranslated(-boite.get_xcentre(),-boite.get_ycentre(),-boite.get_zcentre());
2764 redess();
2765 }
2766 //---------------------------------------------------------------------------
2767
2768 void __fastcall TVisuWinform::afnoeudonExecute(TObject *Sender)
2769 {
2770 affnoeud=1;
2771 redess();
2772 }
2773 //---------------------------------------------------------------------------
2774
2775 void __fastcall TVisuWinform::afnoeudoffExecute(TObject *Sender)
2776 {
2777 affnoeud=0;
2778 redess();
2779 }
2780 //---------------------------------------------------------------------------
2781
2782 void __fastcall TVisuWinform::afmailleonExecute(TObject *Sender)
2783 {
2784 affmaille=1;
2785 redess();
2786 }
2787 //---------------------------------------------------------------------------
2788
2789 void __fastcall TVisuWinform::afmailleoffExecute(TObject *Sender)
2790 {
2791 affmaille=0;
2792 redess();
2793 }
2794 //---------------------------------------------------------------------------
2795 void __fastcall TVisuWinform::InitShading(void)
2796 {
2797 /*GLfloat infinite[] = { 1000.0, 1000.0, 1000.0, 1.0 };
2798 GLfloat infinite2[] = { 0.0, 0.0, -0.7, 0.0 };
2799 GLfloat ambient[] = { 0.5, 0.5, 0.5, 0.5 };
2800 GLfloat diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
2801 GLfloat specular[] = { 1.0, 1.0, 1.0, 1.0 };
2802 GLfloat mat_spec[]= {1.0,1.0,1.0,1.0};
2803 GLfloat mat_shi[]= {50.};
2804 diffuse[0]=MainForm->valeurconfig[34];
2805 diffuse[1]=MainForm->valeurconfig[35];
2806 diffuse[2]=MainForm->valeurconfig[36];
2807
2808
2809
2810 glShadeModel(GL_SMOOTH);
2811
2812 // glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
2813 glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
2814 //glLightfv(GL_LIGHT0, GL_SPECULAR, diffuse);;
2815 glLightfv(GL_LIGHT0, GL_POSITION, infinite);
2816 glMaterialfv(GL_FRONT,GL_SPECULAR,mat_spec);
2817 glMaterialfv(GL_FRONT,GL_SHININESS,mat_shi);
2818 glEnable(GL_LIGHTING);
2819 glEnable(GL_LIGHT0);
2820 //glEnable(GL_LIGHT1);
2821 glDepthFunc(GL_LESS);
2822 glEnable(GL_DEPTH_TEST);
2823 glEnable(GL_NORMALIZE);
2824 //glColorMaterial(GL_FRONT, GL_DIFFUSE);
2825 //glEnable(GL_COLOR_MATERIAL);*/
2826 }
2827 //---------------------------------------------------------------------------
2828
2829
2830 void __fastcall TVisuWinform::ComboBox1Change(TObject *Sender)
2831 {
2832 MG_SOLUTION* sol=NULL;
2833 FEM_SOLUTION* sol2=NULL;
2834 if ((unsigned int)ComboBox1->ItemIndex<gest->get_nb_mg_solution()) sol=gest->get_mg_solution(ComboBox1->ItemIndex);
2835 else sol2=gest->get_fem_solution(ComboBox1->ItemIndex-gest->get_nb_mg_solution());
2836 if (sol!=NULL)
2837 {
2838 ListBox1->Clear();
2839 int nb=sol->get_nb_champ();
2840 for (int i=0;i<nb;i++)
2841 ListBox1->Items->Add(sol->get_legende(i).c_str());
2842 if (ListBox1->ItemIndex==-1) CheckBox1->Checked=false;
2843 unsigned long idmai=sol->get_maillage()->get_id();
2844 char mess[30];
2845 sprintf(mess,"du maillage %lu",idmai) ;
2846 Label3->Caption=mess;
2847 if (CheckBox1->Checked==false)
2848 TabSheet3->TabVisible=false;
2849 }
2850 if (sol2!=NULL)
2851 {
2852 ListBox1->Clear();
2853 int nb=sol2->get_nb_champ();
2854 for (int i=0;i<nb;i++)
2855 ListBox1->Items->Add(sol2->get_legende(i).c_str());
2856 if (ListBox1->ItemIndex==-1) CheckBox1->Checked=false;
2857 unsigned long idmai=sol2->get_maillage()->get_id();
2858 char mess[30];
2859 sprintf(mess,"du maillage fem %lu",idmai) ;
2860 Label3->Caption=mess;
2861 if (CheckBox1->Checked==false)
2862 TabSheet3->TabVisible=false;
2863 }
2864 }
2865 //---------------------------------------------------------------------------
2866
2867 void __fastcall TVisuWinform::CheckBox1Click(TObject *Sender)
2868 {
2869 if (ListBox1->ItemIndex==-1)
2870 {
2871 CheckBox1->Checked=false;
2872 TabSheet3->TabVisible=false;
2873 }
2874 if ((ListBox1->ItemIndex!=-1) && (CheckBox1->Checked==true) )
2875 {
2876 MG_SOLUTION* sol=NULL;
2877 FEM_SOLUTION* sol2=NULL;
2878 if ((unsigned int)ComboBox1->ItemIndex<gest->get_nb_mg_solution()) sol=gest->get_mg_solution(ComboBox1->ItemIndex);
2879 else sol2=gest->get_fem_solution(ComboBox1->ItemIndex-gest->get_nb_mg_solution());
2880 if (sol!=NULL)
2881 {
2882 sol->active_solution(ListBox1->ItemIndex);
2883 typesolution=sol->get_type_solution();
2884 lmin=sol->get_legende_min();
2885 lmax=sol->get_legende_max();
2886 TabSheet3->TabVisible=true;
2887 dessine_legende();
2888 }
2889 if (sol2!=NULL)
2890 {
2891 sol2->active_solution(ListBox1->ItemIndex);
2892 typesolution=sol->get_type_solution();
2893 lmin=sol2->get_legende_min();
2894 lmax=sol2->get_legende_max();
2895 TabSheet3->TabVisible=true;
2896 dessine_legende();
2897 }
2898
2899 }
2900 if (CheckBox1->Checked==false)
2901 TabSheet3->TabVisible=false;
2902 if (CheckBox1->Checked==false) Button3->Visible=false; else Button3->Visible=true;
2903 initliste();
2904 redess();
2905 }
2906 //---------------------------------------------------------------------------
2907 void __fastcall TVisuWinform::ListBox1Click(TObject *Sender)
2908 {
2909 if ((ListBox1->ItemIndex!=-1) && (CheckBox1->Checked==true) )
2910 {
2911 MG_SOLUTION* sol=gest->get_mg_solution(ComboBox1->ItemIndex);
2912 FEM_SOLUTION* sol2=gest->get_fem_solution(ComboBox1->ItemIndex-gest->get_nb_mg_solution());
2913 if (sol!=NULL)
2914 {
2915 sol->active_solution(ListBox1->ItemIndex);
2916 typesolution=sol->get_type_solution();
2917 lmin=sol->get_legende_min();
2918 lmax=sol->get_legende_max();
2919 TabSheet3->TabVisible=true;
2920 dessine_legende();
2921 redess();
2922 }
2923 if (sol2!=NULL)
2924 {
2925 sol2->active_solution(ListBox1->ItemIndex);
2926 typesolution=sol->get_type_solution();
2927 lmin=sol2->get_legende_min();
2928 lmax=sol2->get_legende_max();
2929 TabSheet3->TabVisible=true;
2930 dessine_legende();
2931 redess();
2932 }
2933 }
2934
2935 }
2936 //---------------------------------------------------------------------------
2937 void __fastcall TVisuWinform::dessine_legende(void)
2938 {
2939 Label4->Color=(TColor)(RGB_r[11]+(RGB_g[11]<<8)+(RGB_b[11]<<16));
2940 Label5->Color=(TColor)(RGB_r[10]+(RGB_g[10]<<8)+(RGB_b[10]<<16));
2941 Label6->Color=(TColor)(RGB_r[9]+(RGB_g[9]<<8)+(RGB_b[9]<<16));
2942 Label7->Color=(TColor)(RGB_r[8]+(RGB_g[8]<<8)+(RGB_b[8]<<16));
2943 Label8->Color=(TColor)(RGB_r[7]+(RGB_g[7]<<8)+(RGB_b[7]<<16));
2944 Label9->Color=(TColor)(RGB_r[6]+(RGB_g[6]<<8)+(RGB_b[6]<<16));
2945 Label10->Color=(TColor)(RGB_r[5]+(RGB_g[5]<<8)+(RGB_b[5]<<16));
2946 Label11->Color=(TColor)(RGB_r[4]+(RGB_g[4]<<8)+(RGB_b[4]<<16));
2947 Label12->Color=(TColor)(RGB_r[3]+(RGB_g[3]<<8)+(RGB_b[3]<<16));
2948 Label13->Color=(TColor)(RGB_r[2]+(RGB_g[2]<<8)+(RGB_b[2]<<16));
2949 Label14->Color=(TColor)(RGB_r[1]+(RGB_g[1]<<8)+(RGB_b[1]<<16));
2950 Label15->Color=(TColor)(RGB_r[0]+(RGB_g[0]<<8)+(RGB_b[0]<<16));
2951
2952 Label4->Width=18;
2953 Label4->Height=18;
2954 Label5->Width=18;
2955 Label5->Height=18;
2956 Label5->Top=Label4->Top+Label4->Height;
2957 Label5->Left=Label4->Left;
2958 Label6->Width=18;
2959 Label6->Height=18;
2960 Label6->Top=Label5->Top+Label4->Height;
2961 Label6->Left=Label4->Left;
2962 Label7->Width=18;
2963 Label7->Height=18;
2964 Label7->Top=Label6->Top+Label4->Height;
2965 Label7->Left=Label4->Left;
2966 Label8->Width=18;
2967 Label8->Height=18;
2968 Label8->Top=Label7->Top+Label4->Height;
2969 Label8->Left=Label4->Left;
2970 Label9->Width=18;
2971 Label9->Height=18;
2972 Label9->Top=Label8->Top+Label4->Height;
2973 Label9->Left=Label4->Left;
2974 Label10->Width=18;
2975 Label10->Height=18;
2976 Label10->Top=Label9->Top+Label4->Height;
2977 Label10->Left=Label4->Left;
2978 Label11->Width=18;
2979 Label11->Height=18;
2980 Label11->Top=Label10->Top+Label4->Height;
2981 Label11->Left=Label4->Left;
2982 Label12->Width=18;
2983 Label12->Height=18;
2984 Label12->Top=Label11->Top+Label4->Height;
2985 Label12->Left=Label4->Left;
2986 Label13->Width=18;
2987 Label13->Height=18;
2988 Label13->Top=Label12->Top+Label4->Height;
2989 Label13->Left=Label4->Left;
2990 Label14->Width=18;
2991 Label14->Height=18;
2992 Label14->Top=Label13->Top+Label4->Height;
2993 Label14->Left=Label4->Left;
2994 Label15->Width=18;
2995 Label15->Height=18;
2996 Label15->Top=Label14->Top+Label4->Height;
2997 Label15->Left=Label4->Left;
2998
2999 Label16->Left=Label4->Left+2*Label4->Width;
3000 Label16->Top=Label4->Top-9;
3001 Label17->Left=Label4->Left+2*Label4->Width;
3002 Label17->Top=Label5->Top-9;
3003 Label18->Left=Label4->Left+2*Label4->Width;
3004 Label18->Top=Label6->Top-9;
3005 Label19->Left=Label4->Left+2*Label4->Width;
3006 Label19->Top=Label7->Top-9;
3007 Label20->Left=Label4->Left+2*Label4->Width;
3008 Label20->Top=Label8->Top-9;
3009 Label21->Left=Label4->Left+2*Label4->Width;
3010 Label21->Top=Label9->Top-9;
3011 Label22->Left=Label4->Left+2*Label4->Width;
3012 Label22->Top=Label10->Top-9;
3013 Label23->Left=Label4->Left+2*Label4->Width;
3014 Label23->Top=Label11->Top-9;
3015 Label24->Left=Label4->Left+2*Label4->Width;
3016 Label24->Top=Label12->Top-9;
3017 Label25->Left=Label4->Left+2*Label4->Width;
3018 Label25->Top=Label13->Top-9;
3019 Label26->Left=Label4->Left+2*Label4->Width;
3020 Label26->Top=Label14->Top-9;
3021 Label27->Left=Label4->Left+2*Label4->Width;
3022 Label27->Top=Label15->Top-9;
3023 Label28->Left=Label4->Left+2*Label4->Width;
3024 Label28->Top=Label15->Top+Label15->Height-9;
3025 char mess[30];
3026 sprintf(mess,"%le",lmin+12.*(lmax-lmin)/12.);
3027 Label16->Caption=mess;
3028 sprintf(mess,"%le",lmin+11.*(lmax-lmin)/12.);
3029 Label17->Caption=mess;
3030 sprintf(mess,"%le",lmin+10.*(lmax-lmin)/12.);
3031 Label18->Caption=mess;
3032 sprintf(mess,"%le",lmin+9.*(lmax-lmin)/12.);
3033 Label19->Caption=mess;
3034 sprintf(mess,"%le",lmin+8.*(lmax-lmin)/12.);
3035 Label20->Caption=mess;
3036 sprintf(mess,"%le",lmin+7.*(lmax-lmin)/12.);
3037 Label21->Caption=mess;
3038 sprintf(mess,"%le",lmin+6.*(lmax-lmin)/12.);
3039 Label22->Caption=mess;
3040 sprintf(mess,"%le",lmin+5.*(lmax-lmin)/12.);
3041 Label23->Caption=mess;
3042 sprintf(mess,"%le",lmin+4.*(lmax-lmin)/12.);
3043 Label24->Caption=mess;
3044 sprintf(mess,"%le",lmin+3.*(lmax-lmin)/12.);
3045 Label25->Caption=mess;
3046 sprintf(mess,"%le",lmin+2.*(lmax-lmin)/12.);
3047 Label26->Caption=mess;
3048 sprintf(mess,"%le",lmin+1.*(lmax-lmin)/12.);
3049 Label27->Caption=mess;
3050 sprintf(mess,"%le",lmin+0.*(lmax-lmin)/12.);
3051 Label28->Caption=mess;
3052 Label29->Caption=ListBox1->Items->Strings[ListBox1->ItemIndex];
3053
3054 }
3055 //---------------------------------------------------------------------------
3056
3057 void __fastcall TVisuWinform::CheckBox2Click(TObject *Sender)
3058 {
3059 CheckBox3->Checked=CheckBox2->Checked;
3060 redess();
3061 }
3062 //---------------------------------------------------------------------------
3063
3064
3065 void __fastcall TVisuWinform::CheckBox2KeyDown(TObject *Sender, WORD &Key,
3066 TShiftState Shift)
3067 {
3068 transformation(Sender,Key,Shift);
3069 }
3070 //---------------------------------------------------------------------------
3071
3072 void __fastcall TVisuWinform::ComboBox1KeyDown(TObject *Sender, WORD &Key,
3073 TShiftState Shift)
3074 {
3075 transformation(Sender,Key,Shift);
3076 }
3077 //---------------------------------------------------------------------------
3078
3079 void __fastcall TVisuWinform::CheckBox1KeyDown(TObject *Sender, WORD &Key,
3080 TShiftState Shift)
3081 {
3082 transformation(Sender,Key,Shift);
3083 }
3084 //---------------------------------------------------------------------------
3085
3086 void __fastcall TVisuWinform::ListBox1KeyDown(TObject *Sender, WORD &Key,
3087 TShiftState Shift)
3088 {
3089 transformation(Sender,Key,Shift);
3090 }
3091 //---------------------------------------------------------------------------
3092
3093 void __fastcall TVisuWinform::CheckBox3Click(TObject *Sender)
3094 {
3095 CheckBox2->Checked=CheckBox3->Checked;
3096 redess();
3097 }
3098 //---------------------------------------------------------------------------
3099
3100
3101
3102 void __fastcall TVisuWinform::Temprature2Click(TObject *Sender)
3103 {
3104 ajouterccf("Saisie d'une température","Tp",true,true,true,true,true) ;
3105 }
3106 //---------------------------------------------------------------------------
3107
3108 void __fastcall TVisuWinform::Montrerlaslection1Click(TObject *Sender)
3109 {
3110 if (ColorDialog1->Execute())
3111 {
3112 TTreeNode* node=TreeView1->Selected;
3113 unsigned long id = atol(node->Text.c_str());
3114 if (id==0) return;
3115 TColor couleur=ColorDialog1->Color;
3116 std::map<unsigned long,TColor,std::less<unsigned long> >::iterator j=tabcouleur.find(id);
3117 std::map<unsigned long,TTreeNode*,std::less<unsigned long> >::iterator j2=tabnode.find(id);
3118 if (j!=tabcouleur.end())
3119 tabcouleur.erase(j);
3120 if (j2!=tabnode.end())
3121 tabnode.erase(j2);
3122 tabcouleur[id]=couleur;
3123 tabnode[id]=node;
3124 TreeView1Click(Sender);
3125 Affecterladernirecouleur1->Visible=true;
3126 redess();
3127 ActiveControl=NULL;
3128 }
3129
3130 }
3131 //---------------------------------------------------------------------------
3132
3133
3134
3135
3136
3137 void __fastcall TVisuWinform::Mesh9820001Click(TObject *Sender)
3138 {
3139 int nb=gest->get_nb_mg_maillage();
3140 char chaine[500];
3141 for (int i=0;i<nb;i++)
3142 {
3143 MG_MAILLAGE* mai=gest->get_mg_maillage(i);
3144 if (i==0) sprintf(chaine,"Maillage %lu|*.*", mai->get_id());
3145 else
3146 {
3147 char chaine2[200];
3148 sprintf(chaine2,"|Maillage %lu|*.*", mai->get_id());
3149 strcat(chaine,chaine2);
3150 }
3151 }
3152 SaveDialog1->Filter=chaine;
3153 if (SaveDialog1->Execute())
3154 {
3155 MG_MAILLAGE* mai=gest->get_mg_maillage(SaveDialog1->FilterIndex-1);
3156 string namefic=SaveDialog1->FileName.c_str();
3157 mai->exporter_mesh(namefic);
3158
3159 }
3160 }
3161 //---------------------------------------------------------------------------
3162
3163 void __fastcall TVisuWinform::Giref1Click(TObject *Sender)
3164 {
3165 int nb=gest->get_nb_mg_maillage();
3166 if (nb==0)
3167 {
3168 MessageBox(Handle,"Pas de maillage","Erreur",MB_OK);
3169 return ;
3170 }
3171 char chaine[500];
3172 for (int i=0;i<nb;i++)
3173 {
3174 MG_MAILLAGE* mai=gest->get_mg_maillage(i);
3175 if (i==0) sprintf(chaine,"Maillage %lu|*.*", mai->get_id());
3176 else
3177 {
3178 char chaine2[200];
3179 sprintf(chaine2,"|Maillage %lu|*.*", mai->get_id());
3180 strcat(chaine,chaine2);
3181 }
3182 }
3183 SaveDialog1->Filter=chaine;
3184 if (SaveDialog1->Execute())
3185 {
3186 MG_MAILLAGE* mai=gest->get_mg_maillage(SaveDialog1->FilterIndex-1);
3187 string namefic=SaveDialog1->FileName.c_str();
3188 mai->exporter_giref(namefic);
3189 }
3190
3191 }
3192 //---------------------------------------------------------------------------
3193
3194
3195
3196
3197
3198 void __fastcall TVisuWinform::ajouterccf(char* cap,char *type,int val,int sommet,int arete,int face,int volume)
3199 {
3200 ccfwinform->Caption=cap;
3201 int nb_geo=gest->get_nb_mg_geometrie();
3202 ccfwinform->ComboBox5->Clear();
3203 ccfwinform->ComboBox1->Clear();
3204 ccfwinform->ComboBox2->Clear();
3205 ccfwinform->ComboBox3->Clear();
3206 ccfwinform->ComboBox4->Clear();
3207 if (sommet)
3208 {
3209 ccfwinform->RadioButton1->Visible=true;
3210 ccfwinform->ComboBox1->Visible=true;
3211 }
3212 else
3213 {
3214 ccfwinform->RadioButton1->Visible=false;
3215 ccfwinform->ComboBox1->Visible=false;
3216 }
3217 if (arete)
3218 {
3219 ccfwinform->RadioButton2->Visible=true;
3220 ccfwinform->ComboBox2->Visible=true;
3221 }
3222 else
3223 {
3224 ccfwinform->RadioButton2->Visible=false;
3225 ccfwinform->ComboBox2->Visible=false;
3226 }
3227 if (face)
3228 {
3229 ccfwinform->RadioButton3->Visible=true;
3230 ccfwinform->ComboBox3->Visible=true;
3231 }
3232 else
3233 {
3234 ccfwinform->RadioButton3->Visible=false;
3235 ccfwinform->ComboBox3->Visible=false;
3236 }
3237 if (volume)
3238 {
3239 ccfwinform->RadioButton4->Visible=true;
3240 ccfwinform->ComboBox4->Visible=true;
3241 }
3242 else
3243 {
3244 ccfwinform->RadioButton4->Visible=false;
3245 ccfwinform->ComboBox4->Visible=false;
3246 }
3247 ccfwinform->CheckBox1->Visible=ccfwinform->ComboBox2->Visible;
3248 ccfwinform->CheckBox2->Visible=ccfwinform->ComboBox3->Visible;
3249 ccfwinform->CheckBox3->Visible=ccfwinform->ComboBox4->Visible;
3250
3251 for (int i=0;i<nb_geo;i++)
3252 {
3253 MG_GEOMETRIE* mggeo=gest->get_mg_geometrie(i);
3254 char mess[30];
3255 sprintf(mess,"%lu",mggeo->get_id());
3256 ccfwinform->ComboBox5->Items->Add(mess);
3257 }
3258 ccfwinform->active(gest,type);
3259 ccfwinform->Label4->Caption=Caption;
3260 ccfwinform->Edit1->ReadOnly=false;
3261 ccfwinform->Edit1->Text="";
3262 if (val==false)
3263 {
3264 ccfwinform->Edit1->Text="0";
3265 ccfwinform->Edit1->ReadOnly=true;
3266 }
3267 ccfwinform->ShowModal();
3268 }
3269 void __fastcall TVisuWinform::X1Click(TObject *Sender)
3270 {
3271 ajouterccf("Saisie d'un blocage selon l'axe x","Dx",false,true,true,true,true) ;
3272 }
3273 //---------------------------------------------------------------------------
3274
3275 void __fastcall TVisuWinform::Y1Click(TObject *Sender)
3276 {
3277 ajouterccf("Saisie d'un blocage selon l'axe y","Dy",false,true,true,true,true) ;
3278
3279 }
3280 //---------------------------------------------------------------------------
3281
3282 void __fastcall TVisuWinform::Z1Click(TObject *Sender)
3283 {
3284 ajouterccf("Saisie d'un blocage selon l'axe z","Dz",false,true,true,true,true) ;
3285
3286 }
3287 //---------------------------------------------------------------------------
3288
3289 void __fastcall TVisuWinform::Tous1Click(TObject *Sender)
3290 {
3291 ajouterccf("Saisie d'un blocage dans toutes les directions","Da",false,true,true,true,true) ;
3292
3293 }
3294 //---------------------------------------------------------------------------
3295
3296 void __fastcall TVisuWinform::X2Click(TObject *Sender)
3297 {
3298 ajouterccf("Saisie d'une force selon l'axe x","Fx",true,true,false,false,false) ;
3299
3300 }
3301 //---------------------------------------------------------------------------
3302
3303 void __fastcall TVisuWinform::Y2Click(TObject *Sender)
3304 {
3305 ajouterccf("Saisie d'une force selon l'axe y","Fy",true,true,false,false,false) ;
3306
3307 }
3308 //---------------------------------------------------------------------------
3309
3310 void __fastcall TVisuWinform::Z2Click(TObject *Sender)
3311 {
3312 ajouterccf("Saisie d'une force selon l'axe z","Fz",true,true,false,false,false) ;
3313
3314 }
3315 //---------------------------------------------------------------------------
3316
3317 void __fastcall TVisuWinform::Matriaux1Click(TObject *Sender)
3318 {
3319 Tmatwinform *Child;
3320 Child = new Tmatwinform(Application);
3321 Child->Caption=Caption;
3322 Child->gest=gest;
3323 Child->Label6->Caption=Caption;
3324 Child->ShowModal();
3325 }
3326 //---------------------------------------------------------------------------
3327
3328
3329 void __fastcall TVisuWinform::mailleonExecute(TObject *Sender)
3330 {
3331 maille=1;
3332 redess();
3333 }
3334 //---------------------------------------------------------------------------
3335
3336 void __fastcall TVisuWinform::mailleoffExecute(TObject *Sender)
3337 {
3338 maille=0;
3339 redess();
3340 }
3341 //---------------------------------------------------------------------------
3342
3343 void __fastcall TVisuWinform::N1D1Click(TObject *Sender)
3344 {
3345 N1D1->Checked=!N1D1->Checked;
3346 noeud=0;
3347 if (N0D1->Checked) noeud=noeud+1;
3348 if (N1D1->Checked) noeud=noeud+2;
3349 if (N2D1->Checked) noeud=noeud+4;
3350 if (N3D1->Checked) noeud=noeud+8;
3351 redess();
3352 }
3353 //---------------------------------------------------------------------------
3354
3355 void __fastcall TVisuWinform::N2D1Click(TObject *Sender)
3356 {
3357 N2D1->Checked=!N2D1->Checked;
3358 noeud=0;
3359 if (N0D1->Checked) noeud=noeud+1;
3360 if (N1D1->Checked) noeud=noeud+2;
3361 if (N2D1->Checked) noeud=noeud+4;
3362 if (N3D1->Checked) noeud=noeud+8;
3363 redess();
3364 }
3365 //---------------------------------------------------------------------------
3366
3367 void __fastcall TVisuWinform::N3D1Click(TObject *Sender)
3368 {
3369 N3D1->Checked=!N3D1->Checked;
3370 noeud=0;
3371 if (N0D1->Checked) noeud=noeud+1;
3372 if (N1D1->Checked) noeud=noeud+2;
3373 if (N2D1->Checked) noeud=noeud+4;
3374 if (N3D1->Checked) noeud=noeud+8;
3375 redess();
3376 }
3377 //---------------------------------------------------------------------------
3378
3379
3380
3381 void __fastcall TVisuWinform::Tous2Click(TObject *Sender)
3382 {
3383 N1D1->Checked=true;
3384 N2D1->Checked=true;
3385 N3D1->Checked=true;
3386 noeud=15;
3387 redess();
3388 }
3389 //---------------------------------------------------------------------------
3390
3391
3392 void __fastcall TVisuWinform::N1D2Click(TObject *Sender)
3393 {
3394 N1D2->Checked=!N1D2->Checked;
3395 maille=0;
3396 if (N1D2->Checked) maille=maille+1;
3397 if (N2D2->Checked) maille=maille+2;
3398 if (N3D2->Checked) maille=maille+4;
3399 redess();
3400 }
3401 //---------------------------------------------------------------------------
3402
3403 void __fastcall TVisuWinform::N2D2Click(TObject *Sender)
3404 {
3405 N2D2->Checked=!N2D2->Checked;
3406 maille=0;
3407 if (N1D2->Checked) maille=maille+1;
3408 if (N2D2->Checked) maille=maille+2;
3409 if (N3D2->Checked) maille=maille+4;
3410 redess();
3411 }
3412 //---------------------------------------------------------------------------
3413
3414 void __fastcall TVisuWinform::N3D2Click(TObject *Sender)
3415 {
3416 N3D2->Checked=!N3D2->Checked;
3417 maille=0;
3418 if (N1D2->Checked) maille=maille+1;
3419 if (N2D2->Checked) maille=maille+2;
3420 if (N3D2->Checked) maille=maille+4;
3421 redess();
3422 }
3423 //---------------------------------------------------------------------------
3424
3425 void __fastcall TVisuWinform::Tous3Click(TObject *Sender)
3426 {
3427 N1D2->Checked=true;
3428 N2D2->Checked=true;
3429 N3D2->Checked=true;
3430 maille=7;
3431 redess();
3432 }
3433 //---------------------------------------------------------------------------
3434
3435 void __fastcall TVisuWinform::Aucun1Click(TObject *Sender)
3436 {
3437 N0D1->Checked=false;
3438 N1D1->Checked=false;
3439 N2D1->Checked=false;
3440 N3D1->Checked=false;
3441 noeud=0;
3442 redess();
3443 }
3444 //---------------------------------------------------------------------------
3445
3446 void __fastcall TVisuWinform::Aucun2Click(TObject *Sender)
3447 {
3448 N1D2->Checked=false;
3449 N2D2->Checked=false;
3450 N3D2->Checked=false;
3451 maille=0;
3452 redess();
3453 }
3454
3455 //---------------------------------------------------------------------------
3456
3457 void __fastcall TVisuWinform::X3Click(TObject *Sender)
3458 {
3459 ajouterccf("Saisie d'une pression selon l'axe x","Px",true,false,true,true,false) ;
3460
3461 }
3462 //---------------------------------------------------------------------------
3463
3464 void __fastcall TVisuWinform::Y3Click(TObject *Sender)
3465 {
3466 ajouterccf("Saisie d'une pression selon l'axe y","Py",true,false,true,true,false) ;
3467
3468 }
3469 //---------------------------------------------------------------------------
3470
3471 void __fastcall TVisuWinform::Z3Click(TObject *Sender)
3472 {
3473 ajouterccf("Saisie d'une pression selon l'axe z","Pz",true,false,true,true,false) ;
3474
3475 }
3476 //---------------------------------------------------------------------------
3477
3478 void __fastcall TVisuWinform::Normal1Click(TObject *Sender)
3479 {
3480 ajouterccf("Saisie d'une pression normale","Pn",true,false,false,true,false) ;
3481
3482 }
3483 //---------------------------------------------------------------------------
3484
3485
3486 void __fastcall TVisuWinform::ResultatCosmosM1Click(TObject *Sender)
3487 {
3488 int nb=gest->get_nb_fem_maillage();
3489 if (nb==0)
3490 {
3491 MessageBox(Handle,"Pas de maillage FEM","Erreur",MB_OK);
3492 return ;
3493 }
3494 TCosmosWin *fen=new TCosmosWin(Owner);
3495
3496 fen->ComboBox1->Clear();
3497 for (int i=0;i<nb;i++)
3498 {
3499 char chaine[500];
3500 FEM_MAILLAGE* mai=gest->get_fem_maillage(i);
3501 sprintf(chaine,"%lu", mai->get_id());
3502 fen->ComboBox1->Items->Add(chaine);
3503 }
3504 fen->Label2->Caption=Caption;
3505 fen->changegestionnaire(gest);
3506 fen->Show();
3507 }
3508 //---------------------------------------------------------------------------
3509
3510
3511 void __fastcall TVisuWinform::lancerg3dExecute(TObject *Sender)
3512 {
3513 Twincarte *Child;
3514 Child = new Twincarte(Application,*gest);
3515 Child->Caption=Caption;
3516 }
3517 //---------------------------------------------------------------------------
3518
3519
3520
3521 void __fastcall TVisuWinform::TrackBar2Change(TObject *Sender)
3522 {
3523 if (TrackBar2->Position<TrackBar1->Position) TrackBar1->Position=TrackBar2->Position;
3524 ActiveControl=NULL;
3525 redess();
3526 }
3527 //---------------------------------------------------------------------------
3528
3529 void __fastcall TVisuWinform::TrackBar1Change(TObject *Sender)
3530 {
3531 if (TrackBar2->Position<TrackBar1->Position) TrackBar2->Position=TrackBar1->Position;
3532 ActiveControl=NULL;
3533 redess();
3534 }
3535 //---------------------------------------------------------------------------
3536
3537 void __fastcall TVisuWinform::TrackBar3Change(TObject *Sender)
3538 {
3539 if (TrackBar4->Position<TrackBar3->Position) TrackBar4->Position=TrackBar3->Position;
3540 ActiveControl=NULL;
3541 redess();
3542 }
3543 //---------------------------------------------------------------------------
3544
3545 void __fastcall TVisuWinform::TrackBar4Change(TObject *Sender)
3546 {
3547 if (TrackBar4->Position<TrackBar3->Position) TrackBar3->Position=TrackBar4->Position;
3548 ActiveControl=NULL;
3549 redess();
3550
3551 }
3552 //---------------------------------------------------------------------------
3553
3554 void __fastcall TVisuWinform::TrackBar5Change(TObject *Sender)
3555 {
3556 if (TrackBar6->Position<TrackBar5->Position) TrackBar6->Position=TrackBar5->Position;
3557 ActiveControl=NULL;
3558 redess();
3559
3560 }
3561 //---------------------------------------------------------------------------
3562
3563 void __fastcall TVisuWinform::TrackBar6Change(TObject *Sender)
3564 {
3565 if (TrackBar6->Position<TrackBar5->Position) TrackBar5->Position=TrackBar6->Position;
3566 ActiveControl=NULL;
3567 redess();
3568 }
3569 //---------------------------------------------------------------------------
3570
3571 void __fastcall TVisuWinform::Button1Click(TObject *Sender)
3572 {
3573 AnsiString InputString = InputBox("Information","Entrez la valeur maximale de la legende ?", "");
3574 double val=atof(InputString.c_str());
3575 if (val>lmin) lmax=val;
3576 dessine_legende();
3577 redess();
3578 }
3579 //---------------------------------------------------------------------------
3580 void __fastcall TVisuWinform::Button2Click(TObject *Sender)
3581 {
3582 AnsiString InputString = InputBox("Information","Entrez la valeur minimale de la legende ?", "");
3583 double val=atof(InputString.c_str());
3584 if (val<lmax) lmin=val;
3585 dessine_legende();
3586 redess();
3587 }
3588 //---------------------------------------------------------------------------
3589
3590 void __fastcall TVisuWinform::Button3Click(TObject *Sender)
3591 {
3592 PageControl1->Enabled=false;
3593 PageControl2->Visible=true;
3594 TabSheet5->TabVisible=true;
3595 ComboBox2->Clear();
3596 ListBox2->Clear();
3597 Label35->Caption="Champs";
3598 Edit1->Visible=false;
3599 ListBox2->Visible=true;
3600 MG_SOLUTION* sol=gest->get_mg_solution(ComboBox1->ItemIndex);
3601 MG_MAILLAGE* mai=NULL;
3602 if (sol!=NULL) mai=sol->get_maillage();
3603 int nb=gest->get_nb_mg_solution();
3604 for (int i=0;i<nb;i++)
3605 {
3606 MG_SOLUTION* sol=gest->get_mg_solution(i);
3607 MG_MAILLAGE* maitmp=sol->get_maillage();
3608 if (maitmp!=mai)
3609 {
3610 ComboBox2->Items->Add("Solution incompatible");
3611 continue;
3612 }
3613 char chaine[1000];
3614 sprintf(chaine,"%s",sol->get_nom().c_str());
3615 ComboBox2->Items->Add(chaine);
3616 }
3617 FEM_SOLUTION* femsol=gest->get_fem_solution(ComboBox1->ItemIndex-gest->get_nb_mg_solution());
3618 FEM_MAILLAGE* femmai=NULL;
3619 if (femsol!=NULL) femmai=femsol->get_maillage();
3620 nb=gest->get_nb_fem_solution();
3621 for (int i=0;i<nb;i++)
3622 {
3623 FEM_SOLUTION* sol=gest->get_fem_solution(i);
3624 FEM_MAILLAGE* maitmp=sol->get_maillage();
3625 if (maitmp!=femmai)
3626 {
3627 ComboBox2->Items->Add("Solution incompatible");
3628 continue;
3629 }
3630 char chaine[1000];
3631 sprintf(chaine,"%s",sol->get_nom().c_str());
3632 ComboBox2->Items->Add(chaine);
3633 }
3634
3635 ComboBox2->Items->Add("Constante");
3636 ComboBox2->Items->Add("Fonction");
3637 ListBox3->Clear();
3638 char chaine[100];
3639 sprintf(chaine,"%s@%s",ListBox1->Items->Strings[ListBox1->ItemIndex].c_str(),ComboBox1->Text.c_str());
3640 ListBox3->Items->Add(chaine);
3641 }
3642 //---------------------------------------------------------------------------
3643
3644 void __fastcall TVisuWinform::Button4Click(TObject *Sender)
3645 {
3646 PageControl2->Visible=false;
3647 TabSheet5->TabVisible=false;
3648 PageControl1->Enabled=true;
3649 }
3650 //---------------------------------------------------------------------------
3651
3652 void __fastcall TVisuWinform::Button5Click(TObject *Sender)
3653 {
3654 PageControl2->Visible=false;
3655 TabSheet5->TabVisible=false;
3656 PageControl1->Enabled=true;
3657 TabSheet6->TabVisible=true;
3658 TabSheet2->TabVisible=false;
3659 PageControl1->ActivePage=TabSheet6;
3660 MG_SOLUTION* sol=gest->get_mg_solution(ComboBox2->ItemIndex);
3661 if (((ListBox2->ItemIndex!=-1) || (ComboBox2->Text=="Constante") || (ComboBox2->Text=="Fonction") )&& (ComboBox3->Text!=""))
3662 {
3663 if (gest->get_mg_solution(ComboBox1->ItemIndex)!=NULL)
3664 {
3665 MG_MAILLAGE* mai=gest->get_mg_solution(ComboBox1->ItemIndex)->get_maillage();
3666 int nb=mai->get_nb_mg_noeud();
3667 lmin=1e308;
3668 lmax=-1e308;
3669 for (int i=0;i<nb;i++)
3670 {
3671 MG_NOEUD* noeud=mai->get_mg_noeud(i);
3672 double val=noeud->get_solution();
3673 double val2;
3674 if (ComboBox2->Text=="Constante") val2=atof(Edit1->Text.c_str()); else if (ComboBox2->Text!="Fonction") val2=sol->lire(i,ListBox2->ItemIndex);
3675 if (ComboBox3->Text=="+") val=val+val2;
3676 if (ComboBox3->Text=="-") val=val-val2;
3677 if (ComboBox3->Text=="*") val=val*val2;
3678 if (ComboBox3->Text=="/")
3679 if (fabs(val2)>1e-10) val=val/val2; else val=val/fabs(val)*1e308;
3680 if (ComboBox3->Text=="|x|") val=fabs(val);
3681 if (val<lmin) lmin=val;
3682 if (val>lmax) lmax=val;
3683 noeud->change_solution(val);
3684 }
3685 if (!(lmax>lmin)) lmax=lmin+1e-6;
3686 char chaine[100];
3687 if (ComboBox3->Text=="|x|") strcpy(chaine,"|x|");
3688 else if (ComboBox2->Text=="Constante") sprintf(chaine,"%s %s",ComboBox3->Text.c_str(),Edit1->Text.c_str());
3689 else sprintf(chaine,"%s %s@%s",ComboBox3->Text.c_str(),ListBox2->Items->Strings[ListBox2->ItemIndex].c_str(),ComboBox2->Text.c_str());
3690 ListBox3->Items->Add(chaine);
3691 dessine_legende();
3692 redess();
3693 }
3694 }
3695 FEM_SOLUTION* femsol=gest->get_fem_solution(ComboBox2->ItemIndex-gest->get_nb_mg_solution());
3696 if (((ListBox2->ItemIndex!=-1) || (ComboBox2->Text=="Constante") || (ComboBox2->Text=="Fonction") )&& (ComboBox3->Text!="") )
3697 {
3698 if (gest->get_fem_solution(ComboBox1->ItemIndex-gest->get_nb_mg_solution())!=NULL)
3699 {
3700 FEM_MAILLAGE* mai=gest->get_fem_solution(ComboBox1->ItemIndex-gest->get_nb_mg_solution())->get_maillage();
3701 int nb=mai->get_nb_fem_noeud();
3702 lmin=1e308;
3703 lmax=-1e308;
3704 for (int i=0;i<nb;i++)
3705 {
3706 FEM_NOEUD* noeud=mai->get_fem_noeud(i);
3707 double val=noeud->get_solution();
3708 double val2;
3709 if (ComboBox2->Text=="Constante") val2=atof(Edit1->Text.c_str()); else if (ComboBox2->Text!="Fonction") val2=femsol->lire(i,ListBox2->ItemIndex);
3710 if (ComboBox3->Text=="+") val=val+val2;
3711 if (ComboBox3->Text=="-") val=val-val2;
3712 if (ComboBox3->Text=="*") val=val*val2;
3713 if (ComboBox3->Text=="/")
3714 if (fabs(val2)>1e-10) val=val/val2; else val=val/fabs(val)*1e308;
3715 if (ComboBox3->Text=="|x|") val=fabs(val);
3716 if (val<lmin) lmin=val;
3717 if (val>lmax) lmax=val;
3718 noeud->change_solution(val);
3719 }
3720 if (!(lmax>lmin)) lmax=lmin+1e-6;
3721 char chaine[100];
3722 if (ComboBox3->Text=="|x|") strcpy(chaine,"|x|");
3723 else if (ComboBox2->Text=="Constante") sprintf(chaine,"%s %s",ComboBox3->Text.c_str(),Edit1->Text.c_str());
3724 else sprintf(chaine,"%s %s@%s",ComboBox3->Text.c_str(),ListBox2->Items->Strings[ListBox2->ItemIndex].c_str(),ComboBox2->Text.c_str());
3725 ListBox3->Items->Add(chaine);
3726 dessine_legende();
3727 redess();
3728 }
3729 }
3730
3731 }
3732 //---------------------------------------------------------------------------
3733
3734 void __fastcall TVisuWinform::ComboBox2Change(TObject *Sender)
3735 {
3736 ComboBox3->Clear();
3737 ComboBox3->Items->Add("+");
3738 ComboBox3->Items->Add("-");
3739 ComboBox3->Items->Add("*");
3740 ComboBox3->Items->Add("/");
3741 if (ComboBox2->Text=="Solution incompatible")
3742 {
3743 ComboBox2->ItemIndex=-1;
3744 return;
3745 }
3746 if (ComboBox2->Text=="Fonction")
3747 {
3748 ComboBox3->Clear();
3749 ComboBox3->Items->Add("|x|");
3750 return;
3751 }
3752 if (ComboBox2->Text=="Constante")
3753 {
3754 ListBox2->Visible=false;
3755 Label35->Caption="Valeur";
3756 Edit1->Visible=true;
3757 return;
3758 }
3759 Label35->Caption="Champs";
3760 Edit1->Visible=false;
3761 ListBox2->Visible=true;
3762 MG_SOLUTION* sol=gest->get_mg_solution(ComboBox2->ItemIndex);
3763 if (sol!=NULL)
3764 {
3765 ListBox2->Clear();
3766 int nb=sol->get_nb_champ();
3767 for (int i=0;i<nb;i++)
3768 ListBox2->Items->Add(sol->get_legende(i).c_str());
3769 }
3770 FEM_SOLUTION* femsol=gest->get_fem_solution(ComboBox2->ItemIndex-gest->get_nb_mg_solution());
3771 if (femsol!=NULL)
3772 {
3773 ListBox2->Clear();
3774 int nb=femsol->get_nb_champ();
3775 for (int i=0;i<nb;i++)
3776 ListBox2->Items->Add(femsol->get_legende(i).c_str());
3777 }
3778
3779 }
3780 //---------------------------------------------------------------------------
3781
3782 void __fastcall TVisuWinform::Button6Click(TObject *Sender)
3783 {
3784 PageControl1->Enabled=false;
3785 PageControl2->Visible=true;
3786 TabSheet5->TabVisible=true;
3787 ComboBox2->Clear();
3788 ListBox2->Clear();
3789 Label35->Caption="Champs";
3790 Edit1->Visible=false;
3791 ListBox2->Visible=true;
3792 MG_SOLUTION* sol=gest->get_mg_solution(ComboBox1->ItemIndex);
3793 MG_MAILLAGE* mai=NULL;
3794 if (sol!=NULL) mai=sol->get_maillage();
3795 int nb=gest->get_nb_mg_solution();
3796 for (int i=0;i<nb;i++)
3797 {
3798 MG_SOLUTION* sol=gest->get_mg_solution(i);
3799 MG_MAILLAGE* maitmp=sol->get_maillage();
3800 if (maitmp!=mai)
3801 {
3802 ComboBox2->Items->Add("Solution incompatible");
3803 continue;
3804 }
3805 char chaine[1000];
3806 sprintf(chaine,"%s",sol->get_nom().c_str());
3807 ComboBox2->Items->Add(chaine);
3808 }
3809 FEM_SOLUTION* femsol=gest->get_fem_solution(ComboBox1->ItemIndex-gest->get_nb_mg_solution());
3810 FEM_MAILLAGE* femmai=NULL;
3811 if (femsol!=NULL) femmai=femsol->get_maillage();
3812 nb=gest->get_nb_fem_solution();
3813 for (int i=0;i<nb;i++)
3814 {
3815 FEM_SOLUTION* femsol=gest->get_fem_solution(i);
3816 FEM_MAILLAGE* maitmp=femsol->get_maillage();
3817 if (maitmp!=femmai)
3818 {
3819 ComboBox2->Items->Add("Solution incompatible");
3820 continue;
3821 }
3822 char chaine[1000];
3823 sprintf(chaine,"%s",femsol->get_nom().c_str());
3824 ComboBox2->Items->Add(chaine);
3825 }
3826 ComboBox2->Items->Add("Constante");
3827 ComboBox2->Items->Add("Fonction");
3828 }
3829 //---------------------------------------------------------------------------
3830
3831 void __fastcall TVisuWinform::Button7Click(TObject *Sender)
3832 {
3833 TabSheet2->TabVisible=true;
3834 MG_SOLUTION* sol=gest->get_mg_solution(ComboBox1->ItemIndex);
3835 if (sol!=NULL)
3836 {
3837 sol->active_solution(ListBox1->ItemIndex);
3838 typesolution=sol->get_type_solution();
3839 lmin=sol->get_legende_min();
3840 lmax=sol->get_legende_max();
3841 }
3842 FEM_SOLUTION* femsol=gest->get_fem_solution(ComboBox1->ItemIndex-gest->get_nb_mg_solution());
3843 if (femsol!=NULL)
3844 {
3845 femsol->active_solution(ListBox1->ItemIndex);
3846 typesolution=sol->get_type_solution();
3847 lmin=femsol->get_legende_min();
3848 lmax=femsol->get_legende_max();
3849 }
3850 TabSheet6->TabVisible=false;
3851 PageControl1->ActivePage=TabSheet2;
3852 dessine_legende();
3853 redess();
3854 }
3855 //---------------------------------------------------------------------------
3856
3857
3858 void __fastcall TVisuWinform::Vu1Click(TObject *Sender)
3859 {
3860 Tvisupara *Child;
3861 Child = new Tvisupara(Application);
3862 Child->gest=gest;
3863 int nbmai=gest->get_nb_mg_maillage();
3864 for (int i=0;i<nbmai;i++)
3865 {
3866 MG_MAILLAGE* mai=gest->get_mg_maillage(i);
3867 long id=mai->get_id();
3868 Child->ListBox1->Items->Add(id);
3869 }
3870 int nbgeo=gest->get_nb_mg_geometrie();
3871 for (int i=0;i<nbgeo;i++)
3872 {
3873 MG_GEOMETRIE* geo=gest->get_mg_geometrie(i);
3874 long id=geo->get_id();
3875 Child->ListBox3->Items->Add(id);
3876 }
3877 Child->Caption=Caption;
3878 }
3879 //---------------------------------------------------------------------------
3880
3881 void __fastcall TVisuWinform::X4Click(TObject *Sender)
3882 {
3883 ajouterccf("Saisie d'un déplacement imposé selon l'axe x","Dx",true,true,true,true,false) ;
3884 }
3885 //---------------------------------------------------------------------------
3886
3887 void __fastcall TVisuWinform::Y4Click(TObject *Sender)
3888 {
3889 ajouterccf("Saisie d'un déplacement imposé selon l'axe y","Dy",true,true,true,true,false) ;
3890 }
3891 //---------------------------------------------------------------------------
3892
3893 void __fastcall TVisuWinform::Z4Click(TObject *Sender)
3894 {
3895 ajouterccf("Saisie d'un déplacement imposé selon l'axe z","Dz",true,true,true,true,false) ;
3896 }
3897 //---------------------------------------------------------------------------
3898
3899
3900
3901 void __fastcall TVisuWinform::Resolution1Click(TObject *Sender)
3902 {
3903 Tfsolve *fsolve=new Tfsolve(Application,gest);
3904 fsolve->Caption=Caption;
3905 fsolve->ComboBox1->Clear();
3906 int nbmai=gest->get_nb_mg_maillage();
3907 for (int i=0;i<nbmai;i++)
3908 {
3909 MG_MAILLAGE* mai=gest->get_mg_maillage(i);
3910 fsolve->ComboBox1->Items->Add(mai->get_id());
3911 }
3912 fsolve->Show();
3913 }
3914 //---------------------------------------------------------------------------
3915
3916 //---------------------------------------------------------------------------
3917 void __fastcall TVisuWinform::dessinemaifem(void)
3918 {
3919 glLineWidth(1.);
3920 double x1=boite.get_xmin()+TrackBar1->Position*(boite.get_xmax()-boite.get_xmin())/100.;
3921 double y1=boite.get_ymin()+TrackBar3->Position*(boite.get_ymax()-boite.get_ymin())/100.;
3922 double z1=boite.get_zmin()+TrackBar5->Position*(boite.get_zmax()-boite.get_zmin())/100.;
3923 double x2=boite.get_xmin()+TrackBar2->Position*(boite.get_xmax()-boite.get_xmin())/100.;
3924 double y2=boite.get_ymin()+TrackBar4->Position*(boite.get_ymax()-boite.get_ymin())/100.;
3925 double z2=boite.get_zmin()+TrackBar6->Position*(boite.get_zmax()-boite.get_zmin())/100.;
3926 double dx=(x2-x1)*1.01;
3927 double dy=(y2-y1)*1.01;
3928 double dz=(z2-z1)*1.01;
3929 double xm=(x1+x2)/2.;
3930 x1=xm-dx/2.;x2=xm+dx/2.;
3931 double ym=(y1+y2)/2.;
3932 y1=ym-dy/2.;y2=ym+dy/2.;
3933 double zm=(z1+z2)/2.;
3934 z1=zm-dz/2.;z2=zm+dz/2.;
3935 BOITE_3D boite2(x1,y1,z1,x2+1e-8,y2+1e-8,z2+1e-8);
3936
3937 if (noeud)
3938 {
3939 glColor3f(MainForm->valeurconfig[30],MainForm->valeurconfig[31],MainForm->valeurconfig[32]);
3940 glPointSize(MainForm->valeurconfig[33]);
3941 glBegin(GL_POINTS);
3942 int nb=lst_noeud_fem.size();
3943 for (int i=0;i<nb;i++)
3944 {
3945 FEM_NOEUD* noeud1=lst_noeud_fem[i];
3946 if (N12->Checked)
3947 if (!estdansfiltre(noeud1->get_id())) continue;
3948 if (noeud1->get_mg_element_maillage()!=NULL)
3949 if (CheckListBox1->Checked[(noeud1->get_mg_element_maillage()->get_origine()-1000)/10]==false) continue;
3950 BOITE_3D boitmp=noeud1->get_boite_3D();
3951 if (!(boitmp*boite2)) continue;
3952 int dim;
3953 if (noeud1->get_lien_topologie()==NULL) dim=-1;
3954 else dim=noeud1->get_lien_topologie()->get_dimension();
3955 /*if (dim==0) dim=1;
3956 dim--;*/
3957 if (dim>-1)
3958 {
3959 int binoeud[4];
3960 binoeud[0]=noeud%2;
3961 binoeud[1]=(noeud/2)%2;
3962 binoeud[2]=(noeud/4)%2;
3963 binoeud[3]=(noeud/8)%2;
3964 if (binoeud[dim])
3965 {
3966 double *xyz1=noeud1->get_coord();
3967 glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
3968 }
3969 }
3970 else
3971 {
3972 double *xyz1=noeud1->get_coord();
3973 glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
3974 }
3975 }
3976 glEnd();
3977 if (affnoeud)
3978 {
3979 for (int i=0;i<nb;i++)
3980 {
3981 FEM_NOEUD* noeud1=lst_noeud_fem[i];
3982 if (N12->Checked)
3983 if (!estdansfiltre(noeud1->get_id())) continue;
3984 if (CheckListBox1->Checked[(noeud1->get_mg_element_maillage()->get_origine()-1000)/10]==false) continue;
3985 BOITE_3D boitmp=noeud1->get_boite_3D();
3986 if (!(boitmp*boite2)) continue;
3987 int dim;
3988 if (noeud1->get_lien_topologie()==NULL) dim=-1;
3989 else dim=noeud1->get_lien_topologie()->get_dimension();
3990 /*if (dim==0) dim=1;
3991 dim--;*/
3992 int binoeud[4];
3993 binoeud[0]=noeud%2;
3994 binoeud[1]=(noeud/2)%2;
3995 binoeud[2]=(noeud/4)%2;
3996 binoeud[3]=(noeud/8)%2;
3997 if (dim>-1)
3998 {
3999 if (binoeud[dim])
4000 {
4001 char mess[30];
4002 if (Id1->Checked)
4003 {
4004 unsigned long id=noeud1->get_id();
4005 sprintf(mess,"%lu",id);
4006 }
4007 if (Numero1->Checked)
4008 {
4009 int num=noeud1->get_numero();
4010 sprintf(mess,"%d",num);
4011 }
4012 if (NumeroOptimise1->Checked)
4013 {
4014 int num=noeud1->get_numero_opt();
4015 sprintf(mess,"%d",num);
4016 }
4017 double *xyz=noeud1->get_coord();
4018 glRasterPos3f(xyz[0],xyz[1],xyz[2]);
4019 glListBase (1000);
4020 glCallLists (strlen(mess), GL_UNSIGNED_BYTE, mess);
4021 }
4022
4023 }
4024 else
4025 {
4026 double *xyz=noeud1->get_coord();
4027 char mess[30];
4028 if (Id1->Checked)
4029 {
4030 unsigned long id=noeud1->get_id();
4031 sprintf(mess,"%lu",id);
4032 }
4033 if (Numero1->Checked)
4034 {
4035 int num=noeud1->get_numero();
4036 sprintf(mess,"%d",num);
4037 }
4038 if (NumeroOptimise1->Checked)
4039 {
4040 int num=noeud1->get_numero_opt();
4041 sprintf(mess,"%d",num);
4042 }
4043 glRasterPos3f(xyz[0],xyz[1],xyz[2]);
4044 glListBase (1000);
4045 glCallLists (strlen(mess), GL_UNSIGNED_BYTE, mess);
4046 }
4047 }
4048
4049 }
4050 }
4051 int bmaille[3];
4052 bmaille[0]=maille%2;
4053 bmaille[1]=(maille/2)%2;
4054 bmaille[2]=(maille/4)%2;
4055 if (bmaille[0])
4056 {
4057 glLineWidth(MainForm->valeurconfig[17]);
4058 glColor3f(MainForm->valeurconfig[14],MainForm->valeurconfig[15],MainForm->valeurconfig[16]);
4059 glBegin(GL_LINES);
4060 int nb=lst_segment_fem.size();
4061 for (int i=0;i<nb;i++)
4062 {
4063 glColor3f(MainForm->valeurconfig[14],MainForm->valeurconfig[15],MainForm->valeurconfig[16]);
4064 FEM_SEGMENT* femsegment=lst_segment_fem[i];
4065 if (N12->Checked)
4066 if (!estdansfiltre(femsegment->get_id())) continue;
4067 if (CheckListBox1->Checked[(femsegment->get_mg_element_maillage()->get_origine()-1000)/10]==false) continue;
4068 BOITE_3D boitmp=femsegment->get_boite_3D();
4069 if (!(boitmp*boite2)) continue;
4070 int nbnoeud=femsegment->get_nb_fem_noeud();
4071 FEM_NOEUD* noeud1=femsegment->get_fem_noeud(0);
4072 FEM_NOEUD* noeud2=femsegment->get_fem_noeud(1);
4073 double *xyz1=noeud1->get_coord();
4074 double *xyz2=noeud2->get_coord();
4075 MG_ELEMENT_TOPOLOGIQUE* toposel=NULL;
4076 TColor coul;
4077 if (femsegment->get_lien_topologie()!=NULL)
4078 {
4079 std::map<unsigned long,TColor,std::less<unsigned long> >::iterator j=tabcouleur.find(femsegment->get_lien_topologie()->get_id());
4080 if (j!=tabcouleur.end())
4081 {
4082 toposel=femsegment->get_lien_topologie();
4083 coul=tabcouleur[femsegment->get_lien_topologie()->get_id()];
4084 }
4085 }
4086 if ((femsegment->get_lien_topologie()==toposel) && (femsegment->get_lien_topologie()!=NULL) )
4087 glColor3f((coul & 0x000000FF)/255.,((coul & 0x0000FF00)>>8)/255.,((coul & 0x00FF0000)>>16)/255.);
4088 if (qualite==2)
4089 {
4090 int pos=(int) ((femsegment->get_mg_element_maillage()->get_origine()-1000)/10);
4091 glColor3f(MainForm->valeurconfig[108+3*pos],MainForm->valeurconfig[109+3*pos],MainForm->valeurconfig[110+3*pos]);
4092
4093 }
4094 if ((CheckBox1->Checked==true) && (typesolution!=ENTITE_NOEUD)) femsegment->extrapoler_solution_noeud();
4095 if (CheckBox1->Checked==true)
4096 {
4097 int pos=(int) ((noeud1->get_solution()-lmin)*12./(lmax-lmin));
4098 if (pos>11) pos=11;
4099 if (pos<0) pos=0;
4100 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4101 }
4102 glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
4103 if (CheckBox1->Checked==true)
4104 {
4105 int pos=(int) ((noeud2->get_solution()-lmin)*12./(lmax-lmin));
4106 if (pos>11) pos=11;
4107 if (pos<0) pos=0;
4108 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4109 }
4110 glVertex3f(xyz2[0],xyz2[1],xyz2[2]);
4111 if (nbnoeud==3)
4112 {
4113 FEM_NOEUD* noeud1=femsegment->get_fem_noeud(1);
4114 FEM_NOEUD* noeud2=femsegment->get_fem_noeud(2);
4115 double *xyz1=noeud1->get_coord();
4116 double *xyz2=noeud2->get_coord();
4117 if ((femsegment->get_lien_topologie()==toposel) && (femsegment->get_lien_topologie()!=NULL) )
4118 glColor3f((coul & 0x000000FF)/255.,((coul & 0x0000FF00)>>8)/255.,((coul & 0x00FF0000)>>16)/255.);
4119 if (CheckBox1->Checked==true)
4120 {
4121 int pos=(int) ((noeud1->get_solution()-lmin)*12./(lmax-lmin));
4122 if (pos>11) pos=11;
4123 if (pos<0) pos=0;
4124 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4125 }
4126 glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
4127 if (CheckBox1->Checked==true)
4128 {
4129 int pos=(int) ((noeud2->get_solution()-lmin)*12./(lmax-lmin));
4130 if (pos>11) pos=11;
4131 if (pos<0) pos=0;
4132 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4133 }
4134 glVertex3f(xyz2[0],xyz2[1],xyz2[2]);
4135 }
4136 }
4137 glEnd();
4138
4139 if (affmaille)
4140 {
4141 for (int i=0;i<nb;i++)
4142 {
4143 FEM_SEGMENT* femsegment=lst_segment_fem[i];
4144 if (N12->Checked)
4145 if (!estdansfiltre(femsegment->get_id())) continue;
4146 if (CheckListBox1->Checked[(femsegment->get_mg_element_maillage()->get_origine()-1000)/10]==false) continue;
4147 BOITE_3D boitmp=femsegment->get_boite_3D();
4148 if (!(boitmp*boite2)) continue;
4149 if (qualite==2)
4150 {
4151 int pos=(int) ((femsegment->get_mg_element_maillage()->get_origine()-1000)/10);
4152 glColor3f(MainForm->valeurconfig[108+3*pos],MainForm->valeurconfig[109+3*pos],MainForm->valeurconfig[110+3*pos]);
4153
4154 }
4155 FEM_NOEUD* noeud1=femsegment->get_fem_noeud(0);
4156 FEM_NOEUD* noeud2=femsegment->get_fem_noeud(femsegment->get_nb_fem_noeud()-1);
4157 unsigned long id=femsegment->get_id();
4158 double *xyz1=noeud1->get_coord();
4159 double *xyz2=noeud2->get_coord();
4160 char mess[30];
4161 sprintf(mess,"%lu",id);
4162 glRasterPos3f(0.5*(xyz1[0]+xyz2[0]),0.5*(xyz1[1]+xyz2[1]),0.5*(xyz1[2]+xyz2[2]));
4163 glListBase (1000);
4164 glCallLists (strlen(mess), GL_UNSIGNED_BYTE, mess);
4165 }
4166 }
4167 }
4168
4169 //triangle
4170 if (bmaille[1])
4171 {
4172 if (render>0)
4173 {
4174 if (render>1) InitShading();
4175 glColor3f(MainForm->valeurconfig[34],MainForm->valeurconfig[35],MainForm->valeurconfig[36]);
4176 glEnable(GL_DEPTH_TEST);
4177 glEnable(GL_POLYGON_OFFSET_FILL);
4178 glPolygonOffset(1.0,1.0);
4179 glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
4180 glBegin(GL_TRIANGLES);
4181 glEdgeFlag(GL_TRUE);
4182 int nb=lst_triangle_fem.size();
4183 for (int i=0;i<nb;i++)
4184 {
4185 glColor3f(MainForm->valeurconfig[34],MainForm->valeurconfig[35],MainForm->valeurconfig[36]);
4186 FEM_TRIANGLE* femtri=lst_triangle_fem[i];
4187 if (N12->Checked)
4188 if (!estdansfiltre(femtri->get_id())) continue;
4189 if (CheckListBox1->Checked[(femtri->get_mg_element_maillage()->get_origine()-1000)/10]==false) continue;
4190 BOITE_3D boitmp=femtri->get_boite_3D();
4191 if (!(boitmp*boite2)) continue;
4192 int nbfemnoeud=femtri->get_nb_fem_noeud();
4193 if (nbfemnoeud==3) dessinetrifem(femtri,femtri->get_fem_noeud(0),femtri->get_fem_noeud(1),femtri->get_fem_noeud(2));
4194 if (nbfemnoeud==6)
4195 {
4196 dessinetrifem(femtri,femtri->get_fem_noeud(0),femtri->get_fem_noeud(1),femtri->get_fem_noeud(5));
4197 dessinetrifem(femtri,femtri->get_fem_noeud(1),femtri->get_fem_noeud(2),femtri->get_fem_noeud(3));
4198 dessinetrifem(femtri,femtri->get_fem_noeud(1),femtri->get_fem_noeud(3),femtri->get_fem_noeud(5));
4199 dessinetrifem(femtri,femtri->get_fem_noeud(5),femtri->get_fem_noeud(3),femtri->get_fem_noeud(4));
4200 }
4201 }
4202 glEnd();
4203 }
4204
4205 glFlush();
4206 if (render>0)
4207 {
4208 glColor3f(MainForm->valeurconfig[37],MainForm->valeurconfig[38],MainForm->valeurconfig[39]);
4209 glLineWidth(MainForm->valeurconfig[40]);
4210 if (render>1) InitShading();
4211 }
4212 else
4213 {
4214 glColor3f(MainForm->valeurconfig[18],MainForm->valeurconfig[19],MainForm->valeurconfig[20]);
4215 glLineWidth(MainForm->valeurconfig[21]);
4216 }
4217
4218 int nb=lst_triangle_fem.size();
4219 //if (!( (render>0) && (Cacherlemaillageenrendu1->Checked==true)))
4220 {
4221 glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
4222 glBegin(GL_LINES);
4223 glEdgeFlag(GL_TRUE);
4224 for (int i=0;i<nb;i++)
4225 {
4226 if (render>0)
4227 glColor3f(MainForm->valeurconfig[37],MainForm->valeurconfig[38],MainForm->valeurconfig[39]);
4228 else
4229 glColor3f(MainForm->valeurconfig[18],MainForm->valeurconfig[19],MainForm->valeurconfig[20]);
4230 FEM_TRIANGLE* femtri=lst_triangle_fem[i];
4231 if (N12->Checked)
4232 if (!estdansfiltre(femtri->get_id())) continue;
4233 if (CheckListBox1->Checked[(femtri->get_mg_element_maillage()->get_origine()-1000)/10]==false) continue;
4234 BOITE_3D boitmp=femtri->get_boite_3D();
4235 if (!(boitmp*boite2)) continue;
4236 int nb_fem_noeud=femtri->get_nb_fem_noeud();
4237 double xg=0.;
4238 double yg=0.;
4239 double zg=0.;
4240 for (int j=0;j<nb_fem_noeud;j++)
4241 {
4242 FEM_NOEUD* no=femtri->get_fem_noeud(j);
4243 xg=xg+no->get_x();
4244 yg=yg+no->get_y();
4245 zg=zg+no->get_z();
4246 }
4247 xg=xg/nb_fem_noeud;
4248 yg=yg/nb_fem_noeud;
4249 zg=zg/nb_fem_noeud;
4250 for (int j=0;j<nb_fem_noeud;j++)
4251 {
4252 FEM_NOEUD* no1=femtri->get_fem_noeud(j);
4253 FEM_NOEUD* no2;
4254 if (j+1!=nb_fem_noeud) no2=femtri->get_fem_noeud(j+1); else no2=femtri->get_fem_noeud(0);
4255 double *xyz1=no1->get_coord();
4256 double *xyz2=no2->get_coord();
4257 MG_ELEMENT_TOPOLOGIQUE* toposel=NULL;
4258 TColor coul;
4259 if (femtri->get_lien_topologie()!=NULL)
4260 {
4261 std::map<unsigned long,TColor,std::less<unsigned long> >::iterator j=tabcouleur.find(femtri->get_lien_topologie()->get_id());
4262 if (j!=tabcouleur.end())
4263 {
4264 toposel=femtri->get_lien_topologie();
4265 coul=tabcouleur[femtri->get_lien_topologie()->get_id()];
4266 }
4267 }
4268 if ( ((femtri->get_lien_topologie()==toposel)&& (femtri->get_lien_topologie()!=NULL) && (render==0)) || ((femtri->get_lien_topologie()==toposel)&&(render==1) && (femtri->get_lien_topologie()!=NULL) && (MainForm->valeurconfig[56]==0.)))
4269 glColor3f((coul & 0x000000FF)/255.,((coul & 0x0000FF00)>>8)/255.,((coul & 0x00FF0000)>>16)/255.);
4270 if ( ((qualite==1)&&(render==0)) || ((qualite==1)&&(render==1) && (MainForm->valeurconfig[56]==0.)))
4271 {
4272 double qual;
4273 if (femtri->get_nb_fem_noeud()==3) qual=OPERATEUR::qualite_triangle(femtri->get_fem_noeud(0)->get_coord(),femtri->get_fem_noeud(1)->get_coord(),femtri->get_fem_noeud(2)->get_coord());
4274 if (femtri->get_nb_fem_noeud()==6) qual=OPERATEUR::qualite_triangle(femtri->get_fem_noeud(0)->get_coord(),femtri->get_fem_noeud(2)->get_coord(),femtri->get_fem_noeud(4)->get_coord());
4275 if (qual>MainForm->valeurconfig[53]) glColor3f(MainForm->valeurconfig[41],MainForm->valeurconfig[42],MainForm->valeurconfig[43]);
4276 else if (qual>MainForm->valeurconfig[54]) glColor3f(MainForm->valeurconfig[44],MainForm->valeurconfig[45],MainForm->valeurconfig[46]);
4277 else if (qual>MainForm->valeurconfig[55]) glColor3f(MainForm->valeurconfig[47],MainForm->valeurconfig[48],MainForm->valeurconfig[49]);
4278 else glColor3f(MainForm->valeurconfig[50],MainForm->valeurconfig[51],MainForm->valeurconfig[52]);
4279 }
4280 if ( ((qualite==2)&&(render==0)) || ((qualite==2)&&(render==1) && (MainForm->valeurconfig[56]==0.)))
4281 {
4282 int pos=(int) ((femtri->get_mg_element_maillage()->get_origine()-1000)/10);
4283 glColor3f(MainForm->valeurconfig[108+3*pos],MainForm->valeurconfig[109+3*pos],MainForm->valeurconfig[110+3*pos]);
4284 }
4285 if ((CheckBox1->Checked==true) && (typesolution!=ENTITE_NOEUD)) femtri->extrapoler_solution_noeud();
4286 if (shrink)
4287 {
4288 double x1=xg+facteur_shrink*(xyz1[0]-xg);
4289 double y1=yg+facteur_shrink*(xyz1[1]-yg);
4290 double z1=zg+facteur_shrink*(xyz1[2]-zg);
4291 double x2=xg+facteur_shrink*(xyz2[0]-xg);
4292 double y2=yg+facteur_shrink*(xyz2[1]-yg);
4293 double z2=zg+facteur_shrink*(xyz2[2]-zg);
4294 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
4295 {
4296 int pos=(int) ((no1->get_solution()-lmin)*12./(lmax-lmin));
4297 if (pos>11) pos=11;
4298 if (pos<0) pos=0;
4299 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4300 }
4301 glVertex3f(x1,y1,z1);
4302 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
4303 {
4304 int pos=(int) ((no2->get_solution()-lmin)*12./(lmax-lmin));
4305 if (pos>11) pos=11;
4306 if (pos<0) pos=0;
4307 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4308 }
4309 glVertex3f(x2,y2,z2);
4310
4311 }
4312 else
4313 {
4314 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
4315 {
4316 int pos=(int) ((no1->get_solution()-lmin)*12./(lmax-lmin));
4317 if (pos>11) pos=11;
4318 if (pos<0) pos=0;
4319 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4320 }
4321 glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
4322 if ((CheckBox1->Checked==true) && ( (CheckBox2->Checked==false) || ( (CheckBox2->Checked==true) && (render==0) )) )
4323 {
4324 int pos=(int) ((no2->get_solution()-lmin)*12./(lmax-lmin));
4325 if (pos>11) pos=11;
4326 if (pos<0) pos=0;
4327 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4328 }
4329 glVertex3f(xyz2[0],xyz2[1],xyz2[2]);
4330 }
4331 }
4332 }
4333
4334 glEnd();
4335 }
4336 if (affmaille)
4337 {
4338 for (int i=0;i<nb;i++)
4339 {
4340 FEM_TRIANGLE* femtri=lst_triangle_fem[i];
4341 if (N12->Checked)
4342 if (!estdansfiltre(femtri->get_id())) continue;
4343 if (CheckListBox1->Checked[(femtri->get_mg_element_maillage()->get_origine()-1000)/10]==false) continue;
4344 BOITE_3D boitmp=femtri->get_boite_3D();
4345 if (!(boitmp*boite2)) continue;
4346 int n1,n2,n3;
4347 int nb=femtri->get_nb_fem_noeud();
4348 if (nb==3) {n1=0;n2=1;n3=2;}
4349 if (nb==6) {n1=0;n2=2;n3=4;}
4350 FEM_NOEUD* noeud1=femtri->get_fem_noeud(n1);
4351 FEM_NOEUD* noeud2=femtri->get_fem_noeud(n2);
4352 FEM_NOEUD* noeud3=femtri->get_fem_noeud(n3);
4353 double *xyz1=noeud1->get_coord();
4354 double *xyz2=noeud2->get_coord();
4355 double *xyz3=noeud3->get_coord();
4356 unsigned long id=femtri->get_id();
4357 char mess[30];
4358 sprintf(mess,"%lu",id);
4359 if ( ((qualite==1)&&(render==0)) || ((qualite==1)&&(render==1) && (MainForm->valeurconfig[56]==0.)))
4360 {
4361 double qual=OPERATEUR::qualite_triangle(xyz1,xyz2,xyz3);
4362 if (qual>MainForm->valeurconfig[53]) glColor3f(MainForm->valeurconfig[41],MainForm->valeurconfig[42],MainForm->valeurconfig[43]);
4363 else if (qual>MainForm->valeurconfig[54]) glColor3f(MainForm->valeurconfig[44],MainForm->valeurconfig[45],MainForm->valeurconfig[46]);
4364 else if (qual>MainForm->valeurconfig[55]) glColor3f(MainForm->valeurconfig[47],MainForm->valeurconfig[48],MainForm->valeurconfig[49]);
4365 else glColor3f(MainForm->valeurconfig[50],MainForm->valeurconfig[51],MainForm->valeurconfig[52]);
4366 }
4367 if ( ((qualite==2)&&(render==0)) || ((qualite==2)&&(render==1) && (MainForm->valeurconfig[56]==0.)))
4368 {
4369 int pos=(int) ((femtri->get_mg_element_maillage()->get_origine()-1000)/10);
4370 glColor3f(MainForm->valeurconfig[108+3*pos],MainForm->valeurconfig[109+3*pos],MainForm->valeurconfig[110+3*pos]);
4371 }
4372 glRasterPos3f((xyz1[0]+xyz2[0]+xyz3[0])/3.,(xyz1[1]+xyz2[1]+xyz3[1])/3.,(xyz1[2]+xyz2[2]+xyz3[2])/3.);
4373 glListBase (1000);
4374 glCallLists (strlen(mess), GL_UNSIGNED_BYTE, mess);
4375 }
4376 }
4377 if (render==2)
4378 {
4379 glDisable(GL_LIGHTING);
4380 glDisable(GL_LIGHT0);
4381 glDisable(GL_LIGHT1);
4382 }
4383 }
4384 //tetra
4385 if (bmaille[2])
4386 {
4387 if (render==1)
4388 {
4389 glColor3f(MainForm->valeurconfig[34],MainForm->valeurconfig[35],MainForm->valeurconfig[36]);
4390 glEnable(GL_DEPTH_TEST);
4391 glEnable(GL_POLYGON_OFFSET_FILL);
4392 glPolygonOffset(1.0,1.0);
4393 glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
4394 glBegin(GL_TRIANGLES);
4395 glEdgeFlag(GL_TRUE);
4396 int nb=lst_tetra_fem.size();
4397 for (int i=0;i<nb;i++)
4398 {
4399 FEM_TETRA* femtet=lst_tetra_fem[i];
4400 if (N12->Checked)
4401 if (!estdansfiltre(femtet->get_id())) continue;
4402 if (CheckListBox1->Checked[(femtet->get_mg_element_maillage()->get_origine()-1000)/10]==false) continue;
4403 BOITE_3D boitmp=femtet->get_boite_3D();
4404 if (!(boitmp*boite2)) continue;
4405 int nb_noeud=femtet->get_nb_fem_noeud();
4406 if (nb_noeud==4)
4407 {
4408 dessinetritetfem(femtet,femtet->get_fem_noeud(0),femtet->get_fem_noeud(1),femtet->get_fem_noeud(2));
4409 dessinetritetfem(femtet,femtet->get_fem_noeud(0),femtet->get_fem_noeud(1),femtet->get_fem_noeud(3));
4410 dessinetritetfem(femtet,femtet->get_fem_noeud(1),femtet->get_fem_noeud(2),femtet->get_fem_noeud(3));
4411 dessinetritetfem(femtet,femtet->get_fem_noeud(2),femtet->get_fem_noeud(0),femtet->get_fem_noeud(3));
4412 }
4413 if (nb_noeud==10)
4414 {
4415 dessinetritetfem(femtet,femtet->get_fem_noeud(0),femtet->get_fem_noeud(1),femtet->get_fem_noeud(5));
4416 dessinetritetfem(femtet,femtet->get_fem_noeud(1),femtet->get_fem_noeud(2),femtet->get_fem_noeud(3));
4417 dessinetritetfem(femtet,femtet->get_fem_noeud(3),femtet->get_fem_noeud(4),femtet->get_fem_noeud(5));
4418 dessinetritetfem(femtet,femtet->get_fem_noeud(1),femtet->get_fem_noeud(3),femtet->get_fem_noeud(5));
4419 dessinetritetfem(femtet,femtet->get_fem_noeud(9),femtet->get_fem_noeud(7),femtet->get_fem_noeud(6));
4420 dessinetritetfem(femtet,femtet->get_fem_noeud(7),femtet->get_fem_noeud(2),femtet->get_fem_noeud(1));
4421 dessinetritetfem(femtet,femtet->get_fem_noeud(1),femtet->get_fem_noeud(0),femtet->get_fem_noeud(6));
4422 dessinetritetfem(femtet,femtet->get_fem_noeud(7),femtet->get_fem_noeud(1),femtet->get_fem_noeud(6));
4423 dessinetritetfem(femtet,femtet->get_fem_noeud(9),femtet->get_fem_noeud(8),femtet->get_fem_noeud(7));
4424 dessinetritetfem(femtet,femtet->get_fem_noeud(8),femtet->get_fem_noeud(4),femtet->get_fem_noeud(3));
4425 dessinetritetfem(femtet,femtet->get_fem_noeud(3),femtet->get_fem_noeud(2),femtet->get_fem_noeud(7));
4426 dessinetritetfem(femtet,femtet->get_fem_noeud(3),femtet->get_fem_noeud(7),femtet->get_fem_noeud(8));
4427 dessinetritetfem(femtet,femtet->get_fem_noeud(9),femtet->get_fem_noeud(6),femtet->get_fem_noeud(8));
4428 dessinetritetfem(femtet,femtet->get_fem_noeud(6),femtet->get_fem_noeud(0),femtet->get_fem_noeud(5));
4429 dessinetritetfem(femtet,femtet->get_fem_noeud(5),femtet->get_fem_noeud(4),femtet->get_fem_noeud(8));
4430 dessinetritetfem(femtet,femtet->get_fem_noeud(5),femtet->get_fem_noeud(8),femtet->get_fem_noeud(6));
4431 }
4432 }
4433 glEnd();
4434 }
4435
4436 glFlush();
4437 if (render==1)
4438 {
4439 glColor3f(MainForm->valeurconfig[37],MainForm->valeurconfig[38],MainForm->valeurconfig[39]);
4440 glLineWidth(MainForm->valeurconfig[40]);
4441 }
4442 else
4443 {
4444 glColor3f(MainForm->valeurconfig[22],MainForm->valeurconfig[23],MainForm->valeurconfig[24]);
4445 glLineWidth(MainForm->valeurconfig[25]);
4446 }
4447 glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
4448 glBegin(GL_LINES);
4449 glEdgeFlag(GL_TRUE);
4450 int nb=lst_tetra_fem.size();
4451 //if (!( (render>0) && (Cacherlemaillageenrendu1->Checked==true)))
4452 {
4453 glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
4454 glBegin(GL_LINES);
4455 glEdgeFlag(GL_TRUE);
4456 for (int i=0;i<nb;i++)
4457 {
4458 if (render==1)
4459 glColor3f(MainForm->valeurconfig[37],MainForm->valeurconfig[38],MainForm->valeurconfig[39]);
4460 else
4461 glColor3f(MainForm->valeurconfig[22],MainForm->valeurconfig[23],MainForm->valeurconfig[24]);
4462 FEM_TETRA* femtet=lst_tetra_fem[i];
4463 BOITE_3D boitmp=femtet->get_boite_3D();
4464 if (N12->Checked)
4465 if (!estdansfiltre(femtet->get_id())) continue;
4466 if (CheckListBox1->Checked[(femtet->get_mg_element_maillage()->get_origine()-1000)/10]==false) continue;
4467 if (!(boitmp*boite2)) continue;
4468 int nb_noeud=femtet->get_nb_fem_noeud();
4469 if ((CheckBox1->Checked==true) && (typesolution!=ENTITE_NOEUD)) femtet->extrapoler_solution_noeud();
4470 if (nb_noeud==4)
4471 {
4472 dessinesegtetfem(femtet,femtet->get_fem_noeud(0),femtet->get_fem_noeud(1));
4473 dessinesegtetfem(femtet,femtet->get_fem_noeud(1),femtet->get_fem_noeud(2));
4474 dessinesegtetfem(femtet,femtet->get_fem_noeud(2),femtet->get_fem_noeud(3));
4475 dessinesegtetfem(femtet,femtet->get_fem_noeud(3),femtet->get_fem_noeud(0));
4476 dessinesegtetfem(femtet,femtet->get_fem_noeud(2),femtet->get_fem_noeud(0));
4477 dessinesegtetfem(femtet,femtet->get_fem_noeud(3),femtet->get_fem_noeud(1));
4478 }
4479 if (nb_noeud==10)
4480 {
4481 dessinesegtetfem(femtet,femtet->get_fem_noeud(0),femtet->get_fem_noeud(1));
4482 dessinesegtetfem(femtet,femtet->get_fem_noeud(1),femtet->get_fem_noeud(2));
4483 dessinesegtetfem(femtet,femtet->get_fem_noeud(2),femtet->get_fem_noeud(3));
4484 dessinesegtetfem(femtet,femtet->get_fem_noeud(3),femtet->get_fem_noeud(4));
4485 dessinesegtetfem(femtet,femtet->get_fem_noeud(4),femtet->get_fem_noeud(5));
4486 dessinesegtetfem(femtet,femtet->get_fem_noeud(5),femtet->get_fem_noeud(0));
4487 dessinesegtetfem(femtet,femtet->get_fem_noeud(0),femtet->get_fem_noeud(6));
4488 dessinesegtetfem(femtet,femtet->get_fem_noeud(6),femtet->get_fem_noeud(9));
4489 dessinesegtetfem(femtet,femtet->get_fem_noeud(2),femtet->get_fem_noeud(7));
4490 dessinesegtetfem(femtet,femtet->get_fem_noeud(7),femtet->get_fem_noeud(9));
4491 dessinesegtetfem(femtet,femtet->get_fem_noeud(4),femtet->get_fem_noeud(8));
4492 dessinesegtetfem(femtet,femtet->get_fem_noeud(8),femtet->get_fem_noeud(9));
4493 }
4494 }
4495 glEnd();
4496 }
4497 if (affmaille)
4498 {
4499 for (int i=0;i<nb;i++)
4500 {
4501 FEM_TETRA* femtet=lst_tetra_fem[i];
4502 if (N12->Checked)
4503 if (!estdansfiltre(femtet->get_id())) continue;
4504 BOITE_3D boitmp=femtet->get_boite_3D();
4505 if (CheckListBox1->Checked[(femtet->get_mg_element_maillage()->get_origine()-1000)/10]==false) continue;
4506 if (!(boitmp*boite2)) continue;
4507 FEM_NOEUD *noeud1,*noeud2,*noeud3,*noeud4;
4508 int nb_noeud=femtet->get_nb_fem_noeud();
4509 if (nb_noeud==4)
4510 {
4511 noeud1=femtet->get_fem_noeud(0);
4512 noeud2=femtet->get_fem_noeud(1);
4513 noeud3=femtet->get_fem_noeud(2);
4514 noeud4=femtet->get_fem_noeud(3);
4515 }
4516 if (nb_noeud==10)
4517 {
4518 noeud1=femtet->get_fem_noeud(0);
4519 noeud2=femtet->get_fem_noeud(2);
4520 noeud3=femtet->get_fem_noeud(4);
4521 noeud4=femtet->get_fem_noeud(9);
4522 }
4523 double *xyz1=noeud1->get_coord();
4524 double *xyz2=noeud2->get_coord();
4525 double *xyz3=noeud3->get_coord();
4526 double *xyz4=noeud4->get_coord();
4527 unsigned long id=femtet->get_id();
4528 char mess[30];
4529 sprintf(mess,"%lu",id);
4530 if ( ((qualite==1)&&(render==0)) || ((qualite==1)&&(render==1) && (MainForm->valeurconfig[56]==0.)))
4531 {
4532 double qual=OPERATEUR::qualite_tetra(xyz1,xyz2,xyz3,xyz4);
4533 if (qual>MainForm->valeurconfig[53]) glColor3f(MainForm->valeurconfig[41],MainForm->valeurconfig[42],MainForm->valeurconfig[43]);
4534 else if (qual>MainForm->valeurconfig[54]) glColor3f(MainForm->valeurconfig[44],MainForm->valeurconfig[45],MainForm->valeurconfig[46]);
4535 else if (qual>MainForm->valeurconfig[55]) glColor3f(MainForm->valeurconfig[47],MainForm->valeurconfig[48],MainForm->valeurconfig[49]);
4536 else glColor3f(MainForm->valeurconfig[50],MainForm->valeurconfig[51],MainForm->valeurconfig[52]);
4537 }
4538 glRasterPos3f((xyz1[0]+xyz2[0]+xyz3[0]+xyz4[0])/4.,(xyz1[1]+xyz2[1]+xyz3[1]+xyz4[1])/4.,(xyz1[2]+xyz2[2]+xyz3[2]+xyz4[2])/4.);
4539 glListBase (1000);
4540 glCallLists (strlen(mess), GL_UNSIGNED_BYTE, mess);
4541 }
4542 }
4543 if (render==2)
4544 {
4545 glDisable(GL_LIGHTING);
4546 glDisable(GL_LIGHT0);
4547 glDisable(GL_LIGHT1);
4548 }
4549 }
4550 }
4551
4552
4553
4554 void __fastcall TVisuWinform::dessinetrifem(FEM_TRIANGLE* femtri,FEM_NOEUD* no1,FEM_NOEUD* no2,FEM_NOEUD* no3)
4555 {
4556 double *xyz1=no1->get_coord();
4557 double *xyz2=no2->get_coord();
4558 double *xyz3=no3->get_coord();
4559 MG_ELEMENT_TOPOLOGIQUE* toposel=NULL;
4560 TColor coul;
4561 if (femtri->get_lien_topologie()!=NULL)
4562 {
4563 std::map<unsigned long,TColor,std::less<unsigned long> >::iterator j=tabcouleur.find(femtri->get_lien_topologie()->get_id());
4564 if (j!=tabcouleur.end())
4565 {
4566 toposel=femtri->get_lien_topologie();
4567 coul=tabcouleur[femtri->get_lien_topologie()->get_id()];
4568 }
4569 }
4570 if ((femtri->get_lien_topologie()==toposel) && (femtri->get_lien_topologie()!=NULL) )
4571 glColor3f((coul & 0x000000FF)/255.,((coul & 0x0000FF00)>>8)/255.,((coul & 0x00FF0000)>>16)/255.);
4572 if (qualite==1)
4573 {
4574 double qual;
4575 if (femtri->get_nb_fem_noeud()==3) qual=OPERATEUR::qualite_triangle(femtri->get_fem_noeud(0)->get_coord(),femtri->get_fem_noeud(1)->get_coord(),femtri->get_fem_noeud(2)->get_coord());
4576 if (femtri->get_nb_fem_noeud()==6) qual=OPERATEUR::qualite_triangle(femtri->get_fem_noeud(0)->get_coord(),femtri->get_fem_noeud(2)->get_coord(),femtri->get_fem_noeud(4)->get_coord());
4577 if (qual>MainForm->valeurconfig[53]) glColor3f(MainForm->valeurconfig[41],MainForm->valeurconfig[42],MainForm->valeurconfig[43]);
4578 else if (qual>MainForm->valeurconfig[54]) glColor3f(MainForm->valeurconfig[44],MainForm->valeurconfig[45],MainForm->valeurconfig[46]);
4579 else if (qual>MainForm->valeurconfig[55]) glColor3f(MainForm->valeurconfig[47],MainForm->valeurconfig[48],MainForm->valeurconfig[49]);
4580 else glColor3f(MainForm->valeurconfig[50],MainForm->valeurconfig[51],MainForm->valeurconfig[52]);
4581 }
4582 if (qualite==2)
4583 {
4584 int pos=(int) ((femtri->get_mg_element_maillage()->get_origine()-1000)/10);
4585 glColor3f(MainForm->valeurconfig[108+3*pos],MainForm->valeurconfig[109+3*pos],MainForm->valeurconfig[110+3*pos]);
4586
4587 }
4588 if (shrink)
4589 {
4590 int nb=femtri->get_nb_fem_noeud();
4591 double xg=0.;
4592 double yg=0.;
4593 double zg=0.;
4594 for (int i=0;i<nb;i++)
4595 {
4596 FEM_NOEUD* no=femtri->get_fem_noeud(i);
4597 xg=xg+no->get_x();
4598 yg=yg+no->get_y();
4599 zg=zg+no->get_z();
4600 }
4601 xg=xg/nb;
4602 yg=yg/nb;
4603 zg=zg/nb;
4604 double x1=xg+facteur_shrink*(xyz1[0]-xg);
4605 double y1=yg+facteur_shrink*(xyz1[1]-yg);
4606 double z1=zg+facteur_shrink*(xyz1[2]-zg);
4607 double x2=xg+facteur_shrink*(xyz2[0]-xg);
4608 double y2=yg+facteur_shrink*(xyz2[1]-yg);
4609 double z2=zg+facteur_shrink*(xyz2[2]-zg);
4610 double x3=xg+facteur_shrink*(xyz3[0]-xg);
4611 double y3=yg+facteur_shrink*(xyz3[1]-yg);
4612 double z3=zg+facteur_shrink*(xyz3[2]-zg);
4613 if (CheckBox1->Checked==true)
4614 {
4615 int pos=(int) ((no1->get_solution()-lmin)*12./(lmax-lmin));
4616 if (pos>11) pos=11;
4617 if (pos<0) pos=0;
4618 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4619 }
4620 glVertex3f(x1,y1,z1);
4621 if (CheckBox1->Checked==true)
4622 {
4623 int pos=(int) ((no3->get_solution()-lmin)*12./(lmax-lmin));
4624 if (pos>11) pos=11;
4625 if (pos<0) pos=0;
4626 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4627 }
4628 glVertex3f(x3,y3,z3);
4629 if (CheckBox1->Checked==true)
4630 {
4631 int pos=(int) ((no2->get_solution()-lmin)*12./(lmax-lmin));
4632 if (pos>11) pos=11;
4633 if (pos<0) pos=0;
4634 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4635 }
4636 glVertex3f(x2,y2,z2);
4637 }
4638 else
4639 {
4640 if (CheckBox1->Checked==true)
4641 {
4642 int pos=(int) ((no1->get_solution()-lmin)*12./(lmax-lmin));
4643 if (pos>11) pos=11;
4644 if (pos<0) pos=0;
4645 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4646 }
4647 glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
4648 if (CheckBox1->Checked==true)
4649 {
4650 int pos=(int) ((no3->get_solution()-lmin)*12./(lmax-lmin));
4651 if (pos>11) pos=11;
4652 if (pos<0) pos=0;
4653 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4654 }
4655 glVertex3f(xyz3[0],xyz3[1],xyz3[2]);
4656 if (CheckBox1->Checked==true)
4657 {
4658 int pos=(int) ((no2->get_solution()-lmin)*12./(lmax-lmin));
4659 if (pos>11) pos=11;
4660 if (pos<0) pos=0;
4661 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4662 }
4663 glVertex3f(xyz2[0],xyz2[1],xyz2[2]);
4664 }
4665 }
4666
4667 void __fastcall TVisuWinform::dessinetritetfem(FEM_TETRA* femtet,FEM_NOEUD* no1,FEM_NOEUD* no2,FEM_NOEUD* no3)
4668 {
4669 double *xyz1=no1->get_coord();
4670 double *xyz2=no2->get_coord();
4671 double *xyz3=no3->get_coord();
4672 MG_ELEMENT_TOPOLOGIQUE* toposel=NULL;
4673 TColor coul;
4674 if (femtet->get_lien_topologie()!=NULL)
4675 {
4676 std::map<unsigned long,TColor,std::less<unsigned long> >::iterator j=tabcouleur.find(femtet->get_lien_topologie()->get_id());
4677 if (j!=tabcouleur.end())
4678 {
4679 toposel=femtet->get_lien_topologie();
4680 coul=tabcouleur[femtet->get_lien_topologie()->get_id()];
4681 }
4682 }
4683
4684 if ((femtet->get_lien_topologie()==toposel) && (femtet->get_lien_topologie()!=NULL) )
4685 glColor3f((coul & 0x000000FF)/255.,((coul & 0x0000FF00)>>8)/255.,((coul & 0x00FF0000)>>16)/255.);
4686 if (qualite==1)
4687 {
4688 double qual;
4689 if (femtet->get_nb_fem_noeud()==4) qual=OPERATEUR::qualite_tetra(femtet->get_fem_noeud(0)->get_coord(),femtet->get_fem_noeud(1)->get_coord(),femtet->get_fem_noeud(2)->get_coord(),femtet->get_fem_noeud(3)->get_coord());
4690 if (femtet->get_nb_fem_noeud()==10) qual=OPERATEUR::qualite_tetra(femtet->get_fem_noeud(0)->get_coord(),femtet->get_fem_noeud(2)->get_coord(),femtet->get_fem_noeud(4)->get_coord(),femtet->get_fem_noeud(9)->get_coord());
4691 if (qual>MainForm->valeurconfig[53]) glColor3f(MainForm->valeurconfig[41],MainForm->valeurconfig[42],MainForm->valeurconfig[43]);
4692 else if (qual>MainForm->valeurconfig[54]) glColor3f(MainForm->valeurconfig[44],MainForm->valeurconfig[45],MainForm->valeurconfig[46]);
4693 else if (qual>MainForm->valeurconfig[55]) glColor3f(MainForm->valeurconfig[47],MainForm->valeurconfig[48],MainForm->valeurconfig[49]);
4694 else glColor3f(MainForm->valeurconfig[50],MainForm->valeurconfig[51],MainForm->valeurconfig[52]);
4695 }
4696 if (qualite==2)
4697 {
4698 int pos=(int) ((femtet->get_mg_element_maillage()->get_origine()-1000)/10);
4699 glColor3f(MainForm->valeurconfig[108+3*pos],MainForm->valeurconfig[109+3*pos],MainForm->valeurconfig[110+3*pos]);
4700
4701 }
4702
4703 if (shrink)
4704 {
4705 int nb=femtet->get_nb_fem_noeud();
4706 double xg=0.;
4707 double yg=0.;
4708 double zg=0.;
4709 for (int i=0;i<nb;i++)
4710 {
4711 FEM_NOEUD* no=femtet->get_fem_noeud(i);
4712 xg=xg+no->get_x();
4713 yg=yg+no->get_y();
4714 zg=zg+no->get_z();
4715 }
4716 xg=xg/nb;
4717 yg=yg/nb;
4718 zg=zg/nb;
4719 double x1=xg+facteur_shrink*(xyz1[0]-xg);
4720 double y1=yg+facteur_shrink*(xyz1[1]-yg);
4721 double z1=zg+facteur_shrink*(xyz1[2]-zg);
4722 double x2=xg+facteur_shrink*(xyz2[0]-xg);
4723 double y2=yg+facteur_shrink*(xyz2[1]-yg);
4724 double z2=zg+facteur_shrink*(xyz2[2]-zg);
4725 double x3=xg+facteur_shrink*(xyz3[0]-xg);
4726 double y3=yg+facteur_shrink*(xyz3[1]-yg);
4727 double z3=zg+facteur_shrink*(xyz3[2]-zg);
4728 if (CheckBox1->Checked==true)
4729 {
4730 int pos=(int) ((no1->get_solution()-lmin)*12./(lmax-lmin));
4731 if (pos>11) pos=11;
4732 if (pos<0) pos=0;
4733 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4734 }
4735 glVertex3f(x1,y1,z1);
4736 if (CheckBox1->Checked==true)
4737 {
4738 int pos=(int) ((no3->get_solution()-lmin)*12./(lmax-lmin));
4739 if (pos>11) pos=11;
4740 if (pos<0) pos=0;
4741 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4742 }
4743 glVertex3f(x3,y3,z3);
4744 if (CheckBox1->Checked==true)
4745 {
4746 int pos=(int) ((no2->get_solution()-lmin)*12./(lmax-lmin));
4747 if (pos>11) pos=11;
4748 if (pos<0) pos=0;
4749 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4750 }
4751 glVertex3f(x2,y2,z2);
4752 }
4753 else
4754 {
4755 if (CheckBox1->Checked==true)
4756 {
4757 int pos=(int) ((no1->get_solution()-lmin)*12./(lmax-lmin));
4758 if (pos>11) pos=11;
4759 if (pos<0) pos=0;
4760 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4761 }
4762 glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
4763 if (CheckBox1->Checked==true)
4764 {
4765 int pos=(int) ((no3->get_solution()-lmin)*12./(lmax-lmin));
4766 if (pos>11) pos=11;
4767 if (pos<0) pos=0;
4768 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4769 }
4770 glVertex3f(xyz3[0],xyz3[1],xyz3[2]);
4771 if (CheckBox1->Checked==true)
4772 {
4773 int pos=(int) ((no2->get_solution()-lmin)*12./(lmax-lmin));
4774 if (pos>11) pos=11;
4775 if (pos<0) pos=0;
4776 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4777 }
4778 glVertex3f(xyz2[0],xyz2[1],xyz2[2]);
4779 }
4780 }
4781 void __fastcall TVisuWinform::dessinesegtetfem(FEM_TETRA* femtet,FEM_NOEUD* no1,FEM_NOEUD* no2)
4782 {
4783 double *xyz1=no1->get_coord();
4784 double *xyz2=no2->get_coord();
4785 MG_ELEMENT_TOPOLOGIQUE* toposel=NULL;
4786 TColor coul;
4787 if (femtet->get_lien_topologie()!=NULL)
4788 {
4789 std::map<unsigned long,TColor,std::less<unsigned long> >::iterator j=tabcouleur.find(femtet->get_lien_topologie()->get_id());
4790 if (j!=tabcouleur.end())
4791 {
4792 toposel=femtet->get_lien_topologie();
4793 coul=tabcouleur[femtet->get_lien_topologie()->get_id()];
4794 }
4795 }
4796 if ((femtet->get_lien_topologie()==toposel) && (femtet->get_lien_topologie()!=NULL) )
4797 glColor3f((coul & 0x000000FF)/255.,((coul & 0x0000FF00)>>8)/255.,((coul & 0x00FF0000)>>16)/255.);
4798 if ( ((qualite==1)&&(render==0)) || ((qualite==1)&&(render==1) && (MainForm->valeurconfig[56]==0.)))
4799 {
4800 double qual;
4801 if (femtet->get_nb_fem_noeud()==4) qual=OPERATEUR::qualite_tetra(femtet->get_fem_noeud(0)->get_coord(),femtet->get_fem_noeud(1)->get_coord(),femtet->get_fem_noeud(2)->get_coord(),femtet->get_fem_noeud(3)->get_coord());
4802 if (femtet->get_nb_fem_noeud()==10) qual=OPERATEUR::qualite_tetra(femtet->get_fem_noeud(0)->get_coord(),femtet->get_fem_noeud(2)->get_coord(),femtet->get_fem_noeud(4)->get_coord(),femtet->get_fem_noeud(9)->get_coord());
4803 if (qual>MainForm->valeurconfig[53]) glColor3f(MainForm->valeurconfig[41],MainForm->valeurconfig[42],MainForm->valeurconfig[43]);
4804 else if (qual>MainForm->valeurconfig[54]) glColor3f(MainForm->valeurconfig[44],MainForm->valeurconfig[45],MainForm->valeurconfig[46]);
4805 else if (qual>MainForm->valeurconfig[55]) glColor3f(MainForm->valeurconfig[47],MainForm->valeurconfig[48],MainForm->valeurconfig[49]);
4806 else glColor3f(MainForm->valeurconfig[50],MainForm->valeurconfig[51],MainForm->valeurconfig[52]);
4807 }
4808 if ( ((qualite==2)&&(render==0)) || ((qualite==2)&&(render==1) && (MainForm->valeurconfig[56]==0.)))
4809 {
4810 int pos=(int) ((femtet->get_mg_element_maillage()->get_origine()-1000)/10);
4811 glColor3f(MainForm->valeurconfig[108+3*pos],MainForm->valeurconfig[109+3*pos],MainForm->valeurconfig[110+3*pos]);
4812
4813 }
4814 if (shrink)
4815 {
4816 int nb=femtet->get_nb_fem_noeud();
4817 double xg=0.;
4818 double yg=0.;
4819 double zg=0.;
4820 for (int i=0;i<nb;i++)
4821 {
4822 FEM_NOEUD* no=femtet->get_fem_noeud(i);
4823 xg=xg+no->get_x();
4824 yg=yg+no->get_y();
4825 zg=zg+no->get_z();
4826 }
4827 xg=xg/nb;
4828 yg=yg/nb;
4829 zg=zg/nb;
4830 double x1=xg+facteur_shrink*(xyz1[0]-xg);
4831 double y1=yg+facteur_shrink*(xyz1[1]-yg);
4832 double z1=zg+facteur_shrink*(xyz1[2]-zg);
4833 double x2=xg+facteur_shrink*(xyz2[0]-xg);
4834 double y2=yg+facteur_shrink*(xyz2[1]-yg);
4835 double z2=zg+facteur_shrink*(xyz2[2]-zg);
4836 if ((CheckBox1->Checked==true) && (CheckBox2->Checked==false))
4837 {
4838 int pos=(int) ((no1->get_solution()-lmin)*12./(lmax-lmin));
4839 if (pos>11) pos=11;
4840 if (pos<0) pos=0;
4841 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4842 }
4843 glVertex3f(x1,y1,z1);
4844 if ((CheckBox1->Checked==true) && (CheckBox2->Checked==false))
4845 {
4846 int pos=(int) ((no2->get_solution()-lmin)*12./(lmax-lmin));
4847 if (pos>11) pos=11;
4848 if (pos<0) pos=0;
4849 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4850 }
4851 glVertex3f(x2,y2,z2);
4852 }
4853 else
4854 {
4855 if ((CheckBox1->Checked==true) && (CheckBox2->Checked==false))
4856 {
4857 int pos=(int) ((no1->get_solution()-lmin)*12./(lmax-lmin));
4858 if (pos>11) pos=11;
4859 if (pos<0) pos=0;
4860 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4861 }
4862 glVertex3f(xyz1[0],xyz1[1],xyz1[2]);
4863 if ((CheckBox1->Checked==true) && (CheckBox2->Checked==false))
4864 {
4865 int pos=(int) ((no2->get_solution()-lmin)*12./(lmax-lmin));
4866 if (pos>11) pos=11;
4867 if (pos<0) pos=0;
4868 glColor3f(RGB_r[pos]/255.,RGB_g[pos]/255.,RGB_b[pos]/255.);
4869 }
4870 glVertex3f(xyz2[0],xyz2[1],xyz2[2]);
4871 }
4872 }
4873 void __fastcall TVisuWinform::Id1Click(TObject *Sender)
4874 {
4875 Id1->Checked=true;
4876 Numero1->Checked=false;
4877 NumeroOptimise1->Checked=false;
4878 }
4879 //---------------------------------------------------------------------------
4880
4881 void __fastcall TVisuWinform::Numero1Click(TObject *Sender)
4882 {
4883 Id1->Checked=false;
4884 Numero1->Checked=true;
4885 NumeroOptimise1->Checked=false;
4886 }
4887 //---------------------------------------------------------------------------
4888
4889 void __fastcall TVisuWinform::NumeroOptimise1Click(TObject *Sender)
4890 {
4891 Id1->Checked=false;
4892 Numero1->Checked=false;
4893 NumeroOptimise1->Checked=true;
4894 }
4895 //---------------------------------------------------------------------------
4896
4897
4898 void __fastcall TVisuWinform::Cartedetaille3Click(TObject *Sender)
4899 {
4900 Tfimcarte *fimcarte=new Tfimcarte(Application,gest);
4901 fimcarte->Caption=Caption;
4902 fimcarte->ComboBox1->Clear();
4903 fimcarte->ComboBox2->Clear();
4904 int nbmai=gest->get_nb_mg_maillage();
4905 for (int i=0;i<nbmai;i++)
4906 {
4907 MG_MAILLAGE* mai=gest->get_mg_maillage(i);
4908 fimcarte->ComboBox1->Items->Add(mai->get_id());
4909 }
4910 int nbmaifem=gest->get_nb_fem_maillage();
4911 for (int i=0;i<nbmaifem;i++)
4912 {
4913 FEM_MAILLAGE* mai=gest->get_fem_maillage(i);
4914 fimcarte->ComboBox2->Items->Add(mai->get_id());
4915 }
4916 fimcarte->Show();
4917 }
4918 //---------------------------------------------------------------------------
4919
4920
4921
4922
4923
4924 void __fastcall TVisuWinform::voirarbreExecute(TObject *Sender)
4925 {
4926 Tfvisuarbre *Child;
4927 Child = new Tfvisuarbre(Application,gest);
4928 Child->Caption=Caption;
4929 }
4930 //---------------------------------------------------------------------------
4931
4932 void __fastcall TVisuWinform::Reconstruction1Click(TObject *Sender)
4933 {
4934 Tfrecons *frecons=new Tfrecons(Application,gest);
4935 frecons->Caption=Caption;
4936 frecons->ListBox1->Clear();
4937 int nbmai=gest->get_nb_fem_maillage();
4938 for (int i=0;i<nbmai;i++)
4939 {
4940 FEM_MAILLAGE* mai=gest->get_fem_maillage(i);
4941 frecons->ListBox1->Items->Add(mai->get_id());
4942 }
4943 frecons->Show();
4944 }
4945 //---------------------------------------------------------------------------
4946
4947 void __fastcall TVisuWinform::N0D1Click(TObject *Sender)
4948 {
4949 N0D1->Checked=!N0D1->Checked;
4950 noeud=0;
4951 if (N0D1->Checked) noeud=noeud+1;
4952 if (N1D1->Checked) noeud=noeud+2;
4953 if (N2D1->Checked) noeud=noeud+4;
4954 if (N3D1->Checked) noeud=noeud+8;
4955 redess();
4956
4957 }
4958 //---------------------------------------------------------------------------
4959
4960
4961 void __fastcall TVisuWinform::maillagegeometrique1Click(TObject *Sender)
4962 {
4963 int nb=gest->get_nb_mg_maillage();
4964 if (nb==0)
4965 {
4966 MessageBox(Handle,"Pas de maillage","Erreur",MB_OK);
4967 return ;
4968 }
4969 char chaine[500];
4970 for (int i=0;i<nb;i++)
4971 {
4972 MG_MAILLAGE* mai=gest->get_mg_maillage(i);
4973 if (i==0) sprintf(chaine,"Maillage %lu|*.*", mai->get_id());
4974 else
4975 {
4976 char chaine2[200];
4977 sprintf(chaine2,"|Maillage %lu|*.*", mai->get_id());
4978 strcat(chaine,chaine2);
4979 }
4980 }
4981 SaveDialog1->Filter=chaine;
4982 if (SaveDialog1->Execute())
4983 {
4984 MG_MAILLAGE* mai=gest->get_mg_maillage(SaveDialog1->FilterIndex-1);
4985 string namefic=SaveDialog1->FileName.c_str();
4986 MG_EXPORT exp;
4987 exp.gmsh(mai,namefic) ;
4988 }
4989 }
4990 //---------------------------------------------------------------------------
4991
4992 void __fastcall TVisuWinform::MaillageEF1Click(TObject *Sender)
4993 {
4994 int nb=gest->get_nb_fem_maillage();
4995 if (nb==0)
4996 {
4997 MessageBox(Handle,"Pas de maillage","Erreur",MB_OK);
4998 return ;
4999 }
5000 char chaine[500];
5001 for (int i=0;i<nb;i++)
5002 {
5003 FEM_MAILLAGE* mai=gest->get_fem_maillage(i);
5004 if (i==0) sprintf(chaine,"Maillage %lu|*.*", mai->get_id());
5005 else
5006 {
5007 char chaine2[200];
5008 sprintf(chaine2,"|Maillage %lu|*.*", mai->get_id());
5009 strcat(chaine,chaine2);
5010 }
5011 }
5012 SaveDialog1->Filter=chaine;
5013 if (SaveDialog1->Execute())
5014 {
5015 FEM_MAILLAGE* mai=gest->get_fem_maillage(SaveDialog1->FilterIndex-1);
5016 string namefic=SaveDialog1->FileName.c_str();
5017 MG_EXPORT exp;
5018 exp.gmsh(mai,namefic) ;
5019 }
5020 }
5021 //---------------------------------------------------------------------------
5022
5023 void __fastcall TVisuWinform::N12Click(TObject *Sender)
5024 {
5025 N12->Checked=!N12->Checked;
5026 TabSheet7->TabVisible=N12->Checked;
5027 redess();
5028 }
5029 //---------------------------------------------------------------------------
5030
5031 void __fastcall TVisuWinform::Button10Click(TObject *Sender)
5032 {
5033 ListBox4->Clear();
5034 filtreid.clear();
5035 redess();
5036 }
5037 //---------------------------------------------------------------------------
5038
5039 void __fastcall TVisuWinform::Button9Click(TObject *Sender)
5040 {
5041 if (ListBox4->ItemIndex==-1) return;
5042 ListBox4->Items->Delete(ListBox4->ItemIndex);
5043 vector<unsigned long>::iterator it=filtreid.begin();
5044 for (int i=0;i<ListBox4->ItemIndex;i++) it++;
5045 filtreid.erase(it);
5046 redess();
5047 }
5048 //---------------------------------------------------------------------------
5049
5050 void __fastcall TVisuWinform::Button8Click(TObject *Sender)
5051 {
5052 static AnsiString InputString = "";
5053 AnsiString InputString2=InputBox("Filtre ID", "ID de l'élément à afficher ?", InputString);
5054 if (InputString2!=InputString)
5055 {
5056 InputString=InputString2;
5057 ListBox4->Items->Add(InputString);
5058 unsigned long id;
5059 sscanf(InputString.c_str(),"%lu",&id);
5060 filtreid.insert(filtreid.end(),id);
5061 redess();
5062 }
5063 }
5064 //---------------------------------------------------------------------------
5065 int __fastcall TVisuWinform::estdansfiltre(unsigned long id)
5066 {
5067 for (vector<unsigned long>::iterator it=filtreid.begin();it!=filtreid.end();it++)
5068 if (*it==id) return 1;
5069 return 0;
5070 }
5071
5072 void __fastcall TVisuWinform::qualiteorigineExecute(TObject *Sender)
5073 {
5074 qualite=2;
5075 redess();
5076 }
5077 //---------------------------------------------------------------------------
5078
5079
5080
5081 void __fastcall TVisuWinform::CheckListBox1Click(TObject *Sender)
5082 {
5083 //initliste();
5084 redess();
5085 }
5086 //---------------------------------------------------------------------------
5087
5088 void __fastcall TVisuWinform::Supprimerlacouleur1Click(TObject *Sender)
5089 {
5090 TTreeNode* node=TreeView1->Selected;
5091 unsigned long id = atol(node->Text.c_str());
5092 if (id==0) return;
5093 std::map<unsigned long,TColor,std::less<unsigned long> >::iterator j=tabcouleur.find(id);
5094 std::map<unsigned long,TTreeNode*,std::less<unsigned long> >::iterator j2=tabnode.find(id);
5095 if (j==tabcouleur.end()) return;
5096 if (j2==tabnode.end()) return;
5097 TreeView1->Canvas->Brush->Color=clWindow;
5098 TRect rec=tabnode[id]->DisplayRect(false);
5099 rec.Right=rec.Left+0.2*rec.Width();
5100 TreeView1->Canvas->FillRect(rec);
5101 tabcouleur.erase(j);
5102 tabnode.erase(j2);
5103 redess();
5104 TreeView1Click(Sender);
5105 ActiveControl=NULL;
5106 }
5107 //---------------------------------------------------------------------------
5108
5109 void __fastcall TVisuWinform::Affecterladernirecouleur1Click(
5110 TObject *Sender)
5111 {
5112 TTreeNode* node=TreeView1->Selected;
5113 unsigned long id = atol(node->Text.c_str());
5114 if (id==0) return;
5115 TColor couleur=ColorDialog1->Color;
5116 std::map<unsigned long,TColor,std::less<unsigned long> >::iterator j=tabcouleur.find(id);
5117 std::map<unsigned long,TTreeNode*,std::less<unsigned long> >::iterator j2=tabnode.find(id);
5118 if (j!=tabcouleur.end())
5119 tabcouleur.erase(j);
5120 if (j2!=tabnode.end())
5121 tabnode.erase(j2);
5122 tabcouleur[id]=couleur;
5123 tabnode[id]=node;
5124 Affecterladernirecouleur1->Visible=true;
5125 TreeView1Click(Sender);
5126 redess();
5127 ActiveControl=NULL;
5128 }
5129 //---------------------------------------------------------------------------
5130
5131
5132
5133
5134 void __fastcall TVisuWinform::TreeView1Click(TObject *Sender)
5135 {
5136 for (std::map<unsigned long,TTreeNode*,std::less<unsigned long> >::iterator j2=tabnode.begin();j2!=tabnode.end();j2++)
5137 {
5138 long id=(*j2).first;
5139 TreeView1->Canvas->Brush->Color=tabcouleur[id];
5140 TRect rec=(*j2).second->DisplayRect(false);
5141 rec.Right=rec.Left+0.1*rec.Width();
5142 TreeView1->Canvas->FillRect(rec);
5143 }
5144 ActiveControl=NULL;
5145
5146 }
5147 //---------------------------------------------------------------------------
5148
5149 void __fastcall TVisuWinform::PageControl1Change(TObject *Sender)
5150 {
5151 TreeView1Click(Sender);
5152 }
5153 //---------------------------------------------------------------------------
5154
5155 void __fastcall TVisuWinform::ActiverlescouleurspourlesentitesCc1Click(
5156 TObject *Sender)
5157 {
5158
5159 int nbgeo=gest->get_nb_mg_geometrie();
5160 for (int i=0;i<nbgeo;i++)
5161 {
5162 MG_GEOMETRIE* geo=gest->get_mg_geometrie(i);
5163 int nbvolume=geo->get_nb_mg_volume();
5164 for (int j=0;j<nbvolume;j++)
5165 {
5166 MG_VOLUME* vol=geo->get_mg_volume(j);
5167 int nbccf=vol->get_nb_ccf();
5168 for (int k=0;k<nbccf;k++)
5169 {
5170 char typeccf[10];
5171 vol->get_type_ccf(k,typeccf);
5172 if (typeccf[0]=='C')
5173 if (typeccf[0]=='c')
5174 {
5175 TColor couleur=0;
5176 double val=vol->get_valeur_ccf(k);
5177 unsigned char *p=(char*)&val;
5178 couleur=couleur+(*p);p++;
5179 couleur=couleur+((*p)<<8);p++;
5180 couleur=couleur+((*p)<<16);
5181 long id=vol->get_id();
5182 std::map<unsigned long,TColor,std::less<unsigned long> >::iterator j=tabcouleur.find(id);
5183 if (j!=tabcouleur.end()) tabcouleur.erase(j);
5184 tabcouleur[id]=couleur;
5185 }
5186 }
5187 }
5188 int nbface=geo->get_nb_mg_face();
5189 for (int j=0;j<nbface;j++)
5190 {
5191 MG_FACE* face=geo->get_mg_face(j);
5192 int nbccf=face->get_nb_ccf();
5193 for (int k=0;k<nbccf;k++)
5194 {
5195 char typeccf[10];
5196 face->get_type_ccf(k,typeccf);
5197 if (typeccf[0]=='C')
5198 if (typeccf[1]=='c')
5199 {
5200 TColor couleur=0;
5201 double val=face->get_valeur_ccf(k);
5202 unsigned char *p=(unsigned char*)&val;
5203 couleur=couleur+(*p);p++;
5204 couleur=couleur+((*p)<<8);p++;
5205 couleur=couleur+((*p)<<16);
5206 long id=face->get_id();
5207 std::map<unsigned long,TColor,std::less<unsigned long> >::iterator j=tabcouleur.find(id);
5208 if (j!=tabcouleur.end()) tabcouleur.erase(j);
5209 tabcouleur[id]=couleur;
5210 }
5211 }
5212 }
5213 int nbarete=geo->get_nb_mg_arete();
5214 for (int j=0;j<nbarete;j++)
5215 {
5216 MG_ARETE* arete=geo->get_mg_arete(j);
5217 int nbccf=arete->get_nb_ccf();
5218 for (int k=0;k<nbccf;k++)
5219 {
5220 char typeccf[10];
5221 arete->get_type_ccf(k,typeccf);
5222 if (typeccf[0]=='C')
5223 if (typeccf[1]=='c')
5224 {
5225 TColor couleur=0;
5226 double val=arete->get_valeur_ccf(k);
5227 unsigned char *p=(unsigned char*)&val;
5228 couleur=couleur+(*p);p++;
5229 couleur=couleur+((*p)<<8);p++;
5230 couleur=couleur+((*p)<<16);
5231 long id=arete->get_id();
5232 std::map<unsigned long,TColor,std::less<unsigned long> >::iterator j=tabcouleur.find(id);
5233 if (j!=tabcouleur.end()) tabcouleur.erase(j);
5234 tabcouleur[id]=couleur;
5235 }
5236 }
5237 }
5238 }
5239
5240 redess();
5241 TreeView1Click(Sender);
5242 ActiveControl=NULL;
5243
5244 }
5245 //---------------------------------------------------------------------------
5246
5247 void __fastcall TVisuWinform::SupprimerlescouleurspourlesentitesCc1Click(
5248 TObject *Sender)
5249 {
5250 int nbgeo=gest->get_nb_mg_geometrie();
5251 for (int i=0;i<nbgeo;i++)
5252 {
5253 MG_GEOMETRIE* geo=gest->get_mg_geometrie(i);
5254 int nbvolume=geo->get_nb_mg_volume();
5255 for (int j=0;j<nbvolume;j++)
5256 {
5257 MG_VOLUME* vol=geo->get_mg_volume(j);
5258 int nbccf=vol->get_nb_ccf();
5259 for (int k=0;k<nbccf;k++)
5260 {
5261 char typeccf[10];
5262 vol->get_type_ccf(k,typeccf);
5263 if (typeccf[0]=='C')
5264 if (typeccf[0]=='c')
5265 {
5266 long id=vol->get_id();
5267 std::map<unsigned long,TColor,std::less<unsigned long> >::iterator j=tabcouleur.find(id);
5268 if (j!=tabcouleur.end()) tabcouleur.erase(j);
5269 std::map<unsigned long,TTreeNode*,std::less<unsigned long> >::iterator j2=tabnode.find(id);
5270 if (j2!=tabnode.end())
5271 {
5272 TreeView1->Canvas->Brush->Color=clWindow;
5273 TRect rec=tabnode[id]->DisplayRect(false);
5274 rec.Right=rec.Left+0.2*rec.Width();
5275 TreeView1->Canvas->FillRect(rec);
5276 tabnode.erase(j2);
5277 }
5278 }
5279 }
5280 }
5281 int nbface=geo->get_nb_mg_face();
5282 for (int j=0;j<nbface;j++)
5283 {
5284 MG_FACE* face=geo->get_mg_face(j);
5285 int nbccf=face->get_nb_ccf();
5286 for (int k=0;k<nbccf;k++)
5287 {
5288 char typeccf[10];
5289 face->get_type_ccf(k,typeccf);
5290 if (typeccf[0]=='C')
5291 if (typeccf[1]=='c')
5292 {
5293 long id=face->get_id();
5294 std::map<unsigned long,TColor,std::less<unsigned long> >::iterator j=tabcouleur.find(id);
5295 if (j!=tabcouleur.end()) tabcouleur.erase(j);
5296 std::map<unsigned long,TTreeNode*,std::less<unsigned long> >::iterator j2=tabnode.find(id);
5297 if (j2!=tabnode.end())
5298 {
5299 TreeView1->Canvas->Brush->Color=clWindow;
5300 TRect rec=tabnode[id]->DisplayRect(false);
5301 rec.Right=rec.Left+0.2*rec.Width();
5302 TreeView1->Canvas->FillRect(rec);
5303 tabnode.erase(j2);
5304 }
5305 }
5306 }
5307 }
5308 int nbarete=geo->get_nb_mg_arete();
5309 for (int j=0;j<nbarete;j++)
5310 {
5311 MG_ARETE* arete=geo->get_mg_arete(j);
5312 int nbccf=arete->get_nb_ccf();
5313 for (int k=0;k<nbccf;k++)
5314 {
5315 char typeccf[10];
5316 arete->get_type_ccf(k,typeccf);
5317 if (typeccf[0]=='C')
5318 if (typeccf[1]=='c')
5319 {
5320 long id=arete->get_id();
5321 std::map<unsigned long,TColor,std::less<unsigned long> >::iterator j=tabcouleur.find(id);
5322 if (j!=tabcouleur.end()) tabcouleur.erase(j);
5323 std::map<unsigned long,TTreeNode*,std::less<unsigned long> >::iterator j2=tabnode.find(id);
5324 if (j2!=tabnode.end())
5325 {
5326 TreeView1->Canvas->Brush->Color=clWindow;
5327 TRect rec=tabnode[id]->DisplayRect(false);
5328 rec.Right=rec.Left+0.2*rec.Width();
5329 TreeView1->Canvas->FillRect(rec);
5330 tabnode.erase(j2);
5331 }
5332 }
5333 }
5334 }
5335 }
5336
5337 redess();
5338 TreeView1Click(Sender);
5339 ActiveControl=NULL;
5340 }
5341 //---------------------------------------------------------------------------
5342
5343
5344
5345 void __fastcall TVisuWinform::Point1Click(TObject *Sender)
5346 {
5347 TTreeNode* node=TreeView1->Selected;
5348 unsigned long id = atol(node->Text.c_str());
5349 if (id==0) return;
5350
5351 MG_ELEMENT_TOPOLOGIQUE* mgtopo=NULL;
5352
5353 int nb_geometrie=gest->get_nb_mg_geometrie();
5354 for (int i=0;i<nb_geometrie && mgtopo==NULL;i++)
5355 {
5356 MG_GEOMETRIE* geotmp=gest->get_mg_geometrie(i);
5357 if (mgtopo==NULL) mgtopo=geotmp->get_mg_faceid(id);
5358 if (mgtopo==NULL) mgtopo=geotmp->get_mg_areteid(id);
5359 if (mgtopo==NULL) mgtopo=geotmp->get_mg_sommetid(id);
5360 }
5361 if (mgtopo==NULL) return;
5362 int nb_point=mgtopo->get_vectorisation().get_nb_points();
5363 Taffmat *child=new Taffmat(Application);
5364 char mess[300];
5365 sprintf(mess,"Vectorisation de l'entité %lu. Les %d points",id,nb_point);
5366 child->Caption=mess;
5367 child->StringGrid1->ColCount=nb_point;
5368 child->StringGrid1->RowCount=5;
5369 child->StringGrid1->FixedRows=1;
5370
5371
5372 vector<OT_VECTEUR_4DD>& liste=mgtopo->get_vectorisation().get_points_controle();
5373 for (int i=0;i<nb_point;i++)
5374 {
5375 sprintf(mess,"Point %d",i+1);
5376 child->StringGrid1->Cells[i][0]=mess;
5377 child->StringGrid1->Cells[i][1]=liste[i].get_x().get_x();
5378 child->StringGrid1->Cells[i][2]=liste[i].get_y().get_x();
5379 child->StringGrid1->Cells[i][3]=liste[i].get_z().get_x();
5380 child->StringGrid1->Cells[i][4]=liste[i].get_w().get_x();
5381 }
5382
5383
5384
5385 }
5386 //---------------------------------------------------------------------------
5387
5388 void __fastcall TVisuWinform::Vecteur1Click(TObject *Sender)
5389 {
5390 TTreeNode* node=TreeView1->Selected;
5391 unsigned long id = atol(node->Text.c_str());
5392 if (id==0) return;
5393
5394 MG_ELEMENT_TOPOLOGIQUE* mgtopo=NULL;
5395
5396 int nb_geometrie=gest->get_nb_mg_geometrie();
5397 for (int i=0;i<nb_geometrie && mgtopo==NULL;i++)
5398 {
5399 MG_GEOMETRIE* geotmp=gest->get_mg_geometrie(i);
5400 if (mgtopo==NULL) mgtopo=geotmp->get_mg_faceid(id);
5401 if (mgtopo==NULL) mgtopo=geotmp->get_mg_areteid(id);
5402 if (mgtopo==NULL) mgtopo=geotmp->get_mg_sommetid(id);
5403 }
5404 if (mgtopo==NULL) return;
5405 std::vector< OT_VECTEUR_4DD > vec=mgtopo->get_vectorisation().get_vecteurs();
5406 Taffmat *child=new Taffmat(Application);
5407 char mess[300];
5408 sprintf(mess,"Vectorisation de l'entité %lu. Les %d vecteurs",id,vec.size());
5409 child->Caption=mess;
5410 child->StringGrid1->ColCount=vec.size();
5411 child->StringGrid1->RowCount=5;
5412 child->StringGrid1->FixedRows=1;
5413
5414
5415 for (int i=0;i<vec.size();i++)
5416 {
5417 sprintf(mess,"Vecteur %d",i+1);
5418 child->StringGrid1->Cells[i][0]=mess;
5419 child->StringGrid1->Cells[i][1]=vec[i].get_x().get_x();
5420 child->StringGrid1->Cells[i][2]=vec[i].get_y().get_x();
5421 child->StringGrid1->Cells[i][3]=vec[i].get_z().get_x();
5422 child->StringGrid1->Cells[i][4]=vec[i].get_w().get_x();
5423 }
5424 }
5425 //---------------------------------------------------------------------------
5426
5427 void __fastcall TVisuWinform::Barycentre1Click(TObject *Sender)
5428 {
5429 TTreeNode* node=TreeView1->Selected;
5430 unsigned long id = atol(node->Text.c_str());
5431 if (id==0) return;
5432
5433 MG_ELEMENT_TOPOLOGIQUE* mgtopo=NULL;
5434
5435 int nb_geometrie=gest->get_nb_mg_geometrie();
5436 for (int i=0;i<nb_geometrie && mgtopo==NULL;i++)
5437 {
5438 MG_GEOMETRIE* geotmp=gest->get_mg_geometrie(i);
5439 if (mgtopo==NULL) mgtopo=geotmp->get_mg_faceid(id);
5440 if (mgtopo==NULL) mgtopo=geotmp->get_mg_areteid(id);
5441 if (mgtopo==NULL) mgtopo=geotmp->get_mg_sommetid(id);
5442 }
5443 if (mgtopo==NULL) return;
5444 OT_TENSEUR ot(4);
5445 ot.identite();
5446 OT_VECTEUR_4DD vec=mgtopo->get_vectorisation().calcule_barycentre(ot) ;
5447 Taffmat *child=new Taffmat(Application);
5448 char mess[300];
5449 sprintf(mess,"Vectorisation de l'entité %lu. Le barycentre",id);
5450 child->Caption=mess;
5451 child->StringGrid1->ColCount=1;
5452 child->StringGrid1->RowCount=5;
5453 child->StringGrid1->FixedRows=1;
5454
5455
5456 sprintf(mess,"Barycentre");
5457 child->StringGrid1->Cells[0][0]=mess;
5458 child->StringGrid1->Cells[0][1]=vec.get_x().get_x();
5459 child->StringGrid1->Cells[0][2]=vec.get_y().get_x();
5460 child->StringGrid1->Cells[0][3]=vec.get_z().get_x();
5461 child->StringGrid1->Cells[0][4]=vec.get_w().get_x();
5462 }
5463 //---------------------------------------------------------------------------
5464
5465 void __fastcall TVisuWinform::Tenseurmtrique1Click(TObject *Sender)
5466 {
5467 TTreeNode* node=TreeView1->Selected;
5468 unsigned long id = atol(node->Text.c_str());
5469 if (id==0) return;
5470
5471 MG_ELEMENT_TOPOLOGIQUE* mgtopo=NULL;
5472
5473 int nb_geometrie=gest->get_nb_mg_geometrie();
5474 for (int i=0;i<nb_geometrie && mgtopo==NULL;i++)
5475 {
5476 MG_GEOMETRIE* geotmp=gest->get_mg_geometrie(i);
5477 if (mgtopo==NULL) mgtopo=geotmp->get_mg_faceid(id);
5478 if (mgtopo==NULL) mgtopo=geotmp->get_mg_areteid(id);
5479 if (mgtopo==NULL) mgtopo=geotmp->get_mg_sommetid(id);
5480 }
5481 if (mgtopo==NULL) return;
5482 OT_TENSEUR tens=mgtopo->get_vectorisation().calcule_tenseur_metrique();
5483 Taffmat *child=new Taffmat(Application);
5484 char mess[300];
5485 sprintf(mess,"Vectorisation de l'entité %lu. Le tenseur métrique",id);
5486 child->Caption=mess;
5487 child->StringGrid1->ColCount=tens.Get_NbCols()+1;
5488 child->StringGrid1->RowCount=tens.Get_NbRows()+1 ;
5489 child->StringGrid1->FixedRows=1;
5490 child->StringGrid1->FixedCols=1;
5491 for (int i=0;i<tens.Get_NbCols() ;i++)
5492 {
5493 char mess[255];
5494 sprintf(mess,"%c%c",i/26+65,i%26+65);
5495 child->StringGrid1->Cells[i+1][0]=mess;
5496 }
5497 for (int i=0;i<tens.Get_NbRows() ;i++)
5498 {
5499 char mess[255];
5500 sprintf(mess,"%c%c",i/26+65,i%26+65);
5501 child->StringGrid1->Cells[0][i+1]=mess;
5502 }
5503
5504 for (int i=0;i<tens.Get_NbCols() ;i++)
5505 for (int j=0;j<tens.Get_NbRows() ;j++)
5506 {
5507 child->StringGrid1->Cells[i+1][j+1]=tens(j,i).get_x();
5508 }
5509 }
5510 //---------------------------------------------------------------------------
5511
5512 void __fastcall TVisuWinform::Tenseurdinertie1Click(TObject *Sender)
5513 {
5514 TTreeNode* node=TreeView1->Selected;
5515 unsigned long id = atol(node->Text.c_str());
5516 if (id==0) return;
5517
5518 MG_ELEMENT_TOPOLOGIQUE* mgtopo=NULL;
5519
5520 int nb_geometrie=gest->get_nb_mg_geometrie();
5521 for (int i=0;i<nb_geometrie && mgtopo==NULL;i++)
5522 {
5523 MG_GEOMETRIE* geotmp=gest->get_mg_geometrie(i);
5524 if (mgtopo==NULL) mgtopo=geotmp->get_mg_faceid(id);
5525 if (mgtopo==NULL) mgtopo=geotmp->get_mg_areteid(id);
5526 if (mgtopo==NULL) mgtopo=geotmp->get_mg_sommetid(id);
5527 }
5528 if (mgtopo==NULL) return;
5529 OT_TENSEUR ot(4);
5530 ot.identite();
5531 OT_TENSEUR tens=mgtopo->get_vectorisation().calcule_tenseur_inertie_au_barycentre(ot);
5532 Taffmat *child=new Taffmat(Application);
5533 char mess[300];
5534 sprintf(mess,"Vectorisation de l'entité %lu. Le tenseur d'inertie dans la base globale",id);
5535 child->Caption=mess;
5536 child->StringGrid1->ColCount=tens.Get_NbCols()+1;
5537 child->StringGrid1->RowCount=tens.Get_NbRows()+1 ;
5538 child->StringGrid1->FixedRows=1;
5539 child->StringGrid1->FixedCols=1;
5540 for (int i=0;i<tens.Get_NbCols() ;i++)
5541 {
5542 char mess[255];
5543 sprintf(mess,"%c%c",i/26+65,i%26+65);
5544 child->StringGrid1->Cells[i+1][0]=mess;
5545 }
5546 for (int i=0;i<tens.Get_NbRows() ;i++)
5547 {
5548 char mess[255];
5549 sprintf(mess,"%c%c",i/26+65,i%26+65);
5550 child->StringGrid1->Cells[0][i+1]=mess;
5551 }
5552
5553 for (int i=0;i<tens.Get_NbCols() ;i++)
5554 for (int j=0;j<tens.Get_NbRows() ;j++)
5555 {
5556 child->StringGrid1->Cells[i+1][j+1]=tens(j,i).get_x();
5557 }
5558
5559 }
5560 //---------------------------------------------------------------------------
5561
5562 void __fastcall TVisuWinform::Tenseurdinertiebaseprincipale1Click(
5563 TObject *Sender)
5564 {
5565 TTreeNode* node=TreeView1->Selected;
5566 unsigned long id = atol(node->Text.c_str());
5567 if (id==0) return;
5568
5569 MG_ELEMENT_TOPOLOGIQUE* mgtopo=NULL;
5570
5571 int nb_geometrie=gest->get_nb_mg_geometrie();
5572 for (int i=0;i<nb_geometrie && mgtopo==NULL;i++)
5573 {
5574 MG_GEOMETRIE* geotmp=gest->get_mg_geometrie(i);
5575 if (mgtopo==NULL) mgtopo=geotmp->get_mg_faceid(id);
5576 if (mgtopo==NULL) mgtopo=geotmp->get_mg_areteid(id);
5577 if (mgtopo==NULL) mgtopo=geotmp->get_mg_sommetid(id);
5578 }
5579 if (mgtopo==NULL) return;
5580 OT_TENSEUR ot(4);
5581 ot.identite();
5582 OT_TENSEUR tens=mgtopo->get_vectorisation().calcule_tenseur_inertie_base_locale(ot);
5583 Taffmat *child=new Taffmat(Application);
5584 char mess[300];
5585 sprintf(mess,"Vectorisation de l'entité %lu. Le tenseur d'inertie dans la base globale",id);
5586 child->Caption=mess;
5587 child->StringGrid1->ColCount=tens.Get_NbCols()+1;
5588 child->StringGrid1->RowCount=tens.Get_NbRows()+1 ;
5589 child->StringGrid1->FixedRows=1;
5590 child->StringGrid1->FixedCols=1;
5591 for (int i=0;i<tens.Get_NbCols() ;i++)
5592 {
5593 char mess[255];
5594 sprintf(mess,"%c%c",i/26+65,i%26+65);
5595 child->StringGrid1->Cells[i+1][0]=mess;
5596 }
5597 for (int i=0;i<tens.Get_NbRows() ;i++)
5598 {
5599 char mess[255];
5600 sprintf(mess,"%c%c",i/26+65,i%26+65);
5601 child->StringGrid1->Cells[0][i+1]=mess;
5602 }
5603
5604 for (int i=0;i<tens.Get_NbCols() ;i++)
5605 for (int j=0;j<tens.Get_NbRows() ;j++)
5606 {
5607 child->StringGrid1->Cells[i+1][j+1]=tens(j,i).get_x();
5608 }
5609 }
5610 //---------------------------------------------------------------------------
5611
5612 void __fastcall TVisuWinform::Point2Click(TObject *Sender)
5613 {
5614 TTreeNode* node=TreeView1->Selected;
5615 unsigned long id = atol(node->Text.c_str());
5616 if (id==0) return;
5617
5618 MG_ELEMENT_TOPOLOGIQUE* mgtopo=NULL;
5619 MG_ELEMENT_GEOMETRIQUE* mggeo=NULL;
5620
5621 int nb_geometrie=gest->get_nb_mg_geometrie();
5622 for (int i=0;i<nb_geometrie && mgtopo==NULL;i++)
5623 {
5624 MG_GEOMETRIE* geotmp=gest->get_mg_geometrie(i);
5625 if (mgtopo==NULL)
5626 {
5627 mgtopo=geotmp->get_mg_faceid(id);
5628 if (mgtopo!=NULL) mggeo=geotmp->get_mg_faceid(id)->get_surface();
5629 }
5630 if (mgtopo==NULL)
5631 {
5632 mgtopo=geotmp->get_mg_areteid(id);
5633 if (mgtopo!=NULL) mggeo=geotmp->get_mg_areteid(id)->get_courbe();
5634 }
5635 if (mgtopo==NULL)
5636 {
5637 mgtopo=geotmp->get_mg_sommetid(id);
5638 if (mgtopo!=NULL) mggeo=geotmp->get_mg_sommetid(id)->get_point();
5639 }
5640 }
5641 if (mgtopo==NULL) return;
5642 int nb_point=mggeo->get_vectorisation().get_nb_points();
5643 Taffmat *child=new Taffmat(Application);
5644 char mess[300];
5645 sprintf(mess,"Vectorisation de l'entité geométrique %lu support de %lu. Les %d points",mggeo->get_id(),id,nb_point);
5646 child->Caption=mess;
5647 child->StringGrid1->ColCount=nb_point;
5648 child->StringGrid1->RowCount=5;
5649 child->StringGrid1->FixedRows=1;
5650
5651
5652 vector<OT_VECTEUR_4DD>& liste=mggeo->get_vectorisation().get_points_controle();
5653 for (int i=0;i<nb_point;i++)
5654 {
5655 sprintf(mess,"Point %d",i+1);
5656 child->StringGrid1->Cells[i][0]=mess;
5657 child->StringGrid1->Cells[i][1]=liste[i].get_x().get_x();
5658 child->StringGrid1->Cells[i][2]=liste[i].get_y().get_x();
5659 child->StringGrid1->Cells[i][3]=liste[i].get_z().get_x();
5660 child->StringGrid1->Cells[i][4]=liste[i].get_w().get_x();
5661 }
5662
5663 }
5664 //---------------------------------------------------------------------------
5665
5666 void __fastcall TVisuWinform::Vecteur2Click(TObject *Sender)
5667 {
5668 TTreeNode* node=TreeView1->Selected;
5669 unsigned long id = atol(node->Text.c_str());
5670 if (id==0) return;
5671
5672 MG_ELEMENT_TOPOLOGIQUE* mgtopo=NULL;
5673 MG_ELEMENT_GEOMETRIQUE* mggeo=NULL;
5674
5675 int nb_geometrie=gest->get_nb_mg_geometrie();
5676 for (int i=0;i<nb_geometrie && mgtopo==NULL;i++)
5677 {
5678 MG_GEOMETRIE* geotmp=gest->get_mg_geometrie(i);
5679 if (mgtopo==NULL)
5680 {
5681 mgtopo=geotmp->get_mg_faceid(id);
5682 if (mgtopo!=NULL) mggeo=geotmp->get_mg_faceid(id)->get_surface();
5683 }
5684 if (mgtopo==NULL)
5685 {
5686 mgtopo=geotmp->get_mg_areteid(id);
5687 if (mgtopo!=NULL) mggeo=geotmp->get_mg_areteid(id)->get_courbe();
5688 }
5689 if (mgtopo==NULL)
5690 {
5691 mgtopo=geotmp->get_mg_sommetid(id);
5692 if (mgtopo!=NULL) mggeo=geotmp->get_mg_sommetid(id)->get_point();
5693 }
5694 }
5695 if (mgtopo==NULL) return;
5696 std::vector< OT_VECTEUR_4DD > vec=mggeo->get_vectorisation().get_vecteurs();
5697 Taffmat *child=new Taffmat(Application);
5698 char mess[300];
5699 sprintf(mess,"Vectorisation de l'entité géométrique %lu support de %lu. Les %d vecteurs",mggeo->get_id(),id,vec.size());
5700 child->Caption=mess;
5701 child->StringGrid1->ColCount=vec.size();
5702 child->StringGrid1->RowCount=5;
5703 child->StringGrid1->FixedRows=1;
5704
5705
5706 for (int i=0;i<vec.size();i++)
5707 {
5708 sprintf(mess,"Vecteur %d",i+1);
5709 child->StringGrid1->Cells[i][0]=mess;
5710 child->StringGrid1->Cells[i][1]=vec[i].get_x().get_x();
5711 child->StringGrid1->Cells[i][2]=vec[i].get_y().get_x();
5712 child->StringGrid1->Cells[i][3]=vec[i].get_z().get_x();
5713 child->StringGrid1->Cells[i][4]=vec[i].get_w().get_x();
5714 }
5715 }
5716 //---------------------------------------------------------------------------
5717
5718 void __fastcall TVisuWinform::Barycentre2Click(TObject *Sender)
5719 {
5720 TTreeNode* node=TreeView1->Selected;
5721 unsigned long id = atol(node->Text.c_str());
5722 if (id==0) return;
5723
5724 MG_ELEMENT_TOPOLOGIQUE* mgtopo=NULL;
5725 MG_ELEMENT_GEOMETRIQUE* mggeo=NULL;
5726
5727 int nb_geometrie=gest->get_nb_mg_geometrie();
5728 for (int i=0;i<nb_geometrie && mgtopo==NULL;i++)
5729 {
5730 MG_GEOMETRIE* geotmp=gest->get_mg_geometrie(i);
5731 if (mgtopo==NULL)
5732 {
5733 mgtopo=geotmp->get_mg_faceid(id);
5734 if (mgtopo!=NULL) mggeo=geotmp->get_mg_faceid(id)->get_surface();
5735 }
5736 if (mgtopo==NULL)
5737 {
5738 mgtopo=geotmp->get_mg_areteid(id);
5739 if (mgtopo!=NULL) mggeo=geotmp->get_mg_areteid(id)->get_courbe();
5740 }
5741 if (mgtopo==NULL)
5742 {
5743 mgtopo=geotmp->get_mg_sommetid(id);
5744 if (mgtopo!=NULL) mggeo=geotmp->get_mg_sommetid(id)->get_point();
5745 }
5746 }
5747 if (mgtopo==NULL) return;
5748 OT_TENSEUR ot(4);
5749 ot.identite();
5750 OT_VECTEUR_4DD vec=mggeo->get_vectorisation().calcule_barycentre(ot) ;
5751 Taffmat *child=new Taffmat(Application);
5752 char mess[300];
5753 sprintf(mess,"Vectorisation de l'entité geometrique %lu support de %lu. Le barycentre",mggeo->get_id(),id);
5754 child->Caption=mess;
5755 child->StringGrid1->ColCount=1;
5756 child->StringGrid1->RowCount=5;
5757 child->StringGrid1->FixedRows=1;
5758
5759
5760 sprintf(mess,"Barycentre");
5761 child->StringGrid1->Cells[0][0]=mess;
5762 child->StringGrid1->Cells[0][1]=vec.get_x().get_x();
5763 child->StringGrid1->Cells[0][2]=vec.get_y().get_x();
5764 child->StringGrid1->Cells[0][3]=vec.get_z().get_x();
5765 child->StringGrid1->Cells[0][4]=vec.get_w().get_x();
5766 }
5767 //---------------------------------------------------------------------------
5768
5769 void __fastcall TVisuWinform::Tenseurmetrique1Click(TObject *Sender)
5770 {
5771 TTreeNode* node=TreeView1->Selected;
5772 unsigned long id = atol(node->Text.c_str());
5773 if (id==0) return;
5774
5775 MG_ELEMENT_TOPOLOGIQUE* mgtopo=NULL;
5776 MG_ELEMENT_GEOMETRIQUE* mggeo=NULL;
5777
5778 int nb_geometrie=gest->get_nb_mg_geometrie();
5779 for (int i=0;i<nb_geometrie && mgtopo==NULL;i++)
5780 {
5781 MG_GEOMETRIE* geotmp=gest->get_mg_geometrie(i);
5782 if (mgtopo==NULL)
5783 {
5784 mgtopo=geotmp->get_mg_faceid(id);
5785 if (mgtopo!=NULL) mggeo=geotmp->get_mg_faceid(id)->get_surface();
5786 }
5787 if (mgtopo==NULL)
5788 {
5789 mgtopo=geotmp->get_mg_areteid(id);
5790 if (mgtopo!=NULL) mggeo=geotmp->get_mg_areteid(id)->get_courbe();
5791 }
5792 if (mgtopo==NULL)
5793 {
5794 mgtopo=geotmp->get_mg_sommetid(id);
5795 if (mgtopo!=NULL) mggeo=geotmp->get_mg_sommetid(id)->get_point();
5796 }
5797 }
5798 if (mgtopo==NULL) return;
5799 OT_TENSEUR tens=mggeo->get_vectorisation().calcule_tenseur_metrique();
5800 Taffmat *child=new Taffmat(Application);
5801 char mess[300];
5802 sprintf(mess,"Vectorisation de l'entité geometrique %lu support de %lu. Le tenseur métrique",mggeo->get_id(),id);
5803 child->Caption=mess;
5804 child->StringGrid1->ColCount=tens.Get_NbCols()+1;
5805 child->StringGrid1->RowCount=tens.Get_NbRows()+1 ;
5806 child->StringGrid1->FixedRows=1;
5807 child->StringGrid1->FixedCols=1;
5808 for (int i=0;i<tens.Get_NbCols() ;i++)
5809 {
5810 char mess[255];
5811 sprintf(mess,"%c%c",i/26+65,i%26+65);
5812 child->StringGrid1->Cells[i+1][0]=mess;
5813 }
5814 for (int i=0;i<tens.Get_NbRows() ;i++)
5815 {
5816 char mess[255];
5817 sprintf(mess,"%c%c",i/26+65,i%26+65);
5818 child->StringGrid1->Cells[0][i+1]=mess;
5819 }
5820
5821 for (int i=0;i<tens.Get_NbCols() ;i++)
5822 for (int j=0;j<tens.Get_NbRows() ;j++)
5823 {
5824 child->StringGrid1->Cells[i+1][j+1]=tens(j,i).get_x();
5825 }
5826 }
5827 //---------------------------------------------------------------------------
5828
5829 void __fastcall TVisuWinform::Tenseurinertieldanslabaseglobale1Click(
5830 TObject *Sender)
5831 {
5832 TTreeNode* node=TreeView1->Selected;
5833 unsigned long id = atol(node->Text.c_str());
5834 if (id==0) return;
5835
5836 MG_ELEMENT_TOPOLOGIQUE* mgtopo=NULL;
5837 MG_ELEMENT_GEOMETRIQUE* mggeo=NULL;
5838
5839 int nb_geometrie=gest->get_nb_mg_geometrie();
5840 for (int i=0;i<nb_geometrie && mgtopo==NULL;i++)
5841 {
5842 MG_GEOMETRIE* geotmp=gest->get_mg_geometrie(i);
5843 if (mgtopo==NULL)
5844 {
5845 mgtopo=geotmp->get_mg_faceid(id);
5846 if (mgtopo!=NULL) mggeo=geotmp->get_mg_faceid(id)->get_surface();
5847 }
5848 if (mgtopo==NULL)
5849 {
5850 mgtopo=geotmp->get_mg_areteid(id);
5851 if (mgtopo!=NULL) mggeo=geotmp->get_mg_areteid(id)->get_courbe();
5852 }
5853 if (mgtopo==NULL)
5854 {
5855 mgtopo=geotmp->get_mg_sommetid(id);
5856 if (mgtopo!=NULL) mggeo=geotmp->get_mg_sommetid(id)->get_point();
5857 }
5858 }
5859 if (mgtopo==NULL) return;
5860 OT_TENSEUR ot(4);
5861 ot.identite();
5862 OT_TENSEUR tens=mggeo->get_vectorisation().calcule_tenseur_inertie_au_barycentre(ot);
5863 Taffmat *child=new Taffmat(Application);
5864 char mess[300];
5865 sprintf(mess,"Vectorisation de l'entité geometrique %lu support de %lu. Le tenseur d'inertie dans la base globale",mggeo->get_id(),id);
5866 child->Caption=mess;
5867 child->StringGrid1->ColCount=tens.Get_NbCols()+1;
5868 child->StringGrid1->RowCount=tens.Get_NbRows()+1 ;
5869 child->StringGrid1->FixedRows=1;
5870 child->StringGrid1->FixedCols=1;
5871 for (int i=0;i<tens.Get_NbCols() ;i++)
5872 {
5873 char mess[255];
5874 sprintf(mess,"%c%c",i/26+65,i%26+65);
5875 child->StringGrid1->Cells[i+1][0]=mess;
5876 }
5877 for (int i=0;i<tens.Get_NbRows() ;i++)
5878 {
5879 char mess[255];
5880 sprintf(mess,"%c%c",i/26+65,i%26+65);
5881 child->StringGrid1->Cells[0][i+1]=mess;
5882 }
5883
5884 for (int i=0;i<tens.Get_NbCols() ;i++)
5885 for (int j=0;j<tens.Get_NbRows() ;j++)
5886 {
5887 child->StringGrid1->Cells[i+1][j+1]=tens(j,i).get_x();
5888 }
5889 }
5890 //---------------------------------------------------------------------------
5891
5892 void __fastcall TVisuWinform::Tenseurinertieldanslabaseprincipale1Click(
5893 TObject *Sender)
5894 {
5895 TTreeNode* node=TreeView1->Selected;
5896 unsigned long id = atol(node->Text.c_str());
5897 if (id==0) return;
5898
5899 MG_ELEMENT_TOPOLOGIQUE* mgtopo=NULL;
5900 MG_ELEMENT_GEOMETRIQUE* mggeo=NULL;
5901
5902 int nb_geometrie=gest->get_nb_mg_geometrie();
5903 for (int i=0;i<nb_geometrie && mgtopo==NULL;i++)
5904 {
5905 MG_GEOMETRIE* geotmp=gest->get_mg_geometrie(i);
5906 if (mgtopo==NULL)
5907 {
5908 mgtopo=geotmp->get_mg_faceid(id);
5909 if (mgtopo!=NULL) mggeo=geotmp->get_mg_faceid(id)->get_surface();
5910 }
5911 if (mgtopo==NULL)
5912 {
5913 mgtopo=geotmp->get_mg_areteid(id);
5914 if (mgtopo!=NULL) mggeo=geotmp->get_mg_areteid(id)->get_courbe();
5915 }
5916 if (mgtopo==NULL)
5917 {
5918 mgtopo=geotmp->get_mg_sommetid(id);
5919 if (mgtopo!=NULL) mggeo=geotmp->get_mg_sommetid(id)->get_point();
5920 }
5921 }
5922 if (mgtopo==NULL) return;
5923 OT_TENSEUR ot(4);
5924 ot.identite();
5925 OT_TENSEUR tens=mggeo->get_vectorisation().calcule_tenseur_inertie_base_locale(ot);
5926 Taffmat *child=new Taffmat(Application);
5927 char mess[300];
5928 sprintf(mess,"Vectorisation de l'entité %lu support de %lu. Le tenseur d'inertie dans la base globale",mggeo->get_id(),id);
5929 child->Caption=mess;
5930 child->StringGrid1->ColCount=tens.Get_NbCols()+1;
5931 child->StringGrid1->RowCount=tens.Get_NbRows()+1 ;
5932 child->StringGrid1->FixedRows=1;
5933 child->StringGrid1->FixedCols=1;
5934 for (int i=0;i<tens.Get_NbCols() ;i++)
5935 {
5936 char mess[255];
5937 sprintf(mess,"%c%c",i/26+65,i%26+65);
5938 child->StringGrid1->Cells[i+1][0]=mess;
5939 }
5940 for (int i=0;i<tens.Get_NbRows() ;i++)
5941 {
5942 char mess[255];
5943 sprintf(mess,"%c%c",i/26+65,i%26+65);
5944 child->StringGrid1->Cells[0][i+1]=mess;
5945 }
5946
5947 for (int i=0;i<tens.Get_NbCols() ;i++)
5948 for (int j=0;j<tens.Get_NbRows() ;j++)
5949 {
5950 child->StringGrid1->Cells[i+1][j+1]=tens(j,i).get_x();
5951 }
5952 }
5953 //---------------------------------------------------------------------------
5954
5955 void __fastcall TVisuWinform::Cacherlemaillageenrendu1Click(
5956 TObject *Sender)
5957 {
5958 Cacherlemaillageenrendu1->Checked=!Cacherlemaillageenrendu1->Checked;
5959 }
5960 //---------------------------------------------------------------------------
5961
5962 void __fastcall TVisuWinform::Button11Click(TObject *Sender)
5963 {
5964 initliste();
5965 redess();
5966 }
5967 //---------------------------------------------------------------------------
5968