/// <summary> /// GNSS导航文件的读取 /// </summary> /// <param name="navFilePath"></param> /// <returns></returns> public MixedNavFile ReadGnssNavFlie() { MixedNavFile f = new MixedNavFile(); f.SetHeader(ParamNavFileReader.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 = ParamNavFileReader.ReadRecordV2(sr, f.Header); f.Add(record); } } else if (f.Header.Version >= 3.0 && f.Header.Version < 4.0) { while (sr.Peek() != -1) { string line = sr.ReadLine(); if (string.IsNullOrWhiteSpace(line)) { continue; } SatClockBias recordHeader = ParamNavFileReader.ParseFirstLineV3(line, f.Header); //轨道参数 var satType = recordHeader.Prn.SatelliteType; if (EphemerisUtil.IsEphemerisParam(satType)) { var record = new EphemerisParam(recordHeader); ParamNavFileReader.ReadRecordBodyV3(sr, record); f.Add(record); } else { var record2 = new GlonassNavRecord(recordHeader); GlonassNaviFileReader.ParseFirstLineV3(line, record2); GlonassNaviFileReader.ReadRecordBodyV3(sr, record2); f.Add(record2); } } } } return(f); }
/// <summary> /// 返回指定时间段,文件记录的星历信息。 /// 需要计算,计算太多是否浪费资源? /// </summary> /// <param name="prn"></param> /// <param name="from"></param> /// <param name="to"></param> /// <returns></returns> public override List <Gnsser.Ephemeris> Gets(SatelliteNumber prn, Time from, Time to) { if (EphemerisUtil.IsEphemerisParam(prn.SatelliteType)) { return(this.ParamNavFileEphService.Gets(prn, from, to)); } return(this.GlonassNavFileEphService.Gets(prn, from, to)); }
/// <summary> /// 获取卫星位置 /// </summary> /// <param name="prn"></param> /// <param name="gpsTime"></param> /// <returns></returns> public override Ephemeris Get(SatelliteNumber prn, Time gpsTime) { if (EphemerisUtil.IsEphemerisParam(prn.SatelliteType)) { return(this.ParamNavFileEphService.Get(prn, gpsTime)); } return(this.GlonassNavFileEphService.Get(prn, gpsTime)); }
/// <summary> /// 指定时刻卫星是否健康可用。 /// </summary> /// <param name="prn"></param> /// <param name="gpsTime"></param> /// <returns></returns> public override bool IsAvailable(SatelliteNumber prn, Time gpsTime) { if (!this.Prns.Contains(prn)) { throw new Exception("星历数据源中没有包含指定的卫星:" + prn); } if (EphemerisUtil.IsEphemerisParam(prn.SatelliteType)) { return(this.ParamNavFileEphService.IsAvailable(prn, gpsTime)); } return(this.GlonassNavFileEphService.IsAvailable(prn, gpsTime)); }