ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/app/carte/src/main.cpp
Revision: 5
Committed: Tue Jun 12 20:26:34 2007 UTC (18 years, 2 months ago)
Original Path: magic/app/carte/carte/src/main.cpp
File size: 4634 byte(s)
Log Message:

File Contents

# User Rev Content
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     // main.cpp
16     //
17     //------------------------------------------------------------
18     //------------------------------------------------------------
19     // COPYRIGHT 2000
20     // Version du 02/03/2006 à 11H25
21     //------------------------------------------------------------
22     //------------------------------------------------------------
23    
24    
25    
26    
27     #include "gestionversion.h"
28     #ifdef WINDOWS_VERSION
29     #include "fenetre.h"
30     #endif
31    
32     #pragma hdrstop
33     #include "mg_file.h"
34     #include "main.h"
35     #include "fct_generateur_frontiere.h"
36     #include "fct_generateur_constante.h"
37     #include "fct_generateur_fichier.h"
38    
39     //---------------------------------------------------------------------------
40    
41     void affiche(char* message)
42     {
43     #ifdef WINDOWS_VERSION
44     Form1->Memo1->Lines->Add(message);
45     #else
46     std::cout << message << std::endl;
47     #endif
48     }
49    
50    
51    
52     #ifdef WINDOWS_VERSION
53     int amain(int argc,char **argv)
54     #else
55     int main(int argc,char **argv)
56     #endif
57     {
58     if (argc<3) return 1;
59     char nomfichier[500];
60     char nomfichiersortie[500];
61     char nomfichierpoint[500]={""};;
62     double eng,eps,ind2;
63     int ind1,typecarte=-1;
64     int fechan,festim;
65    
66     for (int i=0;i<argc;i++)
67     {
68     if (strcmp(argv[i],"-fichier")==0) strcpy(nomfichier,argv[i+1]);
69     if (strcmp(argv[i],"-fichout")==0) strcpy(nomfichiersortie,argv[i+1]);
70     if (strcmp(argv[i],"-point")==0) strcpy(nomfichierpoint,argv[i+1]);
71     if (strcmp(argv[i],"-dg")==0) eng=atof(argv[i+1]);
72     if (strcmp(argv[i],"-eps")==0) eps=atof(argv[i+1]);
73     if (strcmp(argv[i],"-taillezone")==0) ind1=atoi(argv[i+1]);
74     if (strcmp(argv[i],"-tauxtransfert")==0) ind2=atof(argv[i+1]);
75     if (strcmp(argv[i],"-typecarte")==0) typecarte=atoi(argv[i+1]);
76     if (strcmp(argv[i],"-fechantillonage")==0) fechan=atoi(argv[i+1]);
77     if (strcmp(argv[i],"-festimation")==0) festim=atoi(argv[i+1]);
78     }
79    
80     if (typecarte==1)
81     {
82     affiche("Génération de carte de taille");
83     affiche("Lecture du fichier");
84     MG_FILE gest(nomfichier);
85     int nbptctl=0;
86     double *ptctl=NULL;
87     char mess[255];
88     FILE* in=fopen(nomfichierpoint,"rt");
89     if (in!=NULL)
90     {
91     affiche("Lecture du fichier de points de controles");
92     char mess[255];
93     fgets(mess,255,in);
94     sscanf(mess,"%d",&nbptctl);
95     ptctl=new double[4*nbptctl];
96     for (int i=0;i<nbptctl;i++)
97     {
98     fgets(mess,255,in);
99     sscanf(mess,"%lf %lf %lf %lf",ptctl+4*i,ptctl+4*i+1,ptctl+4*i+2,ptctl+4*i+3);
100     }
101     fclose(in);
102     }
103     FCT_GENERATEUR_FRONTIERE carte(gest,eng,eps,ind1,ind2,ptctl,nbptctl);
104     affiche("Construction de la carte");
105     carte.construit(fechan,festim);
106     affiche("Enregistrement de la carte");
107     carte.enregistrer(nomfichiersortie);
108     if (nbptctl!=0) delete [] ptctl;
109     affiche("Fin");
110     }
111     if (typecarte==0)
112     {
113     affiche("Génération de carte de taille");
114     affiche("Lecture du fichier");
115     MG_FILE gest(nomfichier);
116     FCT_GENERATEUR_CONSTANTE carte(gest,eng);
117     affiche("Construction de la carte");
118     carte.construit(fechan,festim);
119     affiche("Enregistrement de la carte");
120     carte.enregistrer(nomfichiersortie);
121     affiche("Fin");
122     }
123     if (typecarte==2)
124     {
125     affiche("Génération de carte de taille");
126     affiche(" à partir du fichier d'estimation");
127     FCT_GENERATEUR_FICHIER carte(nomfichier,eng,ind1,ind2);
128     affiche("Construction de la carte");
129     carte.construit(fechan,festim);
130     affiche("Enregistrement de la carte");
131     carte.enregistrer(nomfichiersortie);
132     affiche("Fin");
133     }
134     return 0;
135     }
136    
137    
138    
139     #pragma package(smart_init)