www.pudn.com > GPSComEVC3.0.rar > 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 &CWay::GetWpts(void) 
{ 
	CArray &wps=m_Wpts; 
	return wps; 
} 
 
 
int CWay::FindPoint(LPTSTR lptstr) const 
{ 
	int i=0; 
	unsigned short l[20]; 
	for(;i