1 |
francois |
98 |
//---------------------------------------------------------------------------
|
2 |
|
|
#include "gestionversion.h"
|
3 |
|
|
#include <vcl.h>
|
4 |
|
|
#pragma hdrstop
|
5 |
|
|
|
6 |
|
|
#include "operageo.h"
|
7 |
|
|
#include "mg_file.h"
|
8 |
|
|
#include "vct_multi_modele.h"
|
9 |
|
|
#include "vct_comparaison.h"
|
10 |
|
|
//---------------------------------------------------------------------------
|
11 |
|
|
#pragma package(smart_init)
|
12 |
|
|
#pragma resource "*.dfm"
|
13 |
|
|
Topegeo *opegeo;
|
14 |
|
|
//---------------------------------------------------------------------------
|
15 |
|
|
__fastcall Topegeo::Topegeo(TComponent* Owner)
|
16 |
|
|
: TForm(Owner),gest(NULL)
|
17 |
|
|
{
|
18 |
|
|
}
|
19 |
|
|
//---------------------------------------------------------------------------
|
20 |
|
|
void __fastcall Topegeo::FormClose(TObject *Sender, TCloseAction &Action)
|
21 |
|
|
{
|
22 |
|
|
Action=caFree;
|
23 |
|
|
}
|
24 |
|
|
//---------------------------------------------------------------------------
|
25 |
|
|
void __fastcall Topegeo::Button1Click(TObject *Sender)
|
26 |
|
|
{
|
27 |
|
|
Close();
|
28 |
|
|
}
|
29 |
|
|
//---------------------------------------------------------------------------
|
30 |
|
|
|
31 |
|
|
void __fastcall Topegeo::Button2Click(TObject *Sender)
|
32 |
|
|
{
|
33 |
|
|
if (OpenDialog1->Execute())
|
34 |
|
|
{
|
35 |
|
|
Edit1->Text=OpenDialog1->FileName;
|
36 |
|
|
}
|
37 |
|
|
}
|
38 |
|
|
//---------------------------------------------------------------------------
|
39 |
|
|
|
40 |
|
|
void __fastcall Topegeo::ComboBox1Change(TObject *Sender)
|
41 |
|
|
{
|
42 |
|
|
if (gest->get_nb_mg_maillage()==0)
|
43 |
|
|
if (ComboBox1->Text=="") Button3->Enabled=false; else Button3->Enabled=true;
|
44 |
|
|
}
|
45 |
|
|
//---------------------------------------------------------------------------
|
46 |
|
|
|
47 |
|
|
void __fastcall Topegeo::Edit1Change(TObject *Sender)
|
48 |
|
|
{
|
49 |
|
|
if (gest!=NULL) delete gest;
|
50 |
|
|
Button3->Enabled=false;
|
51 |
|
|
char fichier[500];
|
52 |
|
|
strcpy(fichier,Edit1->Text.c_str());
|
53 |
|
|
gest=new MG_FILE(fichier);
|
54 |
|
|
if (gest->get_code_de_lecture()==0)
|
55 |
|
|
{
|
56 |
|
|
MessageBox(Handle,"Erreur de lecture du fichier","Erreur", MB_OK);
|
57 |
|
|
delete gest;
|
58 |
|
|
gest=NULL;
|
59 |
|
|
Invalidate();
|
60 |
|
|
return;
|
61 |
|
|
}
|
62 |
|
|
ComboBox1->Clear();
|
63 |
|
|
int nbgeo=gest->get_nb_mg_geometrie();
|
64 |
|
|
for (int i=0;i<nbgeo;i++)
|
65 |
|
|
{
|
66 |
|
|
char mess[255];
|
67 |
|
|
sprintf(mess,"%lu",gest->get_mg_geometrie(i)->get_id());
|
68 |
|
|
ComboBox1->Items->Add(mess);
|
69 |
|
|
}
|
70 |
|
|
}
|
71 |
|
|
//---------------------------------------------------------------------------
|
72 |
|
|
|
73 |
|
|
void __fastcall Topegeo::Button4Click(TObject *Sender)
|
74 |
|
|
{
|
75 |
|
|
if (OpenDialog1->Execute())
|
76 |
|
|
{
|
77 |
|
|
Edit2->Text=OpenDialog1->FileName;
|
78 |
|
|
}
|
79 |
|
|
|
80 |
|
|
}
|
81 |
|
|
//---------------------------------------------------------------------------
|
82 |
|
|
|
83 |
|
|
void __fastcall Topegeo::Button5Click(TObject *Sender)
|
84 |
|
|
{
|
85 |
|
|
if (OpenDialog1->Execute())
|
86 |
|
|
{
|
87 |
|
|
Edit3->Text=OpenDialog1->FileName;
|
88 |
|
|
}
|
89 |
|
|
|
90 |
|
|
}
|
91 |
|
|
//---------------------------------------------------------------------------
|
92 |
|
|
|
93 |
|
|
void __fastcall Topegeo::Edit2Change(TObject *Sender)
|
94 |
|
|
{
|
95 |
|
|
if (gest1!=NULL) delete gest1;
|
96 |
|
|
Button6->Enabled=false;
|
97 |
|
|
char fichier[500];
|
98 |
|
|
strcpy(fichier,Edit2->Text.c_str());
|
99 |
|
|
gest1=new MG_FILE(fichier);
|
100 |
|
|
if (gest1->get_code_de_lecture()==0)
|
101 |
|
|
{
|
102 |
|
|
MessageBox(Handle,"Erreur de lecture du fichier","Erreur", MB_OK);
|
103 |
|
|
delete gest1;
|
104 |
|
|
gest1=NULL;
|
105 |
|
|
Invalidate();
|
106 |
|
|
return;
|
107 |
|
|
}
|
108 |
|
|
ComboBox2->Clear();
|
109 |
|
|
int nbgeo=gest1->get_nb_mg_geometrie();
|
110 |
|
|
for (int i=0;i<nbgeo;i++)
|
111 |
|
|
{
|
112 |
|
|
char mess[255];
|
113 |
|
|
sprintf(mess,"%lu",gest1->get_mg_geometrie(i)->get_id());
|
114 |
|
|
ComboBox2->Items->Add(mess);
|
115 |
|
|
}
|
116 |
|
|
|
117 |
|
|
}
|
118 |
|
|
//---------------------------------------------------------------------------
|
119 |
|
|
|
120 |
|
|
void __fastcall Topegeo::Edit3Change(TObject *Sender)
|
121 |
|
|
{
|
122 |
|
|
if (gest2!=NULL) delete gest2;
|
123 |
|
|
Button6->Enabled=false;
|
124 |
|
|
char fichier[500];
|
125 |
|
|
strcpy(fichier,Edit3->Text.c_str());
|
126 |
|
|
gest2=new MG_FILE(fichier);
|
127 |
|
|
if (gest2->get_code_de_lecture()==0)
|
128 |
|
|
{
|
129 |
|
|
MessageBox(Handle,"Erreur de lecture du fichier","Erreur", MB_OK);
|
130 |
|
|
delete gest2;
|
131 |
|
|
gest2=NULL;
|
132 |
|
|
Invalidate();
|
133 |
|
|
return;
|
134 |
|
|
}
|
135 |
|
|
ComboBox3->Clear();
|
136 |
|
|
int nbgeo=gest2->get_nb_mg_geometrie();
|
137 |
|
|
for (int i=0;i<nbgeo;i++)
|
138 |
|
|
{
|
139 |
|
|
char mess[255];
|
140 |
|
|
sprintf(mess,"%lu",gest2->get_mg_geometrie(i)->get_id());
|
141 |
|
|
ComboBox3->Items->Add(mess);
|
142 |
|
|
}
|
143 |
|
|
|
144 |
|
|
|
145 |
|
|
}
|
146 |
|
|
//---------------------------------------------------------------------------
|
147 |
|
|
|
148 |
|
|
void __fastcall Topegeo::ComboBox3Change(TObject *Sender)
|
149 |
|
|
{
|
150 |
|
|
if (GroupBox4->Visible==true)
|
151 |
|
|
if ((ComboBox2->Text=="")||(ComboBox3->Text=="")) Button6->Enabled=false; else Button6->Enabled=true;
|
152 |
|
|
else
|
153 |
|
|
if (ComboBox2->Text=="") Button6->Enabled=false; else Button6->Enabled=true;
|
154 |
|
|
|
155 |
|
|
}
|
156 |
|
|
//---------------------------------------------------------------------------
|
157 |
|
|
|
158 |
|
|
void __fastcall Topegeo::ComboBox2Change(TObject *Sender)
|
159 |
|
|
{
|
160 |
|
|
if (GroupBox4->Visible==true)
|
161 |
|
|
if ((ComboBox2->Text=="")||(ComboBox3->Text=="")) Button6->Enabled=false; else Button6->Enabled=true;
|
162 |
|
|
else
|
163 |
|
|
if (ComboBox2->Text=="") Button6->Enabled=false; else Button6->Enabled=true;
|
164 |
|
|
}
|
165 |
|
|
//---------------------------------------------------------------------------
|
166 |
|
|
|
167 |
|
|
void __fastcall Topegeo::Button3Click(TObject *Sender)
|
168 |
|
|
{
|
169 |
|
|
ListBox1->Items->Add("Fusion d'entité");
|
170 |
|
|
ListBox1->Items->Add("---------------");
|
171 |
|
|
MG_GEOMETRIE* geo=gest->get_mg_geometrie(ComboBox1->ItemIndex);
|
172 |
|
|
int nbface=geo->get_nb_mg_face();
|
173 |
|
|
int nbarete=geo->get_nb_mg_arete();
|
174 |
|
|
int nbsommet=geo->get_nb_mg_sommet();
|
175 |
|
|
VCT_MULTI_MODELE mv(geo);
|
176 |
|
|
mv.recherche_identite();
|
177 |
|
|
nbface=nbface-geo->get_nb_mg_face();
|
178 |
|
|
nbarete=nbarete-geo->get_nb_mg_arete();
|
179 |
|
|
nbsommet=nbsommet-geo->get_nb_mg_sommet();
|
180 |
|
|
char mess[255];
|
181 |
|
|
sprintf(mess," Géometrie numero %lu",geo->get_id());
|
182 |
|
|
ListBox1->Items->Add(mess);
|
183 |
|
|
sprintf(mess," Sommet fusionné : %d",nbsommet);
|
184 |
|
|
ListBox1->Items->Add(mess);
|
185 |
|
|
sprintf(mess," Arete fusionnée : %d",nbarete);
|
186 |
|
|
ListBox1->Items->Add(mess);
|
187 |
|
|
sprintf(mess," Face fusionnée : %d",nbface);
|
188 |
|
|
ListBox1->Items->Add(mess);
|
189 |
|
|
ListBox1->Items->Add(" ");
|
190 |
|
|
ListBox1->Items->Add(" ");
|
191 |
|
|
ListBox1->Items->Add(" ");
|
192 |
|
|
gest->enregistrer(Edit1->Text.c_str());
|
193 |
|
|
}
|
194 |
|
|
//---------------------------------------------------------------------------
|
195 |
|
|
|
196 |
|
|
void __fastcall Topegeo::RadioButton3Click(TObject *Sender)
|
197 |
|
|
{
|
198 |
|
|
GroupBox4->Visible=false;
|
199 |
|
|
}
|
200 |
|
|
//---------------------------------------------------------------------------
|
201 |
|
|
|
202 |
|
|
void __fastcall Topegeo::RadioButton1Click(TObject *Sender)
|
203 |
|
|
{
|
204 |
|
|
GroupBox4->Visible=true;
|
205 |
|
|
|
206 |
|
|
}
|
207 |
|
|
//---------------------------------------------------------------------------
|
208 |
|
|
|
209 |
|
|
void __fastcall Topegeo::RadioButton2Click(TObject *Sender)
|
210 |
|
|
{
|
211 |
|
|
GroupBox4->Visible=true;
|
212 |
|
|
}
|
213 |
|
|
//---------------------------------------------------------------------------
|
214 |
|
|
|
215 |
|
|
void __fastcall Topegeo::Button6Click(TObject *Sender)
|
216 |
|
|
{
|
217 |
|
|
if (RadioButton1->Checked)
|
218 |
|
|
{
|
219 |
|
|
MG_GEOMETRIE* geo1=gest1->get_mg_geometrie(ComboBox2->ItemIndex);
|
220 |
|
|
MG_GEOMETRIE* geo2=gest2->get_mg_geometrie(ComboBox3->ItemIndex);
|
221 |
|
|
VCT_COMPARAISON vct(gest1,geo1,gest2,geo2);
|
222 |
|
|
vct.compare_les_deux_geometries();
|
223 |
|
|
gest1->enregistrer(Edit2->Text.c_str());
|
224 |
|
|
gest2->enregistrer(Edit3->Text.c_str());
|
225 |
|
|
}
|
226 |
|
|
if (RadioButton2->Checked)
|
227 |
|
|
{
|
228 |
|
|
MG_GEOMETRIE* geo1=gest1->get_mg_geometrie(ComboBox2->ItemIndex);
|
229 |
|
|
MG_GEOMETRIE* geo2=gest2->get_mg_geometrie(ComboBox3->ItemIndex);
|
230 |
|
|
VCT_COMPARAISON vct(gest1,geo1,gest2,geo2);
|
231 |
|
|
vct.trouver_les_identites();
|
232 |
|
|
gest1->enregistrer(Edit2->Text.c_str());
|
233 |
|
|
gest2->enregistrer(Edit3->Text.c_str());
|
234 |
|
|
}
|
235 |
|
|
if (RadioButton3->Checked)
|
236 |
|
|
{
|
237 |
|
|
MG_GEOMETRIE* geo1=gest1->get_mg_geometrie(ComboBox2->ItemIndex);
|
238 |
|
|
VCT_COMPARAISON vct(gest1,geo1,NULL,NULL);
|
239 |
|
|
vct.compare_une_geometrie_inertiellement(1);
|
240 |
|
|
gest1->enregistrer(Edit2->Text.c_str());
|
241 |
|
|
}
|
242 |
|
|
if (RadioButton4->Checked)
|
243 |
|
|
{
|
244 |
|
|
MG_GEOMETRIE* geo1=gest1->get_mg_geometrie(ComboBox2->ItemIndex);
|
245 |
|
|
MG_GEOMETRIE* geo2=gest2->get_mg_geometrie(ComboBox3->ItemIndex);
|
246 |
|
|
VCT_COMPARAISON vct(gest1,geo1,gest2,geo2);
|
247 |
|
|
vct.compare_les_deux_geometries_vectoriellement();
|
248 |
|
|
gest1->enregistrer(Edit2->Text.c_str());
|
249 |
|
|
gest2->enregistrer(Edit3->Text.c_str());
|
250 |
|
|
}
|
251 |
|
|
}
|
252 |
|
|
//---------------------------------------------------------------------------
|
253 |
|
|
|
254 |
|
|
void __fastcall Topegeo::RadioButton4Click(TObject *Sender)
|
255 |
|
|
{
|
256 |
|
|
GroupBox4->Visible=true;
|
257 |
|
|
}
|
258 |
|
|
//---------------------------------------------------------------------------
|
259 |
|
|
|