Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <summary>
        /// RINEX 3.0 记录读取。
        /// </summary>
        /// <param name="sr">数据流</param>
        /// <param name="header">头部信息</param>
        /// <returns></returns>
        public static GlonassNavRecord ReadRecordV3(StreamReader sr, NavFileHeader header)
        {
            GlonassNavRecord record = new GlonassNavRecord();
            string           line   = sr.ReadLine();

            GlonassNaviFileReader.ParseFirstLineV3(line, record);

            return(ReadRecordBodyV3(sr, record));
        }