⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gpspr.cpp

📁 gps参数计算
💻 CPP
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#include <math.h>
#pragma hdrstop

#include "gpspr.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
double hh(double q);
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::StartDoClick(TObject *Sender)
{
  float Nw,Ng,Ew,Eg,Bw,Bg,Lw,Lg;
  float Fw,Fg,Xw,Yw,Zw,Xg,Yg,Zg,DX,DY,DZ,DA,DF,Hw,Hg;
  long int Aw,Ag;

  if(ComboBoxGPS->ItemIndex==1){
   Aw=6378137L;
   Ew=0.00669437999013;
   Fw=1/298.257223563;
  }
  if(ComboBoxGPS->ItemIndex==0){
   Aw=6378135L;
   Ew=0.00669437999013;
   Fw=1/298.257223563;
  }
  if(ComboBoxGS->ItemIndex==1){
   Ag=6378140L;
   Eg=0.006694385;
   Fg=1/298.257;
  }
  if(ComboBoxGS->ItemIndex==0){
   Ag=6378245L;
   Eg=0.006693427;
   Fg=1/298.3;
  }
  if(EBw->Text==""||ELw->Text==""||EBg->Text==""||ELg->Text==""||EHw->Text==""||EHg->Text==""||Ehy->Text=="")
   {ShowMessage("坐标输入不能空!");return;}

  Bw=hh(StrToFloat(EBw->Text));
  Lw=hh(StrToFloat(ELw->Text));
  Bg=hh(StrToFloat(EBg->Text));
  Lg=hh(StrToFloat(ELg->Text));
  Hw=StrToFloat(EHw->Text);
  Hg=StrToFloat(EHg->Text)+StrToFloat(Ehy->Text);
  Nw=Aw/(sqrt(1-Ew*sin(Bw)*sin(Bw)));
  Ng=Ag/(sqrt(1-Eg*sin(Bg)*sin(Bg)));
  Xw=(Nw+Hw)*cos(Bw)*cos(Lw);
  Yw=(Nw+Hw)*cos(Bw)*sin(Lw);
  Zw=(Nw*(1+Ew)+Hw)*sin(Bw);
  Xg=(Ng+Hg)*cos(Bg)*cos(Lg);
  Yg=(Ng+Hg)*cos(Bg)*sin(Lg);
  Zg=(Ng*(1+Eg)+Hg)*sin(Bg);
  DX=Xw-Xg;
  DY=Yw-Yg;
  DZ=Zw-Zg;
  DA=Aw-Ag;
  DF=Fw-Fg;
  EDX->Text=String(DX);
  EDY->Text=String(DY);
  EDZ->Text=String(DZ);
  EDA->Text=String(DA);
  EDF->Text=String(DF);
}
//---------------------------------------------------------------------------
 #define P 206264.81 //1弧度相当于角度的秒数
 double hh(double q)
 {
 double q1,q2,q3,q4,q5,qm;
 q2=modf(q,&q1);
 q2=q2*100.0;
 q4=modf(q2,&q3);
 q4=q4*100.0;
 q5=q1*3600.0+q3*60.0+q4;
 qm=q5/P;
 return qm;
 }
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -