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 |
francois |
188 |
#include "visuwin.h"
|
29 |
|
5 |
|
30 |
francois |
188 |
|
31 |
|
5 |
//---------------------------------------------------------------------------
|
32 |
|
|
#pragma package(smart_init)
|
33 |
|
|
#pragma resource "*.dfm"
|
34 |
|
|
Tccfwinform *ccfwinform;
|
35 |
|
|
//---------------------------------------------------------------------------
|
36 |
francois |
188 |
__fastcall Tccfwinform::Tccfwinform(TComponent* Owner,TVisuWinform *fen)
|
37 |
|
|
: TForm(Owner),fenp(fen)
|
38 |
|
5 |
{
|
39 |
|
|
}
|
40 |
|
|
//---------------------------------------------------------------------------
|
41 |
|
|
void __fastcall Tccfwinform::Button2Click(TObject *Sender)
|
42 |
|
|
{
|
43 |
|
|
Close();
|
44 |
|
|
}
|
45 |
|
|
//---------------------------------------------------------------------------
|
46 |
|
|
void __fastcall Tccfwinform::RadioButton1Click(TObject *Sender)
|
47 |
|
|
{
|
48 |
|
|
ComboBox1->Enabled=true;
|
49 |
|
|
ComboBox2->Enabled=false;
|
50 |
|
|
ComboBox3->Enabled=false;
|
51 |
|
|
ComboBox4->Enabled=false;
|
52 |
|
|
}
|
53 |
|
|
//---------------------------------------------------------------------------
|
54 |
|
|
void __fastcall Tccfwinform::RadioButton2Click(TObject *Sender)
|
55 |
|
|
{
|
56 |
|
|
ComboBox1->Enabled=false;
|
57 |
|
|
ComboBox2->Enabled=true;
|
58 |
|
|
ComboBox3->Enabled=false;
|
59 |
|
|
ComboBox4->Enabled=false;
|
60 |
|
|
}
|
61 |
|
|
//---------------------------------------------------------------------------
|
62 |
|
|
void __fastcall Tccfwinform::RadioButton3Click(TObject *Sender)
|
63 |
|
|
{
|
64 |
|
|
ComboBox1->Enabled=false;
|
65 |
|
|
ComboBox2->Enabled=false;
|
66 |
|
|
ComboBox3->Enabled=true;
|
67 |
|
|
ComboBox4->Enabled=false;
|
68 |
|
|
}
|
69 |
|
|
//---------------------------------------------------------------------------
|
70 |
|
|
void __fastcall Tccfwinform::RadioButton4Click(TObject *Sender)
|
71 |
|
|
{
|
72 |
|
|
ComboBox1->Enabled=false;
|
73 |
|
|
ComboBox2->Enabled=false;
|
74 |
|
|
ComboBox3->Enabled=false;
|
75 |
|
|
ComboBox4->Enabled=true;
|
76 |
|
|
}
|
77 |
|
|
//---------------------------------------------------------------------------
|
78 |
|
|
void __fastcall Tccfwinform::active(MG_FILE* gesttmp,char *typeccf)
|
79 |
|
|
{
|
80 |
|
|
gest=gesttmp;
|
81 |
|
|
strcpy(type,typeccf);
|
82 |
|
|
}
|
83 |
|
|
//---------------------------------------------------------------------------
|
84 |
|
|
void __fastcall Tccfwinform::Button1Click(TObject *Sender)
|
85 |
|
|
{
|
86 |
|
|
double valeur=atof(Edit1->Text.c_str());
|
87 |
|
|
if (RadioButton1->Checked==true)
|
88 |
|
|
{
|
89 |
|
|
long id=atol(ComboBox5->Text.c_str());
|
90 |
|
|
MG_GEOMETRIE* mggeo=gest->get_mg_geometrieid(id);
|
91 |
|
|
id=atol(ComboBox1->Text.c_str());
|
92 |
|
|
MG_SOMMET* mgsom=mggeo->get_mg_sommetid(id);
|
93 |
|
|
mgsom->ajouter_ccf(type,valeur);
|
94 |
|
|
}
|
95 |
|
|
if (RadioButton2->Checked==true)
|
96 |
|
|
{
|
97 |
|
|
long id=atol(ComboBox5->Text.c_str());
|
98 |
|
|
MG_GEOMETRIE* mggeo=gest->get_mg_geometrieid(id);
|
99 |
|
|
id=atol(ComboBox2->Text.c_str());
|
100 |
|
|
MG_ARETE* mgare=mggeo->get_mg_areteid(id);
|
101 |
|
|
mgare->ajouter_ccf(type,valeur);
|
102 |
|
|
if (CheckBox1->Checked)
|
103 |
|
|
{
|
104 |
|
|
MG_SOMMET* som=mgare->get_cosommet1()->get_sommet();
|
105 |
|
|
som->ajouter_ccf(type,valeur);
|
106 |
|
|
som=mgare->get_cosommet2()->get_sommet();
|
107 |
|
|
som->ajouter_ccf(type,valeur);
|
108 |
|
|
}
|
109 |
|
|
}
|
110 |
|
|
if (RadioButton3->Checked==true)
|
111 |
|
|
{
|
112 |
|
|
long id=atol(ComboBox5->Text.c_str());
|
113 |
|
|
MG_GEOMETRIE* mggeo=gest->get_mg_geometrieid(id);
|
114 |
|
|
id=atol(ComboBox3->Text.c_str());
|
115 |
|
|
MG_FACE* mgfac=mggeo->get_mg_faceid(id);
|
116 |
|
|
mgfac->ajouter_ccf(type,valeur);
|
117 |
|
|
if (CheckBox2->Checked)
|
118 |
|
|
{
|
119 |
|
|
TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> liste;
|
120 |
|
|
int nbbou=mgfac->get_nb_mg_boucle();
|
121 |
|
|
for (int k=0;k<nbbou;k++)
|
122 |
|
|
{
|
123 |
|
|
MG_BOUCLE* boucle=mgfac->get_mg_boucle(k);
|
124 |
|
|
int nbarete=boucle->get_nb_mg_coarete();
|
125 |
|
|
for (int l=0;l<nbarete;l++)
|
126 |
|
|
{
|
127 |
|
|
MG_ARETE* mgare=boucle->get_mg_coarete(l)->get_arete();
|
128 |
|
|
liste.ajouter(mgare);
|
129 |
|
|
MG_SOMMET* som=mgare->get_cosommet1()->get_sommet();
|
130 |
|
|
liste.ajouter(som);
|
131 |
|
|
som=mgare->get_cosommet2()->get_sommet();
|
132 |
|
|
liste.ajouter(som);
|
133 |
|
|
}
|
134 |
|
|
}
|
135 |
|
|
int nb=liste.get_nb();
|
136 |
|
|
for (int i=0;i<nb;i++)
|
137 |
|
|
liste.get(i)->ajouter_ccf(type,valeur);
|
138 |
|
|
}
|
139 |
|
|
}
|
140 |
|
|
if (RadioButton4->Checked==true)
|
141 |
|
|
{
|
142 |
|
|
long id=atol(ComboBox5->Text.c_str());
|
143 |
|
|
MG_GEOMETRIE* mggeo=gest->get_mg_geometrieid(id);
|
144 |
|
|
id=atol(ComboBox4->Text.c_str());
|
145 |
|
|
MG_VOLUME* mgvol=mggeo->get_mg_volumeid(id);
|
146 |
|
|
mgvol->ajouter_ccf(type,valeur);
|
147 |
|
|
if (CheckBox3->Checked)
|
148 |
|
|
{
|
149 |
|
|
TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> liste;
|
150 |
|
|
int nbcoq=mgvol->get_nb_mg_coquille();
|
151 |
|
|
for (int i=0;i<nbcoq;i++)
|
152 |
|
|
{
|
153 |
|
|
MG_COQUILLE* coq=mgvol->get_mg_coquille(i);
|
154 |
|
|
int nbface=coq->get_nb_mg_coface();
|
155 |
|
|
for (int j=0;j<nbface;j++)
|
156 |
|
|
{
|
157 |
|
|
MG_FACE* mgfac=coq->get_mg_coface(j)->get_face();
|
158 |
|
|
liste.ajouter(mgfac);
|
159 |
|
|
int nbbou=mgfac->get_nb_mg_boucle();
|
160 |
|
|
for (int k=0;k<nbbou;k++)
|
161 |
|
|
{
|
162 |
|
|
MG_BOUCLE* boucle=mgfac->get_mg_boucle(k);
|
163 |
|
|
int nbarete=boucle->get_nb_mg_coarete();
|
164 |
|
|
for (int l=0;l<nbarete;l++)
|
165 |
|
|
{
|
166 |
|
|
MG_ARETE* mgare=boucle->get_mg_coarete(l)->get_arete();
|
167 |
|
|
liste.ajouter(mgare);
|
168 |
|
|
MG_SOMMET* som=mgare->get_cosommet1()->get_sommet();
|
169 |
|
|
liste.ajouter(som);
|
170 |
|
|
som=mgare->get_cosommet2()->get_sommet();
|
171 |
|
|
liste.ajouter(som);
|
172 |
|
|
}
|
173 |
|
|
}
|
174 |
|
|
}
|
175 |
|
|
|
176 |
|
|
}
|
177 |
|
|
int nb=liste.get_nb();
|
178 |
|
|
for (int i=0;i<nb;i++)
|
179 |
|
|
liste.get(i)->ajouter_ccf(type,valeur);
|
180 |
|
|
}
|
181 |
|
|
|
182 |
|
|
}
|
183 |
|
|
gest->enregistrer(Label4->Caption.c_str());
|
184 |
|
|
Close();
|
185 |
|
|
}
|
186 |
|
|
//---------------------------------------------------------------------------
|
187 |
|
|
void __fastcall Tccfwinform::ComboBox5Change(TObject *Sender)
|
188 |
|
|
{
|
189 |
|
|
long id=atol(ComboBox5->Text.c_str());
|
190 |
|
|
MG_GEOMETRIE* mggeo=gest->get_mg_geometrieid(id);
|
191 |
|
|
char mess[30];
|
192 |
|
|
sprintf(mess,"%lu",mggeo->get_id());
|
193 |
|
|
int nb_sommet=mggeo->get_nb_mg_sommet();
|
194 |
|
|
for (int i=0;i<nb_sommet;i++)
|
195 |
|
|
{
|
196 |
|
|
MG_SOMMET* p=mggeo->get_mg_sommet(i);
|
197 |
|
|
char mess[30];
|
198 |
|
|
sprintf(mess,"%lu",p->get_id());
|
199 |
|
|
ComboBox1->Items->Add(mess);
|
200 |
|
|
}
|
201 |
|
|
int nb_arete=mggeo->get_nb_mg_arete();
|
202 |
|
|
for (int i=0;i<nb_arete;i++)
|
203 |
|
|
{
|
204 |
|
|
MG_ARETE* p=mggeo->get_mg_arete(i);
|
205 |
|
|
char mess[30];
|
206 |
|
|
sprintf(mess,"%lu",p->get_id());
|
207 |
|
|
ComboBox2->Items->Add(mess);
|
208 |
|
|
}
|
209 |
|
|
int nb_face=mggeo->get_nb_mg_face();
|
210 |
|
|
for (int i=0;i<nb_face;i++)
|
211 |
|
|
{
|
212 |
|
|
MG_FACE* p=mggeo->get_mg_face(i);
|
213 |
|
|
char mess[30];
|
214 |
|
|
sprintf(mess,"%lu",p->get_id());
|
215 |
|
|
ComboBox3->Items->Add(mess);
|
216 |
|
|
}
|
217 |
|
|
int nb_volume=mggeo->get_nb_mg_volume();
|
218 |
|
|
for (int i=0;i<nb_volume;i++)
|
219 |
|
|
{
|
220 |
|
|
MG_VOLUME* p=mggeo->get_mg_volume(i);
|
221 |
|
|
char mess[30];
|
222 |
|
|
sprintf(mess,"%lu",p->get_id());
|
223 |
|
|
ComboBox4->Items->Add(mess);
|
224 |
|
|
}
|
225 |
|
|
|
226 |
|
|
}
|
227 |
|
|
//---------------------------------------------------------------------------
|
228 |
|
|
|
229 |
francois |
188 |
void __fastcall Tccfwinform::FormClose(TObject *Sender,
|
230 |
|
|
TCloseAction &Action)
|
231 |
|
|
{
|
232 |
|
|
Action=caFree;
|
233 |
|
|
}
|
234 |
|
|
//---------------------------------------------------------------------------
|
235 |
|
|
|
236 |
|
|
|
237 |
|
|
void __fastcall Tccfwinform::BitBtn1Click(TObject *Sender)
|
238 |
|
|
{
|
239 |
|
|
char mess[255],mot1[255],mot2[255];
|
240 |
|
|
strcpy(mess,fenp->ComboBox4->Text.c_str());
|
241 |
|
|
int num=sscanf(mess,"%s %s",mot1,mot2);
|
242 |
|
|
if (num==2)
|
243 |
|
|
{
|
244 |
|
|
int num2=ComboBox3->Items->Count;
|
245 |
|
|
for (int i=0;i<num2;i++)
|
246 |
|
|
if (strcmp(mot2,ComboBox3->Items->Strings[i].c_str())==0) {ComboBox3->ItemIndex=i;RadioButton3->Checked=true;break;}
|
247 |
|
|
}
|
248 |
|
|
}
|
249 |
|
|
//---------------------------------------------------------------------------
|
250 |
|
|
|
251 |
|
|
void __fastcall Tccfwinform::BitBtn2Click(TObject *Sender)
|
252 |
|
|
{
|
253 |
|
|
char mess[255],mot1[255],mot2[255];
|
254 |
|
|
strcpy(mess,fenp->ComboBox4->Text.c_str());
|
255 |
|
|
int num=sscanf(mess,"%s %s",mot1,mot2);
|
256 |
|
|
if (num==2)
|
257 |
|
|
{
|
258 |
|
|
int num2=ComboBox4->Items->Count;
|
259 |
|
|
for (int i=0;i<num2;i++)
|
260 |
|
|
if (strcmp(mot2,ComboBox4->Items->Strings[i].c_str())==0) {ComboBox4->ItemIndex=i;RadioButton4->Checked=true;break;}
|
261 |
|
|
}
|
262 |
|
|
|
263 |
|
|
}
|
264 |
|
|
//---------------------------------------------------------------------------
|
265 |
|
|
|
266 |
|
|
void __fastcall Tccfwinform::BitBtn3Click(TObject *Sender)
|
267 |
|
|
{
|
268 |
|
|
char mess[255],mot1[255],mot2[255];
|
269 |
|
|
strcpy(mess,fenp->ComboBox4->Text.c_str());
|
270 |
|
|
int num=sscanf(mess,"%s %s",mot1,mot2);
|
271 |
|
|
if (num==2)
|
272 |
|
|
{
|
273 |
|
|
int num2=ComboBox2->Items->Count;
|
274 |
|
|
for (int i=0;i<num2;i++)
|
275 |
|
|
if (strcmp(mot2,ComboBox2->Items->Strings[i].c_str())==0) {ComboBox2->ItemIndex=i;RadioButton2->Checked=true;break;}
|
276 |
|
|
}
|
277 |
|
|
|
278 |
|
|
}
|
279 |
|
|
//---------------------------------------------------------------------------
|
280 |
|
|
|
281 |
|
|
void __fastcall Tccfwinform::BitBtn4Click(TObject *Sender)
|
282 |
|
|
{
|
283 |
|
|
char mess[255],mot1[255],mot2[255];
|
284 |
|
|
strcpy(mess,fenp->ComboBox4->Text.c_str());
|
285 |
|
|
int num=sscanf(mess,"%s %s",mot1,mot2);
|
286 |
|
|
if (num==2)
|
287 |
|
|
{
|
288 |
|
|
int num2=ComboBox1->Items->Count;
|
289 |
|
|
for (int i=0;i<num2;i++)
|
290 |
|
|
if (strcmp(mot2,ComboBox1->Items->Strings[i].c_str())==0) {ComboBox1->ItemIndex=i;RadioButton1->Checked=true;break;}
|
291 |
|
|
}
|
292 |
|
|
|
293 |
|
|
}
|
294 |
|
|
//---------------------------------------------------------------------------
|
295 |
|
|
|