/// <summary> /// 构造函数 /// </summary> /// <param name="NavFile"></param> public SingleParamNavFileEphService(ParamNavFile NavFile) { this.NavFile = NavFile; if (NavFile.Header != null) { this.Name = NavFile.Header.Name; } }
/// <summary> /// 将指定的导航文件转换成 RINEX V3.0字符串。 /// </summary> /// <param name="file"></param> /// <returns></returns> public static string BuidRinexV3String(ParamNavFile file) { StringBuilder sb = new StringBuilder(); sb.Append(BuildHeaderString(file.Header)); foreach (var prn in file.Prns) { foreach (var item in file.GetEphemerisParams(prn)) { sb.Append(BuildRinexRecordV3(item)); } } return(sb.ToString()); }
/// <summary> /// GNSS导航文件的读取 /// </summary> /// <returns></returns> public ParamNavFile ReadGnssNavFlie() { ParamNavFile f = new ParamNavFile(); f.Header = ReadHeader(RinexFileName); //测试版本 if (f.Header.Version == 0) { using (StreamReader sr = new StreamReader(RinexFileName, UnicodeEncoding.UTF8)) { RinexUtil.SkipHeader(sr); } } using (StreamReader sr = new StreamReader(RinexFileName, UnicodeEncoding.UTF8)) { RinexUtil.SkipHeader(sr); if (f.Header.Version < 3.0) { while (sr.Peek() != -1) { EphemerisParam record = ReadRecordV2(sr, f.Header); f.Add(record); } } else if (f.Header.Version >= 3.0 && f.Header.Version < 4.0) { while (sr.Peek() != -1) { SatClockBias recordHeader = null; string line = null; try { line = sr.ReadLine(); recordHeader = ParseFirstLineV3(line, f.Header); var record = new EphemerisParam(recordHeader); ReadRecordBodyV3(sr, record); f.Add(record); } catch (Exception ex) { log.Error("导航星历解析错误!将继续尝试 " + ex.Message + line + ", Path:" + RinexFileName); } } } } return(f); }