• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

[地图投影之C实现]主程序

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
  1 #include                               /* Mercator Projection */
  2 #include
  3 #include
  4 #include
  5 #include"a:\2023\ex6\parameter.h"
  6 #include"a:\2023\ex6\basic_function.c"
  7 main()
  8 {
  9  FILE *fp;
 10  double latitude[300],longitude[300];             /* the boundary */
 11  int i,j;
 12  int gdriver=VGA,gmode=VGAHI;
 13  char s[6],*min=s;
 14  double x[25][17],y[25][17],p;                    /* latitude and longitude web */
 15  double a[300],b[300];                            /* value changed from boundary */
 16  double m0=2.6E8,alpha=Parallel_radius(0);
 17  for(j=0;j<=16;j++)
 18     {
 19   double x0;
 20   x0=U(Radiam(-80+10*j));
 21   x0=log(x0)*alpha*100/m0;
 22   if(j==0) p=x0;
 23   for(i=0;i<=24;i++)
 24   {
 25    x[i][j]=x0-p;
 26   }
 27     }
 28     for(i=0;i<=24;i++)
 29     {
 30         double y0;
 31   y0=alpha*Radiam(-180+15*i)*100/m0;
 32   for(j=0;j<=16;j++)
 33         {
 34     y[i][j]=y0;
 35         }
 36     }
 37  initgraph(&gdriver,&gmode,"");
 38  setbkcolor(15);
 39  setcolor(7);
 40  for(j=0;j<=16;j++)
 41     {
 42   outtextxy(y[0][j]*35+300,460-x[0][j]*35,itoa(abs(-80+10*j),min,10));
 43   moveto(y[0][j]*35+320,460-x[0][j]*35);
 44         for(i=0;i<=24;i++)
 45         {
 46    lineto(y[i][j]*35+320,460-x[i][j]*35);
 47         }
 48     }
 49     for(i=0;i<=24;i++)
 50     {
 51   outtextxy(y[i][0]*35+320,470-x[i][0]*35,itoa(abs(-180+15*i),min,10));
 52   moveto(y[i][0]*35+320,460-x[i][0]*35);
 53   for(j=0;j<=16;j++)
 54         {
 55    lineto(y[i][j]*35+320,460-x[i][j]*35);
 56         }
 57  }
 58  fp=fopen("a:\\2023\\ex6\\Globe.txt","rb");
 59  if(fp==NULL)
 60  {
 61   printf("Can't open the file!");
 62   exit(1);
 63  }
 64  setcolor(4);
 65  while(!feof(fp))                     /* every time, one group of datas */
 66  {
 67   for(i=0;i<300;i++)
 68   {
 69    fscanf(fp,"%lf %lf",&longitude[i],&latitude[i]);
 70    if(latitude[i]==-1000)
 71    {
 72     break;
 73    }                                   /* stop */
 74   }
 75   for(j=0;j  {
 76    double u;
 77    u=U(Radiam(latitude[j]));
 78    a[j]=alpha*log(fabs(u));
 79    a[j]=a[j]*100/m0-p;
 80    b[j]=alpha*Radiam(longitude[j]);
 81    b[j]=b[j]*100/m0;                  /* map projection */
 82   }
 83   for(j=0;j  {
 84    line(320+b[j]*35,460-a[j]*35,320+b[j+1]*35,460-a[j+1]*35);
 85   }                                           /* drawing map */
 86  }
 87  fclose(fp);
 88  setcolor(7);
 89  outtextxy(180,5,"Mercator Projection Of The Globe");
 90  outtextxy(400,20,"Disigned by DICK");
 91  outtextxy(400,30,"Proportation 1:");
 92  outtextxy(520,30,ltoa(m0,min,10));
 93  setcolor(1);
 94  outtextxy(450,195,"INDIA");
 95  outtextxy(380,180,"SADI");
 96  outtextxy(370,190,"ARABIA");
 97  outtextxy(330,155,"FRANCE");
 98  outtextxy(280,195,"SPAIN");
 99  outtextxy(350,310,"SOUTH");
100  outtextxy(345,320,"AFRICA");
101  outtextxy(240,235,"BRAZIL");
102  outtextxy(370,245,"CANGO");
103  outtextxy(480,245,"INDUNISIA");
104  outtextxy(175,290,"BOLIVIA");
105  getchar();
106 }

 


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C#中静态方法和非静态方法的区别发布时间:2022-07-14
下一篇:
LearnCTheHardWay发布时间:2022-07-14
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap