// guass coordinateDlg.cpp : implementation file
//
#include "stdafx.h"
#include "guass coordinate.h"
#include "guass coordinateDlg.h"
#include "math.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
///////////////////////////////////////////////////////////////////////////// // CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
///////////////////////////////////////////////////////////////////////////// // CGuasscoordinateDlg dialog
CGuasscoordinateDlg::CGuasscoordinateDlg(CWnd* pParent /*=NULL*/) : CDialog(CGuasscoordinateDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CGuasscoordinateDlg)
m_bdu = 0;
m_bfen = 0;
m_bmiao = 0.0;
m_x = 0.0;
m_y = 0.0;
m_ldu = 0;
m_lfen = 0;
m_lmiao = 0.0;
m_ZoneWidth = -1;
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CGuasscoordinateDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CGuasscoordinateDlg)
DDX_Text(pDX, IDC_B_DU, m_bdu);
DDV_MinMaxInt(pDX, m_bdu, 0, 90);
DDX_Text(pDX, IDC_B_FEN, m_bfen);
DDV_MinMaxInt(pDX, m_bfen, 0, 60);
DDX_Text(pDX, IDC_B_MIAO, m_bmiao);
DDV_MinMaxDouble(pDX, m_bmiao, 0., 60.);
DDX_Text(pDX, IDC_x, m_x);
DDX_Text(pDX, IDC_y, m_y);
DDX_Text(pDX, IDC_L_DU, m_ldu);
DDV_MinMaxInt(pDX, m_ldu, 0, 180);
DDX_Text(pDX, IDC_L_FEN, m_lfen);
DDV_MinMaxInt(pDX, m_lfen, 0, 60);
DDX_Text(pDX, IDC_L_MIAO, m_lmiao);
DDV_MinMaxDouble(pDX, m_lmiao, 0., 60.);
DDX_Radio(pDX, IDC_RADIO1, m_ZoneWidth);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CGuasscoordinateDlg, CDialog)
//{{AFX_MSG_MAP(CGuasscoordinateDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_COMMAND(ID_ABOUT, OnAbout)
ON_COMMAND(ID_ZHENG, OnZheng)
ON_COMMAND(ID_FAN, OnFan)
ON_BN_CLICKED(ID_CAL, OnCal)
ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
///////////////////////////////////////////////////////////////////////////// // CGuasscoordinateDlg message handlers
BOOL CGuasscoordinateDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
CMenu menu;
menu.LoadMenu(IDR_MENU); //IDR_MENU在资源中创建的菜单
SetMenu(&menu);
return TRUE; // return TRUE unless you set the focus to a control
}
void CGuasscoordinateDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below // to draw the icon. For MFC applications using the document/view model, // this is automatically done for you by the framework.
void CGuasscoordinateDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags // the minimized window.
HCURSOR CGuasscoordinateDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CGuasscoordinateDlg::OnAbout()
{
// TODO: Add your command handler code here
CAboutDlg Dlg;
Dlg.DoModal();
}
void CGuasscoordinateDlg::OnZheng()
{
// TODO: Add your command handler code here
GetDlgItem(IDC_B_DU)->EnableWindow(TRUE);
GetDlgItem(IDC_B_FEN)->EnableWindow(TRUE);
GetDlgItem(IDC_B_MIAO)->EnableWindow(TRUE);
GetDlgItem(IDC_L_DU)->EnableWindow(TRUE);
GetDlgItem(IDC_L_FEN)->EnableWindow(TRUE);
GetDlgItem(IDC_L_MIAO)->EnableWindow(TRUE);
GetDlgItem(IDC_x)->EnableWindow(FALSE);
GetDlgItem(IDC_y)->EnableWindow(FALSE);
SetDlgItemText(IDC_STATIC_INPUT,"请输入B,L坐标值:");
m_x=m_y=0;
//m_bdu=m_bfen=m_ldu=m_lfen=0;
// m_bmiao=m_lmiao=0;
UpdateData(FALSE);
}
void CGuasscoordinateDlg::OnFan()
{
// TODO: Add your command handler code here
GetDlgItem(IDC_x)->EnableWindow(TRUE);
GetDlgItem(IDC_y)->EnableWindow(TRUE);
GetDlgItem(IDC_B_DU)->EnableWindow(FALSE);
GetDlgItem(IDC_B_FEN)->EnableWindow(FALSE);
GetDlgItem(IDC_B_MIAO)->EnableWindow(FALSE);
GetDlgItem(IDC_L_DU)->EnableWindow(FALSE);
GetDlgItem(IDC_L_FEN)->EnableWindow(FALSE);
GetDlgItem(IDC_L_MIAO)->EnableWindow(FALSE);
SetDlgItemText(IDC_STATIC_INPUT,"请输入x,y坐标值:");
m_bdu=m_bfen=m_ldu=m_lfen=0;
m_bmiao=m_lmiao=0;
// m_x=m_y=0;
UpdateData(FALSE);
}
void CGuasscoordinateDlg::OnCal()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
double B,L,l,N,a0,a4,a6,a3,a5;
int n,Lo;
double b,Bf,Nf,b2,b3,b4,b5,Z;
if(!GetDlgItem(IDC_x)->IsWindowEnabled()&&(!GetDlgItem(IDC_B_DU)->IsWindow Enabled()))
{
MessageBox("请选择计算方式!","提示",MB_OK|MB_ICONWARNING);
return;
}
if (m_ZoneWidth==-1)
{
MessageBox("请选择投影分带方式!","提示",MB_OK|MB_ICONWARNING);
return;
}
if(GetDlgItem(IDC_x)->IsWindowEnabled())
{
b=m_x/6367558.4969;
n=int(m_y/1000000.0);
Bf=b+(50221746+(293622+(2350+22*cos(b)*cos(b))*cos(b)*cos(b))*cos(b)*cos(b))*p ow(10,-10)*sin(b)*cos(b);
Nf=6399698.902-(21562.267-(108.973-0.612*cos(Bf)*cos(Bf))*cos(Bf)*cos(Bf)) *cos(Bf)*cos(Bf);
Z=(m_y-500000-n*1000000.0)/(Nf*cos(Bf));
b2=(0.5+0.00336975*cos(Bf)*cos(Bf))*sin(Bf)*cos(Bf);
b3=0.333333-(0.1666667-0.001123*cos(Bf)*cos(Bf))*cos(Bf)*cos(Bf);
b4=0.25+(0.161612+0.005617*cos(Bf)*cos(Bf))*cos(Bf)*cos(Bf);
b5=0.2-(0.16667-0.00878*cos(Bf)*cos(Bf))*cos(Bf)*cos(Bf);
B=(Bf-(1-(b4-0.147*Z*Z)*Z*Z)*Z*Z*b2)*p;
l=(1-(b3-b5*Z*Z)*Z*Z)*Z*p;
if (m_ZoneWidth==0)
Lo=(n*6-3)*60*60;
else if(m_ZoneWidth=1)
Lo=n*3*60*60;
L=Lo+l;
m_bdu=int(B/60/60);
m_bfen=int(B/60-m_bdu*60);
m_bmiao=B-m_bdu*60*60-m_bfen*60;
m_ldu=int(L/60/60);
m_lfen=int(L/60-m_ldu*60);
m_lmiao=L-m_ldu*60*60-m_lfen*60;
}
if(GetDlgItem(IDC_B_DU)->IsWindowEnabled())
{
B=(m_bdu*60*60+m_bfen*60+m_bmiao)/p;
L=m_ldu*60*60+m_lfen*60+m_lmiao;
if (m_ZoneWidth==0)
{
n=int((m_ldu+m_lfen/60.0+m_lmiao/60.0/60.0)/6.0)+1;
Lo=(6*n-3)*60*60;
}
else if (m_ZoneWidth==1)
{
n=int((m_ldu+m_lfen/60.0+m_lmiao/60.0/60.0)/3.0);
Lo=3*n*60*60;
}
l=(L-Lo)/p;
N=6399698.902-(21562.267-(108.973-0.612*cos(B)*cos(B))*cos(B)*cos(B))*cos( B)*cos(B);
a0=32140.404-(135.3302-(0.7092-0.0040*cos(B)*cos(B))*cos(B)*cos(B))*cos(B) *cos(B);
a4=(0.25+0.00252*cos(B)*cos(B))*cos(B)*cos(B)-0.04166;
a6=(0.166*cos(B)*cos(B)-0.084)*cos(B)*cos(B);
a3=(0.3333333+0.001123*cos(B)*cos(B))*cos(B)*cos(B)-0.1666667;
a5=0.0083-(0.1667-(0.1968+0.0040*cos(B)*cos(B))*cos(B)*cos(B))*cos(B)*cos( B);
m_x=6367558.4969*B-(a0-(0.5+(a4+a6*l*l)*l*l)*l*l*N)*sin(B)*cos(B);
m_y=(1+(a3+a5*l*l)*l*l)*l*N*cos(B)+500000.0+n*1000000.0;
}
UpdateData(FALSE);
}
void CGuasscoordinateDlg::OnRadio1()
{
// TODO: Add your control notification handler code here
m_ZoneWidth=0;
}
void CGuasscoordinateDlg::OnRadio2()
{
// TODO: Add your control notification handler code here
m_ZoneWidth=1;
}
本文档为【高斯投影正反算——包括3度和6度带的选择】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。