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 |
|
|
// magicform.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 "main.h"
|
29 |
|
|
#pragma hdrstop
|
30 |
|
|
|
31 |
|
|
#include "magicform.h"
|
32 |
|
|
#include "tmaille.h"
|
33 |
|
|
//#include "mailleur.h"
|
34 |
|
|
//#include "mailleur2d.h"
|
35 |
|
|
//#include "affiche.h"
|
36 |
|
|
#include "process.h"
|
37 |
|
|
|
38 |
|
|
//---------------------------------------------------------------------------
|
39 |
|
|
#pragma package(smart_init)
|
40 |
|
|
#pragma link "CGAUGES"
|
41 |
|
|
#pragma link "PERFGRAP"
|
42 |
|
|
#pragma resource "*.dfm"
|
43 |
|
|
TVisuMagicform *VisuMagicform;
|
44 |
|
|
//---------------------------------------------------------------------------
|
45 |
|
|
__fastcall TVisuMagicform::TVisuMagicform(TComponent* Owner,TMainForm *win)
|
46 |
|
|
: TForm(Owner),maille_process(NULL),fen(win)
|
47 |
|
|
{
|
48 |
|
|
}
|
49 |
|
|
//---------------------------------------------------------------------------
|
50 |
|
|
void __fastcall TVisuMagicform::FormClose(TObject *Sender,
|
51 |
|
|
TCloseAction &Action)
|
52 |
|
|
{
|
53 |
|
|
Action=caFree;
|
54 |
|
|
}
|
55 |
|
|
//---------------------------------------------------------------------------
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
void __fastcall TVisuMagicform::RadioButton1Click(TObject *Sender)
|
59 |
|
|
{
|
60 |
|
|
GroupBox2->Caption="Carte de taille standard";
|
61 |
|
|
Label2->Caption="Distance maximale";
|
62 |
|
|
Label3->Caption="Epsilon";
|
63 |
|
|
Label2->Visible=true;
|
64 |
|
|
Label3->Visible=true;
|
65 |
|
|
Edit1->Text="";
|
66 |
|
|
Edit2->Text="";
|
67 |
|
|
Edit1->Visible=true;
|
68 |
|
|
Edit2->Visible=true;
|
69 |
|
|
GroupBox2->Visible=true;
|
70 |
|
|
Button1->Enabled=true;
|
71 |
|
|
Button3->Visible=false;
|
72 |
|
|
}
|
73 |
|
|
//---------------------------------------------------------------------------
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
void __fastcall TVisuMagicform::Button1Click(TObject *Sender)
|
77 |
|
|
{
|
78 |
|
|
DWORD type,taille;
|
79 |
|
|
HKEY clef;
|
80 |
|
|
char name[500];
|
81 |
|
|
RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\UQTR\\VMM\\",0,KEY_EXECUTE,&clef);
|
82 |
|
|
RegQueryValueEx(clef,"pathmodule",0,&type,0,&taille);
|
83 |
|
|
RegQueryValueEx(clef,"pathmodule",0,&type,name,&taille);
|
84 |
|
|
strcat(name,"\\mailleur");
|
85 |
|
|
char niveau[2];niveau[1]=0;
|
86 |
|
|
char pm[20];
|
87 |
|
|
sprintf(pm,"%.2f",TrackBar1->Position*0.01);
|
88 |
|
|
if (RadioButton2->Checked) niveau[0]='1';
|
89 |
|
|
if (RadioButton3->Checked) niveau[0]='2';
|
90 |
|
|
if (RadioButton4->Checked) niveau[0]='3';
|
91 |
|
|
if (RadioButton5->Checked)
|
92 |
|
|
{
|
93 |
|
|
niveau[0]='3';
|
94 |
|
|
strcat(name,"erin");
|
95 |
|
|
}
|
96 |
|
|
double eng=atof(Edit1->Text.c_str());
|
97 |
|
|
double eps=atof(Edit2->Text.c_str());
|
98 |
|
|
char nomfichier[500];
|
99 |
|
|
sprintf(nomfichier,"\"%s\"",Caption.c_str());
|
100 |
|
|
char nomfichiercarte[500];
|
101 |
|
|
sprintf(nomfichiercarte,"\"%s\"",Edit1->Text.c_str());
|
102 |
|
|
if (RadioButton1->Checked)
|
103 |
|
|
{
|
104 |
|
|
if (eng<0.000001) MessageBox(Handle,"Mauvaise valeur de distance","Erreur",0);
|
105 |
|
|
else if (eps<0.000001) MessageBox(Handle,"Mauvaise valeur de epsilon","Erreur",0);
|
106 |
|
|
else
|
107 |
|
|
{
|
108 |
|
|
spawnl(P_NOWAIT,name,name,"-magic",nomfichier,"-typecarte","1","-eng",Edit1->Text.c_str(),"-eps",Edit2->Text.c_str(),"-niveau",niveau,"-prioritemetrique",pm,NULL);
|
109 |
|
|
if (fen->fenlog!=NULL)
|
110 |
|
|
{
|
111 |
|
|
char mess[2000];
|
112 |
|
|
sprintf(mess,"%s -magic %s -typecarte 1 -eng %s -eps %s -niveau %s -prioritemetrique %s",name,nomfichier,Edit1->Text.c_str(),Edit2->Text.c_str(),niveau,pm);
|
113 |
|
|
fen->fenlog->ajouter(mess);
|
114 |
|
|
}
|
115 |
|
|
}
|
116 |
|
|
}
|
117 |
|
|
if (RadioButton6->Checked)
|
118 |
|
|
{
|
119 |
|
|
if (Edit1->Text=="") MessageBox(Handle,"Pas de fichier carte de taille","Erreur",0);
|
120 |
|
|
else
|
121 |
|
|
{
|
122 |
|
|
spawnl(P_NOWAIT,name,name,"-magic",nomfichier,"-typecarte","2","-carte",nomfichiercarte,"-niveau",niveau,"-prioritemetrique",pm,NULL);
|
123 |
|
|
if (fen->fenlog!=NULL)
|
124 |
|
|
{
|
125 |
|
|
char mess[2000];
|
126 |
|
|
sprintf(mess,"%s -magic %s -typecarte 2 -carte %s -niveau %s -prioritemetrique %s",name,nomfichier,nomfichiercarte,niveau,pm);
|
127 |
|
|
fen->fenlog->ajouter(mess);
|
128 |
|
|
}
|
129 |
|
|
}
|
130 |
|
|
}
|
131 |
|
|
}
|
132 |
|
|
//---------------------------------------------------------------------------
|
133 |
|
|
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
|
137 |
|
|
|
138 |
|
|
void __fastcall TVisuMagicform::RadioButton6Click(TObject *Sender)
|
139 |
|
|
{
|
140 |
|
|
GroupBox2->Caption="Carte de taille 3D précalculée";
|
141 |
|
|
Label2->Caption="Fichier";
|
142 |
|
|
Label2->Visible=true;
|
143 |
|
|
Label3->Visible=false;
|
144 |
|
|
Edit1->Visible=true;
|
145 |
|
|
Edit2->Visible=false;
|
146 |
|
|
GroupBox2->Visible=true;
|
147 |
|
|
Button1->Enabled=true;
|
148 |
|
|
Button3->Visible=true;
|
149 |
|
|
}
|
150 |
|
|
//---------------------------------------------------------------------------
|
151 |
|
|
|
152 |
|
|
|
153 |
|
|
void __fastcall TVisuMagicform::Button3Click(TObject *Sender)
|
154 |
|
|
{
|
155 |
|
|
if (OpenDialog1->Execute())
|
156 |
|
|
Edit1->Text=OpenDialog1->FileName;
|
157 |
|
|
}
|
158 |
|
|
//---------------------------------------------------------------------------
|
159 |
|
|
|
160 |
|
|
void __fastcall TVisuMagicform::TrackBar1Change(TObject *Sender)
|
161 |
|
|
{
|
162 |
|
|
char mess[30];
|
163 |
|
|
sprintf(mess,"%d\%",TrackBar1->Position);
|
164 |
|
|
Edit7->Text=mess;
|
165 |
|
|
}
|
166 |
|
|
//---------------------------------------------------------------------------
|
167 |
|
|
|
168 |
|
|
void __fastcall TVisuMagicform::Button2Click(TObject *Sender)
|
169 |
|
|
{
|
170 |
|
|
Close();
|
171 |
|
|
}
|
172 |
|
|
//---------------------------------------------------------------------------
|
173 |
|
|
|