资源简介
学生期间用c++自编的GPS单点定位程序(源码),希望对大家能有帮助,含源码
代码片段和文件信息
#include “StdAfx.h“
#include “GPSTime.h“
const long JAN61980 = 44244;
const long JAN11901 = 15385;
const double SECPERDAY = 86400.0;
const long LeapMonths[13] = { 0 31 60 91 121 152 182
213 244 274 305 335 366 };
const long NormalMonths[13] = { 0 31 59 90 120 151 181
212 243 273 304 334 365 };
GPSTime::GPSTime()
{
GPSWeek =9999;
secsOfWeek=0.0;
}
GPSTime::GPSTime(YMDHMS input)
{
long doy;
if(input.year%4==0)
doy=LeapMonths[input.month-1]+input.day;
else
doy=NormalMonths[input.month-1]+input.day;
long mjd=((input.year-1901)/4)*1461+((input.year-1901)%4)*365+doy-1+JAN11901;
double fractionOfDay=((input.sec/60.0+input.min)/60.0+input.hour)/24.0;
GPSWeek=(mjd-JAN61980)/7;
secsOfWeek=((mjd-JAN61980)-GPSWeek*7+fractionOfDay)*SECPERDAY;
}
GPSTime::GPSTime(unsigned short yearunsigned short monthunsigned short day
unsigned short hourunsigned short mindouble sec)
{
long doy;
if(year%4==0)
doy=LeapMonths[month-1]+day;
else
doy=NormalMonths[month-1]+day;
long mjd=((year-1901)/4)*1461+((year-1901)%4)*365+doy-1+JAN11901;
double fractionOfDay=((sec/60.0+min)/60.0+hour)/24.0;
GPSWeek=(mjd-JAN61980)/7;
secsOfWeek=((mjd-JAN61980)-GPSWeek*7+fractionOfDay)*SECPERDAY;
}
GPSTime::GPSTime(ObsatEpoch input)
{
long doy;
if(input.Year%4==0)
doy=LeapMonths[input.Month-1]+input.Day;
else
doy=NormalMonths[input.Month-1]+input.Day;
long mjd=((input.Year-1901)/4)*1461+((input.Year-1901)%4)*365+doy-1+JAN11901;
double fractionOfDay=((input.Sec/60.0+input.minute)/60.0+input.Hour)/24.0;
GPSWeek=(mjd-JAN61980)/7;
secsOfWeek=((mjd-JAN61980)-GPSWeek*7+fractionOfDay)*SECPERDAY;
}
void GPSTime::setGPSTime(YMDHMS input)
{
long doy;
if(input.year%4==0)
doy=LeapMonths[input.month-1]+input.day;
else
doy=NormalMonths[input.month-1]+input.day;
long mjd=((input.year-1901)/4)*1461+((input.year-1901)%4)*365+doy-1+JAN11901;
double fractionOfDay=((input.sec/60.0+input.min)/60.0+input.hour)/24.0;
GPSWeek=(mjd-JAN61980)/7;
secsOfWeek=((mjd-JAN61980)-GPSWeek*7+fractionOfDay)*SECPERDAY;
}
void GPSTime::setGPSTime(unsigned short yearunsigned short monthunsigned short day
unsigned short hourunsigned short mindouble sec)
{
long doy;
if(year%4==0)
doy=LeapMonths[month-1]+day;
else
doy=NormalMonths[month-1]+day;
long mjd=((year-1901)/4)*1461+((year-1901)%4)*365+doy-1+JAN11901;
double fractionOfDay=((sec/60.0+min)/60.0+hour)/24.0;
GPSWeek=(mjd-JAN61980)/7;
secsOfWeek=((mjd-JAN61980)-GPSWeek*7+fractionOfDay)*SECPERDAY;
}
void GPSTime::setGPSTime(ObsatEpoch input)
{
long doy;
if(input.Year%4==0)
doy=LeapMonths[input.Month-1]+input.Day;
else
doy=NormalMonths[input.Month-1]+input.Day;
long mjd=((input.Year-1901)/4)*1461+((input.Year-1901)%4)*365+doy-1+JAN11901;
double fractionOfDay=((input.Sec/60.0+input.minute)/60.0+input.Ho
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 140288 2010-01-17 19:20 try.ncb
文件 15905 2009-04-10 10:53 try.cpp
文件 3105 2009-04-02 15:24 GPSTime.cpp
文件 956 2009-04-02 11:52 GPSTime.h
文件 1611 2009-04-03 19:22 help.h
文件 12552 2009-04-06 14:52 matrix.cpp
文件 2583 2009-04-02 20:08 matrix.h
文件 4329 2009-04-08 13:55 rinex.cpp
文件 2757 2009-04-02 15:24 rinex.h
文件 290 2009-03-30 21:12 StdAfx.cpp
文件 667 2009-03-30 21:12 StdAfx.h
----------- --------- ---------- ----- ----
185043 11
- 上一篇:四叉树定义实现C++代码
- 下一篇:防火墙C++源码,测试可以运行
评论
共有 条评论