1 |
|
5 |
//------------------------------------------------------------
|
2 |
|
|
//------------------------------------------------------------
|
3 |
|
|
// MAGiC
|
4 |
|
|
// Jean Christophe Cuillière et Vincent FRANCOIS
|
5 |
|
|
// Département de Génie Mécanique - UQTR
|
6 |
|
|
//------------------------------------------------------------
|
7 |
|
|
// Le projet MAGIC est un projet de recherche du département
|
8 |
|
|
// de génie mécanique de l'Université du Québec à
|
9 |
|
|
// Trois Rivières
|
10 |
|
|
// Les librairies ne peuvent être utilisées sans l'accord
|
11 |
|
|
// des auteurs (contact : francois@uqtr.ca)
|
12 |
|
|
//------------------------------------------------------------
|
13 |
|
|
//------------------------------------------------------------
|
14 |
|
|
//
|
15 |
|
|
// ccfwin.cpp
|
16 |
|
|
//
|
17 |
|
|
//------------------------------------------------------------
|
18 |
|
|
//------------------------------------------------------------
|
19 |
|
|
// COPYRIGHT 2000
|
20 |
|
|
// Version du 02/03/2006 à 11H26
|
21 |
|
|
//------------------------------------------------------------
|
22 |
|
|
//------------------------------------------------------------
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
#include "gestionversion.h"
|
26 |
|
|
#include "ccfwin.h"
|
27 |
|
|
#include "mg_file.h"
|
28 |
|
|
|
29 |
|
|
//---------------------------------------------------------------------------
|
30 |
|
|
#pragma package(smart_init)
|
31 |
|
|
#pragma resource "*.dfm"
|
32 |
|
|
Tccfwinform *ccfwinform;
|
33 |
|
|
//---------------------------------------------------------------------------
|
34 |
|
|
__fastcall Tccfwinform::Tccfwinform(TComponent* Owner)
|
35 |
|
|
: TForm(Owner)
|
36 |
|
|
{
|
37 |
|
|
}
|
38 |
|
|
//---------------------------------------------------------------------------
|
39 |
|
|
void __fastcall Tccfwinform::Button2Click(TObject *Sender)
|
40 |
|
|
{
|
41 |
|
|
Close();
|
42 |
|
|
}
|
43 |
|
|
//---------------------------------------------------------------------------
|
44 |
|
|
void __fastcall Tccfwinform::RadioButton1Click(TObject *Sender)
|
45 |
|
|
{
|
46 |
|
|
ComboBox1->Enabled=true;
|
47 |
|
|
ComboBox2->Enabled=false;
|
48 |
|
|
ComboBox3->Enabled=false;
|
49 |
|
|
ComboBox4->Enabled=false;
|
50 |
|
|
}
|
51 |
|
|
//---------------------------------------------------------------------------
|
52 |
|
|
void __fastcall Tccfwinform::RadioButton2Click(TObject *Sender)
|
53 |
|
|
{
|
54 |
|
|
ComboBox1->Enabled=false;
|
55 |
|
|
ComboBox2->Enabled=true;
|
56 |
|
|
ComboBox3->Enabled=false;
|
57 |
|
|
ComboBox4->Enabled=false;
|
58 |
|
|
}
|
59 |
|
|
//---------------------------------------------------------------------------
|
60 |
|
|
void __fastcall Tccfwinform::RadioButton3Click(TObject *Sender)
|
61 |
|
|
{
|
62 |
|
|
ComboBox1->Enabled=false;
|
63 |
|
|
ComboBox2->Enabled=false;
|
64 |
|
|
ComboBox3->Enabled=true;
|
65 |
|
|
ComboBox4->Enabled=false;
|
66 |
|
|
}
|
67 |
|
|
//---------------------------------------------------------------------------
|
68 |
|
|
void __fastcall Tccfwinform::RadioButton4Click(TObject *Sender)
|
69 |
|
|
{
|
70 |
|
|
ComboBox1->Enabled=false;
|
71 |
|
|
ComboBox2->Enabled=false;
|
72 |
|
|
ComboBox3->Enabled=false;
|
73 |
|
|
ComboBox4->Enabled=true;
|
74 |
|
|
}
|
75 |
|
|
//---------------------------------------------------------------------------
|
76 |
|
|
void __fastcall Tccfwinform::active(MG_FILE* gesttmp,char *typeccf)
|
77 |
|
|
{
|
78 |
|
|
gest=gesttmp;
|
79 |
|
|
strcpy(type,typeccf);
|
80 |
|
|
}
|
81 |
|
|
//---------------------------------------------------------------------------
|
82 |
|
|
void __fastcall Tccfwinform::Button1Click(TObject *Sender)
|
83 |
|
|
{
|
84 |
|
|
double valeur=atof(Edit1->Text.c_str());
|
85 |
|
|
if (RadioButton1->Checked==true)
|
86 |
|
|
{
|
87 |
|
|
long id=atol(ComboBox5->Text.c_str());
|
88 |
|
|
MG_GEOMETRIE* mggeo=gest->get_mg_geometrieid(id);
|
89 |
|
|
id=atol(ComboBox1->Text.c_str());
|
90 |
|
|
MG_SOMMET* mgsom=mggeo->get_mg_sommetid(id);
|
91 |
|
|
mgsom->ajouter_ccf(type,valeur);
|
92 |
|
|
}
|
93 |
|
|
if (RadioButton2->Checked==true)
|
94 |
|
|
{
|
95 |
|
|
long id=atol(ComboBox5->Text.c_str());
|
96 |
|
|
MG_GEOMETRIE* mggeo=gest->get_mg_geometrieid(id);
|
97 |
|
|
id=atol(ComboBox2->Text.c_str());
|
98 |
|
|
MG_ARETE* mgare=mggeo->get_mg_areteid(id);
|
99 |
|
|
mgare->ajouter_ccf(type,valeur);
|
100 |
|
|
if (CheckBox1->Checked)
|
101 |
|
|
{
|
102 |
|
|
MG_SOMMET* som=mgare->get_cosommet1()->get_sommet();
|
103 |
|
|
som->ajouter_ccf(type,valeur);
|
104 |
|
|
som=mgare->get_cosommet2()->get_sommet();
|
105 |
|
|
som->ajouter_ccf(type,valeur);
|
106 |
|
|
}
|
107 |
|
|
}
|
108 |
|
|
if (RadioButton3->Checked==true)
|
109 |
|
|
{
|
110 |
|
|
long id=atol(ComboBox5->Text.c_str());
|
111 |
|
|
MG_GEOMETRIE* mggeo=gest->get_mg_geometrieid(id);
|
112 |
|
|
id=atol(ComboBox3->Text.c_str());
|
113 |
|
|
MG_FACE* mgfac=mggeo->get_mg_faceid(id);
|
114 |
|
|
mgfac->ajouter_ccf(type,valeur);
|
115 |
|
|
if (CheckBox2->Checked)
|
116 |
|
|
{
|
117 |
|
|
TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> liste;
|
118 |
|
|
int nbbou=mgfac->get_nb_mg_boucle();
|
119 |
|
|
for (int k=0;k<nbbou;k++)
|
120 |
|
|
{
|
121 |
|
|
MG_BOUCLE* boucle=mgfac->get_mg_boucle(k);
|
122 |
|
|
int nbarete=boucle->get_nb_mg_coarete();
|
123 |
|
|
for (int l=0;l<nbarete;l++)
|
124 |
|
|
{
|
125 |
|
|
MG_ARETE* mgare=boucle->get_mg_coarete(l)->get_arete();
|
126 |
|
|
liste.ajouter(mgare);
|
127 |
|
|
MG_SOMMET* som=mgare->get_cosommet1()->get_sommet();
|
128 |
|
|
liste.ajouter(som);
|
129 |
|
|
som=mgare->get_cosommet2()->get_sommet();
|
130 |
|
|
liste.ajouter(som);
|
131 |
|
|
}
|
132 |
|
|
}
|
133 |
|
|
int nb=liste.get_nb();
|
134 |
|
|
for (int i=0;i<nb;i++)
|
135 |
|
|
liste.get(i)->ajouter_ccf(type,valeur);
|
136 |
|
|
}
|
137 |
|
|
}
|
138 |
|
|
if (RadioButton4->Checked==true)
|
139 |
|
|
{
|
140 |
|
|
long id=atol(ComboBox5->Text.c_str());
|
141 |
|
|
MG_GEOMETRIE* mggeo=gest->get_mg_geometrieid(id);
|
142 |
|
|
id=atol(ComboBox4->Text.c_str());
|
143 |
|
|
MG_VOLUME* mgvol=mggeo->get_mg_volumeid(id);
|
144 |
|
|
mgvol->ajouter_ccf(type,valeur);
|
145 |
|
|
if (CheckBox3->Checked)
|
146 |
|
|
{
|
147 |
|
|
TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> liste;
|
148 |
|
|
int nbcoq=mgvol->get_nb_mg_coquille();
|
149 |
|
|
for (int i=0;i<nbcoq;i++)
|
150 |
|
|
{
|
151 |
|
|
MG_COQUILLE* coq=mgvol->get_mg_coquille(i);
|
152 |
|
|
int nbface=coq->get_nb_mg_coface();
|
153 |
|
|
for (int j=0;j<nbface;j++)
|
154 |
|
|
{
|
155 |
|
|
MG_FACE* mgfac=coq->get_mg_coface(j)->get_face();
|
156 |
|
|
liste.ajouter(mgfac);
|
157 |
|
|
int nbbou=mgfac->get_nb_mg_boucle();
|
158 |
|
|
for (int k=0;k<nbbou;k++)
|
159 |
|
|
{
|
160 |
|
|
MG_BOUCLE* boucle=mgfac->get_mg_boucle(k);
|
161 |
|
|
int nbarete=boucle->get_nb_mg_coarete();
|
162 |
|
|
for (int l=0;l<nbarete;l++)
|
163 |
|
|
{
|
164 |
|
|
MG_ARETE* mgare=boucle->get_mg_coarete(l)->get_arete();
|
165 |
|
|
liste.ajouter(mgare);
|
166 |
|
|
MG_SOMMET* som=mgare->get_cosommet1()->get_sommet();
|
167 |
|
|
liste.ajouter(som);
|
168 |
|
|
som=mgare->get_cosommet2()->get_sommet();
|
169 |
|
|
liste.ajouter(som);
|
170 |
|
|
}
|
171 |
|
|
}
|
172 |
|
|
}
|
173 |
|
|
|
174 |
|
|
}
|
175 |
|
|
int nb=liste.get_nb();
|
176 |
|
|
for (int i=0;i<nb;i++)
|
177 |
|
|
liste.get(i)->ajouter_ccf(type,valeur);
|
178 |
|
|
}
|
179 |
|
|
|
180 |
|
|
}
|
181 |
|
|
gest->enregistrer(Label4->Caption.c_str());
|
182 |
|
|
Close();
|
183 |
|
|
}
|
184 |
|
|
//---------------------------------------------------------------------------
|
185 |
|
|
void __fastcall Tccfwinform::ComboBox5Change(TObject *Sender)
|
186 |
|
|
{
|
187 |
|
|
long id=atol(ComboBox5->Text.c_str());
|
188 |
|
|
MG_GEOMETRIE* mggeo=gest->get_mg_geometrieid(id);
|
189 |
|
|
char mess[30];
|
190 |
|
|
sprintf(mess,"%lu",mggeo->get_id());
|
191 |
|
|
int nb_sommet=mggeo->get_nb_mg_sommet();
|
192 |
|
|
for (int i=0;i<nb_sommet;i++)
|
193 |
|
|
{
|
194 |
|
|
MG_SOMMET* p=mggeo->get_mg_sommet(i);
|
195 |
|
|
char mess[30];
|
196 |
|
|
sprintf(mess,"%lu",p->get_id());
|
197 |
|
|
ComboBox1->Items->Add(mess);
|
198 |
|
|
}
|
199 |
|
|
int nb_arete=mggeo->get_nb_mg_arete();
|
200 |
|
|
for (int i=0;i<nb_arete;i++)
|
201 |
|
|
{
|
202 |
|
|
MG_ARETE* p=mggeo->get_mg_arete(i);
|
203 |
|
|
char mess[30];
|
204 |
|
|
sprintf(mess,"%lu",p->get_id());
|
205 |
|
|
ComboBox2->Items->Add(mess);
|
206 |
|
|
}
|
207 |
|
|
int nb_face=mggeo->get_nb_mg_face();
|
208 |
|
|
for (int i=0;i<nb_face;i++)
|
209 |
|
|
{
|
210 |
|
|
MG_FACE* p=mggeo->get_mg_face(i);
|
211 |
|
|
char mess[30];
|
212 |
|
|
sprintf(mess,"%lu",p->get_id());
|
213 |
|
|
ComboBox3->Items->Add(mess);
|
214 |
|
|
}
|
215 |
|
|
int nb_volume=mggeo->get_nb_mg_volume();
|
216 |
|
|
for (int i=0;i<nb_volume;i++)
|
217 |
|
|
{
|
218 |
|
|
MG_VOLUME* p=mggeo->get_mg_volume(i);
|
219 |
|
|
char mess[30];
|
220 |
|
|
sprintf(mess,"%lu",p->get_id());
|
221 |
|
|
ComboBox4->Items->Add(mess);
|
222 |
|
|
}
|
223 |
|
|
|
224 |
|
|
}
|
225 |
|
|
//---------------------------------------------------------------------------
|
226 |
|
|
|