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

📄 corrgriddlg.cpp

📁 能够实现一些常用的地图转换
💻 CPP
字号:
// CorrGridDlg.cpp : implementation file
//

#include "stdafx.h"
#include "CalSurBase.h"
#include "CorrGridDlg.h"
#include "Survey.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCorrGridDlg dialog


CCorrGridDlg::CCorrGridDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCorrGridDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCorrGridDlg)
	m_cdh = FALSE;
	m_gcode = _T("");
	m_map = _T("");
	m_tkcode = _T("");
	m_dudai = -1;
	m_zbx = -1;
	m_selmeri = FALSE;
	m_tic1x = 0.0;
	m_tic1y = 0.0;
	m_tic2x = 0.0;
	m_tic2y = 0.0;
	m_tic3y = 0.0;
	m_tic3x = 0.0;
	m_tic4x = 0.0;
	m_tic4y = 0.0;
	//}}AFX_DATA_INIT
}


void CCorrGridDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCorrGridDlg)
	DDX_Control(pDX, IDC_COMBO_MERI, m_meri);
	DDX_Control(pDX, IDC_COMBO_EXFILE, m_exfile);
	DDX_Check(pDX, IDC_CHECK_DH, m_cdh);
	DDX_Text(pDX, IDC_EDIT_GCODE, m_gcode);
	DDX_Text(pDX, IDC_EDIT_MAP, m_map);
	DDX_Text(pDX, IDC_EDIT_TKCODE, m_tkcode);
	DDX_Radio(pDX, IDC_RADIO_DUDAIA, m_dudai);
	DDX_Radio(pDX, IDC_RADIO_ZBX54, m_zbx);
	DDX_Check(pDX, IDC_CHECK_SELMERI, m_selmeri);
	DDX_Text(pDX, IDC_EDIT_TIC1X, m_tic1x);
	DDX_Text(pDX, IDC_EDIT_TIC1Y, m_tic1y);
	DDX_Text(pDX, IDC_EDIT_TIC2X, m_tic2x);
	DDX_Text(pDX, IDC_EDIT_TIC2Y, m_tic2y);
	DDX_Text(pDX, IDC_EDIT_TIC3Y, m_tic3y);
	DDX_Text(pDX, IDC_EDIT_TIC3X, m_tic3x);
	DDX_Text(pDX, IDC_EDIT_TIC4X, m_tic4x);
	DDX_Text(pDX, IDC_EDIT_TIC4Y, m_tic4y);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCorrGridDlg, CDialog)
	//{{AFX_MSG_MAP(CCorrGridDlg)
	ON_BN_CLICKED(IDC_CHECK_SELMERI, OnCheckSelmeri)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCorrGridDlg message handlers
/*	survey.point54[0].x =641749.25;
	survey.point54[0].y =3542898.73;
	survey.point54[1].x =665377.14;
	survey.point54[1].y =3543253.94;
	survey.point54[2].x =665675.72;
	survey.point54[2].y =3524768.89;
	survey.point54[3].x =642005.14;
	survey.point54[3].y =3524414.70;
*/
void CCorrGridDlg::OnOK() 
{
	CSurvey survey;
	UpdateData(true);
	CString strport;
	CString strgd;
    CString strfilename;
	CStdioFile n_File;
	CString sFiled;
	int selcur=-1;

	double Sb=0,Wl=0;
	double Nb=0,El=0;
	CString m_newmap,m_oldmap;
	if(m_map.IsEmpty()) {return;}
	long lhf=m_map.Find("-");
	m_map.MakeUpper();
	if(lhf>0)
	{
		if(m_map.GetLength()>=3)
		{
			m_newmap=survey.GetNewtfFormOldtf(m_map);
			m_oldmap=m_map;
			survey.SetNewTfCalLL(m_newmap,&Sb,&Wl,&Nb,&El);
		}
	}
	else
	{
		if(m_map.GetLength()==10)
		{
			m_oldmap=survey.GetOldThFormNewTh(m_map);
			m_newmap=m_map;
			survey.SetNewTfCalLL(m_map,&Sb,&Wl,&Nb,&El);
		}
	}

	//设置参数
	survey.GetSysDat(m_zbx+1);
	double zya=0,dh=0;
	long lblc;
	CString seltect;
	double setjb=0;
	lblc=atol(survey.SetBLC);
	if(m_dudai==0)
	{  survey.dudai = 3; }
	else
	{  survey.dudai = 6; }
	if(!m_selmeri)   //缺损中央子午线
	{  survey.BCalMeri(Nb,Sb,survey.dudai,&zya,&dh);}
	else  //自选中央子午线
	{ 
		m_meri.GetWindowText(seltect);
		setjb=atof(seltect);
		survey.BCalMeri(setjb,setjb,survey.dudai,&zya,&dh);
	}
	survey.dmeil_last=(int)zya;       //设置中央子午线和带号.
	survey.fdh_last =(int)dh;
	survey.dgetbl_b =El; survey.dgetbl_l =Sb;
	survey.BlToXy();
	if(m_cdh)
	{  survey.dgety=survey.dgety+dh*1000000;}
    survey.point54[0].x=survey.dgety;
	survey.point54[0].y=survey.dgetx;
	//WriteGridDatexy(survey.dgety,survey.dgetx,1);

	survey.dgetbl_b =El; survey.dgetbl_l =Nb;
	survey.BlToXy();
	if(m_cdh)
	{  survey.dgety=survey.dgety+dh*1000000;}
    survey.point54[1].x=survey.dgety;
	survey.point54[1].y=survey.dgetx;
	//WriteGridDatexy(survey.dgety,survey.dgetx,2);

	survey.dgetbl_b =Wl; survey.dgetbl_l =Nb;
	survey.BlToXy();
	if(m_cdh)
	{  survey.dgety=survey.dgety+dh*1000000;}
    survey.point54[2].x=survey.dgety;
	survey.point54[2].y=survey.dgetx;	
	//WriteGridDatexy(survey.dgety,survey.dgetx,3);

	survey.dgetbl_b =Wl; survey.dgetbl_l =Sb;
	survey.BlToXy();
	if(m_cdh)
	{  survey.dgety=survey.dgety+dh*1000000;}
    survey.point54[3].x=survey.dgety;
	survey.point54[3].y=survey.dgetx;
	selcur=m_exfile.GetCurSel();
	if(selcur<0)
	{
		AfxMessageBox("选择正确的输出文件");
		return;
	}
	else if(selcur==1)
	{
		CFileDialog gldaml(true,"*.*",NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,"AML文件(*.lin)|*.lin|",NULL);
		gldaml.DoModal();
		strfilename=gldaml.GetPathName();
		if(strfilename.IsEmpty())  {   return;}
		sFiled=strfilename.Left(strfilename.GetLength()-3)+"tic";
		survey.ExportTicaml(sFiled);
		survey.ExportKilometreGridAml(strfilename);
		AfxMessageBox("完成!");
		return;
	}
	else if(selcur==2)
	{
		CFileDialog gldaml(true,"*.*",NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,"Mapinfo文件(*.mif)|*.mif|",NULL);
		gldaml.DoModal();
		strfilename=gldaml.GetPathName();
		if(strfilename.IsEmpty())  {   return;}
		survey.ExportKilometreGridMapInof(strfilename,m_tkcode,m_gcode);
		AfxMessageBox("完成!");
		return;
	}
	CFileDialog gldOpenFile(true,"*.*",NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,"ARC/INFO文件(*.E00)|*.E00|",NULL);
	gldOpenFile.DoModal();
    strfilename=gldOpenFile.GetPathName();
    if(strfilename.IsEmpty())  {   return;}
	survey.ExportKilometreGrid(strfilename,m_tkcode,m_gcode);	
	AfxMessageBox("完成!");
}

BOOL CCorrGridDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	m_dudai=0;
	m_zbx=0;
	m_gcode="502";
	m_tkcode="501";
	m_exfile.AddString("ARC/INFO文件(*.E00)");
	m_exfile.AddString("aml文件(*.lin)");
	m_exfile.AddString("MapInfo文件(*.mif)");
	m_exfile.SetCurSel(0);
	
	CString stradd;
	for(int i = 1;i<= 60;i++)
	{
		stradd.Format("%i",3*i);
		m_meri.AddString(stradd);
	}
	m_meri.SetCurSel(42);

	m_selmeri=FALSE;
	m_meri.EnableWindow(FALSE);
	UpdateData(FALSE);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CCorrGridDlg::OnCheckSelmeri() 
{
    UpdateData(TRUE);
	if(m_selmeri)
		m_meri.EnableWindow(TRUE);
	else
		m_meri.EnableWindow(FALSE);
}

⌨️ 快捷键说明

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