📄 caleight.cpp
字号:
// Caleight.cpp : implementation file
//
#include "stdafx.h"
#include "CalSurBase.h"
#include "Caleight.h"
#include "Survey.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCaleight dialog
CCaleight::CCaleight(CWnd* pParent /*=NULL*/)
: CDialog(CCaleight::IDD, pParent)
{
//{{AFX_DATA_INIT(CCaleight)
m_caltf = _T("");
m_tf1 = _T("");
m_tf2 = _T("");
m_tf3 = _T("");
m_tf4 = _T("");
m_tf5 = _T("");
m_tf6 = _T("");
m_tf7 = _T("");
m_tf8 = _T("");
m_radionew = -1;
//}}AFX_DATA_INIT
}
void CCaleight::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCaleight)
DDX_Text(pDX, IDC_EDIT_CALTF, m_caltf);
DDX_Text(pDX, IDC_EDIT_TF1, m_tf1);
DDX_Text(pDX, IDC_EDIT_TF2, m_tf2);
DDX_Text(pDX, IDC_EDIT_TF3, m_tf3);
DDX_Text(pDX, IDC_EDIT_TF4, m_tf4);
DDX_Text(pDX, IDC_EDIT_TF5, m_tf5);
DDX_Text(pDX, IDC_EDIT_TF6, m_tf6);
DDX_Text(pDX, IDC_EDIT_TF7, m_tf7);
DDX_Text(pDX, IDC_EDIT_TF9, m_tf8);
DDX_Radio(pDX, IDC_RADIO_NEW, m_radionew);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCaleight, CDialog)
//{{AFX_MSG_MAP(CCaleight)
ON_BN_CLICKED(ID_INPUTDATA, OnInputdata)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCaleight message handlers
BOOL CCaleight::OnInitDialog()
{
CDialog::OnInitDialog();
m_radionew=0;
UpdateData(false);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CCaleight::OnOK()
{
CSurvey survey;
double Sb=0,Wl=0;
double Nb=0,El=0;
int sel=0;
CString strport;
CString m_newmap,m_oldmap;
CString stroldtf,strnewtf;
UpdateData(true);
if(m_caltf.IsEmpty()) {return;}
long lhf=m_caltf.Find("-");
m_caltf.MakeUpper();
if(lhf>0)
{
if(m_caltf.GetLength()>=3)
{
m_newmap=survey.GetNewtfFormOldtf(m_caltf);
m_oldmap=m_caltf;
survey.SetNewTfCalLL(m_newmap,&Sb,&Wl,&Nb,&El);
}
}
else
{
if(m_caltf.GetLength()==10)
{
m_oldmap=survey.GetOldThFormNewTh(m_caltf);
m_newmap=m_caltf;
survey.SetNewTfCalLL(m_caltf,&Sb,&Wl,&Nb,&El);
}
}
if (atol(survey.SetBLC)==1000000) { sel = 0;}
else if(atol(survey.SetBLC)==500000) { sel = 1;}
else if(atol(survey.SetBLC)==250000) { sel = 2;}
else if(atol(survey.SetBLC)==100000) { sel = 3;}
else if(atol(survey.SetBLC)==50000) { sel = 4;}
else if(atol(survey.SetBLC)==25000) { sel = 5;}
else if(atol(survey.SetBLC)==10000) { sel = 6;}
else if(atol(survey.SetBLC)==5000) { sel = 7;}
double jd=0,wd=0;
//Sb,El 左上角
jd=survey.Deg(Sb-0.01);wd=survey.Deg(El+0.01);
if(sel>=1&&sel<=2)
{
stroldtf=survey.GetThCalLat(jd,wd,sel);
}
else if(sel>=4&&sel<=5)
{
stroldtf=survey.GetThCalLatEF(jd,wd,sel);
}
else
{
stroldtf=survey.GetThCalLatADGH(jd,wd,sel);
}
if(m_radionew==0)
{
stroldtf.MakeUpper();
strnewtf=survey.GetNewtfFormOldtf(stroldtf);
m_tf1=strnewtf;
}
else
{ m_tf1=stroldtf; }
//第二幅
jd=survey.Deg(Sb);wd=survey.Deg(El);
if(sel>=1&&sel<=2)
{
stroldtf=survey.GetThCalLat(jd,wd,sel);
}
else if(sel>=4&&sel<=5)
{
stroldtf=survey.GetThCalLatEF(jd,wd,sel);
}
else
{
stroldtf=survey.GetThCalLatADGH(jd,wd,sel);
}
if(m_radionew==0)
{
stroldtf.MakeUpper();
strnewtf=survey.GetNewtfFormOldtf(stroldtf);
m_tf2=strnewtf;
}
else
{ m_tf2=stroldtf; }
//第四幅
jd=survey.Deg(Sb-0.01);wd=survey.Deg(Wl+0.01);
if(sel>=1&&sel<=2)
{
stroldtf=survey.GetThCalLat(jd,wd,sel);
}
else if(sel>=4&&sel<=5)
{
stroldtf=survey.GetThCalLatEF(jd,wd,sel);
}
else
{
stroldtf=survey.GetThCalLatADGH(jd,wd,sel);
}
if(m_radionew==0)
{
stroldtf.MakeUpper();
strnewtf=survey.GetNewtfFormOldtf(stroldtf);
m_tf4=strnewtf;
}
else
{ m_tf4=stroldtf; }
//第三幅
jd=survey.Deg(Nb);wd=survey.Deg(El);
if(sel>=1&&sel<=2)
{
stroldtf=survey.GetThCalLat(jd,wd,sel);
}
else if(sel>=4&&sel<=5)
{
stroldtf=survey.GetThCalLatEF(jd,wd,sel);
}
else
{
stroldtf=survey.GetThCalLatADGH(jd,wd,sel);
}
if(m_radionew==0)
{
stroldtf.MakeUpper();
strnewtf=survey.GetNewtfFormOldtf(stroldtf);
m_tf3=strnewtf;
}
else
{ m_tf3=stroldtf; }
//第五幅
jd=survey.Deg(Nb);wd=survey.Deg(Wl);
if(sel>=1&&sel<=2)
{
stroldtf=survey.GetThCalLat(jd,wd,sel);
}
else if(sel>=4&&sel<=5)
{
stroldtf=survey.GetThCalLatEF(jd,wd,sel);
}
else
{
stroldtf=survey.GetThCalLatADGH(jd,wd,sel);
}
if(m_radionew==0)
{
stroldtf.MakeUpper();
strnewtf=survey.GetNewtfFormOldtf(stroldtf);
m_tf5=strnewtf;
}
else
{ m_tf5=stroldtf; }
//第7幅
jd=survey.Deg(Sb+0.01);wd=survey.Deg(Wl-0.01);
if(sel>=1&&sel<=2)
{
stroldtf=survey.GetThCalLat(jd,wd,sel);
}
else if(sel>=4&&sel<=5)
{
stroldtf=survey.GetThCalLatEF(jd,wd,sel);
}
else
{
stroldtf=survey.GetThCalLatADGH(jd,wd,sel);
}
if(m_radionew==0)
{
stroldtf.MakeUpper();
strnewtf=survey.GetNewtfFormOldtf(stroldtf);
m_tf7=strnewtf;
}
else
{ m_tf7=stroldtf; }
//第8幅
jd=survey.Deg(Nb+0.01);wd=survey.Deg(Wl-0.01);
if(sel>=1&&sel<=2)
{
stroldtf=survey.GetThCalLat(jd,wd,sel);
}
else if(sel>=4&&sel<=5)
{
stroldtf=survey.GetThCalLatEF(jd,wd,sel);
}
else
{
stroldtf=survey.GetThCalLatADGH(jd,wd,sel);
}
if(m_radionew==0)
{
stroldtf.MakeUpper();
strnewtf=survey.GetNewtfFormOldtf(stroldtf);
m_tf8=strnewtf;
}
else
{ m_tf8=stroldtf; }
//第6幅
jd=survey.Deg(Sb-0.01);wd=survey.Deg(Wl-0.01);
if(sel>=1&&sel<=2)
{
stroldtf=survey.GetThCalLat(jd,wd,sel);
}
else if(sel>=4&&sel<=5)
{
stroldtf=survey.GetThCalLatEF(jd,wd,sel);
}
else
{
stroldtf=survey.GetThCalLatADGH(jd,wd,sel);
}
if(m_radionew==0)
{
stroldtf.MakeUpper();
strnewtf=survey.GetNewtfFormOldtf(stroldtf);
m_tf6=strnewtf;
}
else
{ m_tf6=stroldtf; }
UpdateData(false);
/*
WriteGridDate(Sb,El,1);
WriteGridDate(Nb,El,2);
WriteGridDate(Nb,Wl,3);
WriteGridDate(Sb,Wl,4);
*/
}
void CCaleight::OnInputdata()
{
UpdateData(true);
CString strport;
CString strfilename;
CStdioFile n_File;
CFileDialog gldOpenFile(true,"*.*",NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,"文本文件(*.txt)|*.txt|所有文件(*.*)|*.*|",NULL);
gldOpenFile.DoModal();
strfilename=gldOpenFile.GetPathName();
//-------------------------------------------
CFileException e;
if(!n_File.Open(strfilename,CFile::modeNoTruncate | CFile::modeWrite,&e)) //modeNoTruncate在原文件上添加
{
if(!n_File.Open(strfilename,CFile::modeCreate | CFile::modeWrite,&e))
{ return; }
}
strport="中心文件: " + m_caltf;
strport+="\n";
n_File.WriteString(strport);
strport.Format("%18s%18s%18s\n",m_tf1,m_tf2,m_tf3);
//strport+="\n";
n_File.WriteString(strport);
strport.Format("%18s%36s\n",m_tf4,m_tf5);
n_File.WriteString(strport);
strport.Format("%18s%18s%18s\n",m_tf6,m_tf7,m_tf8);
n_File.WriteString(strport);
n_File.WriteString("============================================\n");
n_File.WriteString("============================================\n");
n_File.WriteString("\n");
n_File.WriteString("\n");
n_File.Close();
ShellExecute(::GetDesktopWindow(), _T("open"), strfilename, NULL, NULL, SW_NORMAL);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -