将控制台应用程序转换为GUI

Converting console application to GUI

本文关键字:GUI 程序转换 应用 控制台      更新时间:2023-10-16

我找到了一个C++代码来将纬度/经度转换为UTM坐标。

代码在这里。

我想使用.NET GUI(windows窗体)而不是控制台屏幕。

现在,我将从textBox读取值,而不是在控制台中输入值22.2 33.3。然后调用转换函数。

我面临的问题是,我不知道应该将什么参数传递给函数

`CvtLine(int C, char**V, char*p)`

从控制台应用程序的主要功能调用:

代码

int main(int argc, char**argv){                         //2010-08-11: was void main(...
   char buf[256]; char*p; int L,ac; char*av[129];               //vars for reading stdin
   cout<<setiosflags(ios::fixed);                       //decided against including ios::showpoint
   Fmt=fUT4|fLLD|fLLDM;                             //default for Fmt, if not specified by input
   --argc; ++argv;                              //remove spurious first element of argv array
   while(argc && memcmp(argv[0],"--",2)==0){                    //handle leading options: --Outputformat, --test, --help
      if     (isdigit(argv[0][2]))      Fmt=atoi(argv[0]+2);        //for --<DIGIT>, parse Outputformat into Fmt
      else if(strcmp(argv[0],"--test")==0)  {Testcases(); return 0;}    //for --test, run testcases & exit
      else                  {Usage(); return 0;}        //for --help, show Usage & exit
      --argc; ++argv;
   }
   if(argc==0)  while(cin.getline(buf,256), cin.good()){            //0 args, read stdin converting each line
      p=buf; ac=0;
      while(1){ while(*p&&strchr(" t",*p))++p; if(*p==0||*p=='#')break; av[ac++]=p; while(*p&&!strchr(" t#",*p))++p;} //break line into whitespace-separated words
      if(ac>=2&&ac<=4) CvtLine(ac,av,p);                    //line with 2|3|4 words, convert and print
      else if(ac==0)   cout<<buf<<"n";                     //line with no words, echo the line (comments)
      else             cout<<"==invalid number-of-words: "<<buf<<"n";      //anything else is invalid, produce errmsg
   }
   else if(argc>=2&&argc<=4)    CvtLine(argc,argv,"");              //2|3|4 args, convert and print
   else             Usage();                    //argc other than 0|2|3 is invalid, show Usage
   return 0;                                    //2010-08-11: added when void became illegal
}

查看.NET空间参考和投影引擎库。http://projnet.codeplex.com/

.NET空间参考和投影引擎
Proj.NET在大地测量之间执行点对点坐标转换用于fx的坐标系。地理信息系统或GPS应用程序。

这是他们的常见问题解答,有一个关于在系统之间转换的代码示例。将点从一个坐标系投影到另一个