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

📄 rinex.cpp

📁 gps 读renix文件格式的源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
// rinex.cpp// C++ classes for Reading and Writing RINEX files// ver. 200302.12//// Authors:  Steve Hilla//           Gordon Adams//           National Geodetic Survey, NOAA//           Silver Spring, Maryland  20910//// 12Feb03, test to see if there is a time tag in columns 2-26//          of the EPOCH/SAT record (in RINEX Observation Files).#include "rinex.h"#if !defined(IOSTREAM_)#include <iostream>#define IOSTREAM_#endif#if !defined(FSTREAM_)#include <fstream>#define FSTREAM_#endif#if !defined(SSTREAM_)#include <sstream>#define SSTREAM_#endif#if !defined(IOMANIP_)#include <iomanip>#define IOMANIP_#endif#if !defined(STRING_)#include <string>#define STRING_#endif#if !defined(LIMITS_)#include <limits>#define LIMITS_#endif#if !defined(ALGORITHM_)#include <algorithm>  // for replace() function#define ALGORITHM_#endif#if !defined(CSTRING_)#include <cstring>#define CSTRING_#endif#if !defined(CSTDLIB_)#include <cstdlib>#define CSTDLIB_#endif#if !defined(CMATH_)#include <cmath>#define CMATH_#endif#if !defined(CCTYPE_)#include <cctype>#define CCTYPE_#endif#if !defined(DATETIME_H_)#include "datetime.h"#define DATETIME_H_#endifnamespace NGSrinex {using namespace std;//===================== ObsEpoch Class ========================================ObsEpoch::ObsEpoch()  // default Constructor{//    Initialize the OBS epoch structure with NULL values.  For strings NULL//    is an empty string.  For numeric values the NULL is chosen as a value//    that can be stored in the data type (short) but which is outside of the//    allowed range for the data element.  NULLs are typically 9999    initializeData();}ObsEpoch::~ObsEpoch()  // Destructor{ }// Initializersbool ObsEpoch::setEpochTime(DateTime input){  DateTime  Jan1_1980, Dec31_2079;    Jan1_1980.SetYMDHMS(1980,1,1,0,0,0.00000001);    Dec31_2079.SetYMDHMS(2079,12,31,23,59,59.99999999);    if( input >= Jan1_1980  &&  input <= Dec31_2079 )    {       epochTime = input;       return true;    }    else    {       epochTime.SetYMDHMS( 9999, 1, 1, 0, 0, 0.0 );       return false;    }}bool ObsEpoch::setEpochFlag(unsigned short input){   if( input < 7 )   {     epochFlag = input;     return true;   }   else   {     epochFlag = 9999;     return false;   }}bool ObsEpoch::setNumSat(unsigned short input){   if( input <= 999 )   {     numSat = input;     return true;   }   else   {     numSat = 9999;     return false;   }}bool ObsEpoch::setSatListElement(SatObsAtEpoch input,               unsigned short numObsTypes, int i){   bool problemsFound = false;   // Set the satCode member   if( input.satCode == 'G' || input.satCode == ' ' ||       input.satCode == 'R' )   {     satList[ i ].satCode = input.satCode;   }   else   {     satList[ i ].satCode = ' ';     problemsFound = true;   }   // Set the satNum member   if( input.satNum < MAXPRNID )   {     satList[ i ].satNum = input.satNum;   }   else   {     satList[ i ].satNum = 9999;     problemsFound = true;   }   // Set the obsList[] member   for(int j = 0; j < numObsTypes; j++ )   {    if( (input.obsList[j].obsType == C1 ||         input.obsList[j].obsType == L1 || input.obsList[j].obsType == L2 ||         input.obsList[j].obsType == P1 || input.obsList[j].obsType == P2 ||         input.obsList[j].obsType == D1 || input.obsList[j].obsType == D2 ||         input.obsList[j].obsType == S1 || input.obsList[j].obsType == S2)        && (input.obsList[j].LLI <= 7)  &&        (input.obsList[j].sigStrength <= 9) )     {      satList[ i ].obsList[ j ].obsPresent  = input.obsList[j].obsPresent;      satList[ i ].obsList[ j ].observation = input.obsList[j].observation;      satList[ i ].obsList[ j ].obsType     = input.obsList[j].obsType;      satList[ i ].obsList[ j ].LLI         = input.obsList[j].LLI;      satList[ i ].obsList[ j ].sigStrength = input.obsList[j].sigStrength;     }     else     {      satList[ i ].obsList[ j ].obsPresent  = false;      satList[ i ].obsList[ j ].observation = 0.0;    // blank = 0.0      satList[ i ].obsList[ j ].obsType     = NOOBS;      satList[ i ].obsList[ j ].LLI         = 9999;      satList[ i ].obsList[ j ].sigStrength = 9999;      problemsFound = true;     }   } // j-loop over MAXOBSTYPES   if( problemsFound )     return false;   else     return true;}bool ObsEpoch::setRecClockOffset(double input){   if( input > -100.0 && input < 100.0 )   {     recClockOffset = input;     return true;   }   else   {     recClockOffset = 9999.0;     return false;   }}bool ObsEpoch::appendToEpochHeaderRecords(string input){   epochHeaderRecords.append(input);   epochHeaderRecords.append("\n");   return true;}bool ObsEpoch::initializeData(){//    Initializes the OBS epoch structure with NULL values.  For strings NULL//    is an empty string.  For numeric values the NULL is chosen as a value//    that can be stored in the data type (short) but which is outside of the//    allowed range for the data element.  NULLs are typically 9999   epochTime.SetYMDHMS( 9999, 1, 1, 0, 0, 0.0 );   epochFlag = 9999;   numSat    = 9999;   for (int i = 0; i < MAXSATPEREPOCH; i++ )   {      satList[ i ].satCode = ' ';      satList[ i ].satNum  = 9999;      for(int j = 0; j < MAXOBSTYPES; j++ )      {         satList[ i ].obsList[ j ].obsPresent  = false;         satList[ i ].obsList[ j ].observation = 0.0;    // blank = 0.0         satList[ i ].obsList[ j ].obsType     = NOOBS;         satList[ i ].obsList[ j ].LLI         = 9999;         satList[ i ].obsList[ j ].sigStrength = 9999;      }   }   recClockOffset = 9999.0;   epochHeaderRecords = "";   return true;}// SelectorsDateTime ObsEpoch::getEpochTime(){   return epochTime;}unsigned short ObsEpoch::getEpochFlag(){   return epochFlag;}unsigned short ObsEpoch::getNumSat(){   return numSat;}SatObsAtEpoch ObsEpoch::getSatListElement(int i){   return satList[i];}double ObsEpoch::getRecClockOffset(){   return recClockOffset;}string ObsEpoch::getEpochHeaderRecords(){   return epochHeaderRecords;}//===================== MetEpoch Class ====================================MetEpoch::MetEpoch()    // Default Constructor{   epochTime.SetYMDHMS(9999,1,1,0,0,0.0);   for(int i = 0; i < MAXMETTYPES; i++ )   {       metList[i].obsPresent  = false;       metList[i].observation = 0.0;     // blank = 0.0       metList[i].metType     = NOMET;   }}MetEpoch::~MetEpoch()    // Destructor{}// Initializersbool MetEpoch::setEpochTime(DateTime input){  DateTime  Jan1_1980, Dec31_2079;    Jan1_1980.SetYMDHMS(1980,1,1,0,0,0.00000001);    Dec31_2079.SetYMDHMS(2079,12,31,23,59,59.99999999);    if( input >= Jan1_1980 && input <= Dec31_2079 )    {       epochTime = input;       return true;    }    else    {       epochTime.SetYMDHMS( 9999, 1, 1, 0, 0, 0.0 );       return false;    }}bool MetEpoch::setMetListElement(MetSet input, int i){   if( input.metType == PR  ||  input.metType == TD  ||       input.metType == HR  ||  input.metType == ZW  ||       input.metType == ZD  ||  input.metType == ZT  )   {     metList[i].obsPresent = input.obsPresent;     metList[i].observation = input.observation;     metList[i].metType = input.metType;     return true;   }   else   {     metList[i].obsPresent  = false;     metList[i].observation = 0.0;     // blank = 0.0     metList[i].metType     = NOMET;     return false;   }}//SelectorsDateTime MetEpoch::getEpochTime(){   return epochTime;}MetSet MetEpoch::getMetListElement(int i){   return metList[i];}//===================== ClkEpoch Class ====================================ClkEpoch::ClkEpoch()    // Default Constructor{   clockDataType = NOCLK;   recvrSatName = "";   epochTime.SetYMDHMS(9999,1,1,0,0,0.0);   numberDataValues    = 0;   clockBias           = 0.0;   clockBiasSigma      = 0.0;   clockRate           = 0.0;   clockRateSigma      = 0.0;   clockAcceleration   = 0.0;   clockAccelSigma     = 0.0;}ClkEpoch::~ClkEpoch()    // Destructor{}// Initializersbool ClkEpoch::setClockDataType(enum CLKTYPE input){   if( input == AR || input == AS || input == CR ||       input == DR || input == MS )   {      clockDataType = input;      return true;   }   else   {      clockDataType = NOCLK;      return false;   }}bool ClkEpoch::setRecvrSatName(string input){    recvrSatName = input;    return true;}bool ClkEpoch::setEpochTime(DateTime input){  DateTime  Jan1_1980, Dec31_2079;    Jan1_1980.SetYMDHMS(1980,1,1,0,0,0.00000001);    Dec31_2079.SetYMDHMS(2079,12,31,23,59,59.99999999);    if( input >= Jan1_1980 && input <= Dec31_2079 )    {       epochTime = input;       return true;    }    else    {       epochTime.SetYMDHMS( 9999, 1, 1, 0, 0, 0.0 );       return false;    }}bool ClkEpoch::setNumberDataValues(unsigned short input){    numberDataValues = input;    return true;}bool ClkEpoch::setClockBias(double input){    clockBias = input;    return true;}bool ClkEpoch::setClockBiasSigma(double input){    clockBiasSigma = input;    return true;}bool ClkEpoch::setClockRate(double input){    clockRate = input;    return true;}bool ClkEpoch::setClockRateSigma(double input){    clockRateSigma = input;    return true;}bool ClkEpoch::setClockAcceleration(double input){    clockAcceleration = input;    return true;}bool ClkEpoch::setClockAccelSigma(double input){    clockAccelSigma = input;    return true;}//SelectorsCLKTYPE ClkEpoch::getClockDataType(){   return clockDataType;}string ClkEpoch::getRecvrSatName(){   return recvrSatName;}DateTime ClkEpoch::getEpochTime(){   return epochTime;}unsigned short ClkEpoch::getNumberDataValues(){   return numberDataValues;}double ClkEpoch::getClockBias(){   return clockBias;}double ClkEpoch::getClockBiasSigma(){   return clockBiasSigma;}double ClkEpoch::getClockRate(){   return clockRate;}double ClkEpoch::getClockRateSigma(){   return clockRateSigma;}double ClkEpoch::getClockAcceleration(){   return clockAcceleration;}double ClkEpoch::getClockAccelSigma(){   return clockAccelSigma;}//===================== PRNBlock Class ====================================PRNBlock::PRNBlock()  // Default Constructor{    satellitePRN   = 0;    tocYear        = 9999;    tocMonth       = 1;    tocDay         = 1;    tocHour        = 0;    tocMin         = 0;    tocSec         = 0.0;    clockBias      = 0.0;    clockDrift     = 0.0;    clockDriftRate = 0.0;    iode           = 0.0;    crs            = 0.0;    deltan         = 0.0;    mo             = 0.0;    cuc            = 0.0;    eEccen         = 0.0;    cus            = 0.0;    sqrtA          = 0.0;

⌨️ 快捷键说明

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