📄 way.cpp
字号:
// Way.cpp: implementation of the CWay class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "GpsNav.h"
#include "Way.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
double NavelMer(double lon,int base,int &index);
bool Gauss(const DBLH dd,CXYH &cc,const PARA pp);
bool InvGauss(const CXYH cc,DBLH &dd,const PARA pp);
extern PARA pp;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CWayPoint::CWayPoint()
{
c.CX=c.CY=c.CH=d.DB=d.DL=d.DH=0;
SetPointName("No Name");
}
CWayPoint::CWayPoint(LPTSTR l)
{
SetPointName(l);
c.CX=c.CY=c.CH=d.DB=d.DL=d.DH=0;
}
CWayPoint::CWayPoint(CString str)
{
SetPointName(str);
c.CX=c.CY=c.CH=d.DB=d.DL=d.DH=0;
}
CWayPoint::~CWayPoint()
{
}
void CWayPoint::SetPointName(LPTSTR l)
{
lstrcpy(lpszPointName,l);
}
void CWayPoint::GetPointName(LPTSTR l)const
{
memset(l,0,20);
lstrcpy(l,lpszPointName);
}
void CWayPoint::SetPointName(CString str)
{
lstrcpy(lpszPointName,(LPCTSTR)str);
}
void CWayPoint::SetCxyh(CXYH cc)
{
c=cc;
InvGauss(c,d,pp);
}
void CWayPoint::SetDblh(DBLH dd)
{
d=dd;
Gauss(d,c,pp);
}
CWay::CWay()
{
nFromWpt=nToWpt=-1;
nForward=nAfterward=0;
DBLH dd;
dd.DB=dd.DH=dd.DL=0;
CWayPoint cp;
cp.SetDblh(dd);
SetCurPoint(cp);
}
CWay::~CWay()
{
}
CWayPoint CWay::GetCurPoint(void)const
{
return CurPoint;
}
int CWay::GetFPoint(void)const
{
return nFromWpt;
}
int CWay::GetTPoint(void)const
{
return nToWpt;
}
void CWay::SetFPoint(int f)
{
nFromWpt=f;
}
void CWay::SetTPoint(int t)
{
nToWpt=t;
}
void CWay::AddWpt(CWayPoint wpt)
{
m_Wpts.Add(wpt);
}
void CWay::AddWpt(CWayPoint wpt,int nIndex)
{
m_Wpts.InsertAt(nIndex,wpt);
}
CWayPoint CWay::DelWpt(int nIndex)
{
CWayPoint delWpt=m_Wpts.GetAt(nIndex);
m_Wpts.RemoveAt(nIndex);
return delWpt;
}
void CWay::DelAll(void)
{
m_Wpts.RemoveAll();
}
int CWay::GetWptNum(void)const
{
return m_Wpts.GetSize();
}
CArray<CWayPoint,CWayPoint> &CWay::GetWpts(void)
{
CArray<CWayPoint,CWayPoint> &wps=m_Wpts;
return wps;
}
int CWay::FindPoint(LPTSTR lptstr) const
{
int i=0;
unsigned short l[20];
for(;i<GetWptNum();i++)
{
m_Wpts[i].GetPointName(l);
if(wcscmp(lptstr,l)==0)
return i;
}
return -1;
}
void CWay::SetCurPoint(const CWayPoint &cp)
{
CurPoint=cp;
}
bool CWayPoint::GetC(CXYH &cc) const
{
cc=c;
return true;
}
bool CWayPoint::GetD(DBLH &dd) const
{
dd=d;
return true;
}
int CWay::GetForward() const
{
return nForward;
}
int CWay::GetAfterward() const
{
return nAfterward;
}
bool CWay::SetForward(int f)
{
nForward=f;
return true;
}
bool CWay::SetAfterward(int a)
{
nAfterward=a;
return true;
}
CWayPoint CWay::GetOldPoint() const
{
return OldPoint;
}
void CWay::SetOldPoint(const CWayPoint &cp)
{
OldPoint=cp;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -