大地坐标与大地空间坐标转换工具

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

#include "stdafx.h"

#include

#include

#include "resource.h"

#include "MainDlg.h"

#include

#include

BOOL WINAPI Main_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {

switch(uMsg)

{

HANDLE_MSG(hWnd, WM_INITDIALOG, Main_OnInitDialog);

HANDLE_MSG(hWnd, WM_COMMAND, Main_OnCommand);

HANDLE_MSG(hWnd,WM_CLOSE, Main_OnClose);

}

return FALSE;

}

BOOL Main_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)

{

return TRUE;

}

void Main_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)

{

double a=0;

double e2=0;

switch(id)

{

case IDC_B1:

{

a=6378245.0000;

e2=0.00669342162297;

if(a==0)

{

MessageBox(hwnd,TEXT("请选择坐标系"),TEXT("警告"),MB_OK);

}

else{

TCHAR stre1[256];

TCHAR stre11[256];

TCHAR stre111[256];

GetDlgItemText(hwnd,IDC_E1,stre1,sizeof(stre1)); GetDlgItemText(hwnd,IDC_E11,stre11,sizeof(stre11)); GetDlgItemText(hwnd,IDC_E111,stre111,sizeof(stre111));

double L1 = atof(stre1);

double L11 = atof(stre11);

double L111 = atof(stre111);

double L = L1+(L11/60)+(L111/3600);

TCHAR stre2[256];

TCHAR stre22[256];

TCHAR stre222[256];

GetDlgItemText(hwnd,IDC_E2,stre2,sizeof(stre2)); GetDlgItemText(hwnd,IDC_E22,stre22,sizeof(stre22)); GetDlgItemText(hwnd,IDC_E222,stre222,sizeof(stre222)); double B2 = atof(stre2);

double B22 = atof(stre22);

double B222 = atof(stre222);

double B = B2+(B22/60)+(B222/3600);

TCHAR stre3[256];

GetDlgItemText(hwnd,IDC_E3,stre3,sizeof(stre3)); double H = atof(stre3);

double sinB = sin((B/180)*3.1415926535897932385); double sinL = sin((L/180)*3.1415926535897932385); double cosB = cos((B/180)*3.1415926535897932385); double cosL = cos((L/180)*3.1415926535897932385); double sin2B=sinB*sinB;

double w = double(sqrt(1-e2*sin2B));

double n=a/w;

double X = (n+H)*cosB*cosL;

double Y = (n+H)*cosB*sinL;

double Z = (n*(1-e2)+H)*sinB;

int x = (int)X;

int x1=100000*(X-x);

int y = (int)Y;

int y1=100000*(Y-y);

int z = (int)Z;

int z1=100000*(Z-z);

TCHAR strx[256];

wsprintf(strx,"%i",x);

SetDlgItemText(hwnd,IDC_E4,strx);

TCHAR strx1[256];

wsprintf(strx1,"%i",x1);

SetDlgItemText(hwnd,IDC_D1,strx1);

TCHAR stry[256];

wsprintf(stry,"%i",y);

SetDlgItemText(hwnd,IDC_E5,stry);

TCHAR stry1[256];

wsprintf(stry1,"%i",y1);

SetDlgItemText(hwnd,IDC_D2,stry1);

TCHAR strz[256];

wsprintf(strz,"%i",z);

SetDlgItemText(hwnd,IDC_E6,strz);

TCHAR strz1[256];

wsprintf(strz1,"%i",z1);

SetDlgItemText(hwnd,IDC_D3,strz1);

}

break;

}

case IDC_B2:

{

a=6378140.0000;

e2=0.00669438499959;

if(a==0)

{

MessageBox(hwnd,TEXT("请选择坐标系"),TEXT("警告"),MB_OK);

}

else{

相关文档
最新文档