Ejemplo n.º 1
0
        /// <summary>
        /// 将指定的导航文件转换成 RINEX V3.0字符串。
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        public static string BuidRinexV3String(GlonassNavFile file)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(BuildHeaderString(file.Header));
            foreach (var item in file.NavRecords)
            {
                sb.Append(BuildRinexRecordV4(item));
            }
            return(sb.ToString());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 读取GLONASS导航文件
        /// </summary>
        /// <param name="navFilePath">路径</param>
        /// <returns></returns>
        public static GlonassNavFile ReadFileV2V3(string navFilePath)
        {
            GlonassNavFile f = new GlonassNavFile();

            f.Header = ParamNavFileReader.ReadHeader(navFilePath);

            //测试版本
            if (f.Header.Version == 0)
            {
                using (StreamReader sr = new StreamReader(navFilePath, UnicodeEncoding.UTF8))
                {
                    RinexUtil.SkipHeader(sr);
                    try
                    {
                        GlonassNaviFileReader.ReadRecordV2(sr, f.Header);
                        GlonassNaviFileReader.ReadRecordV2(sr, f.Header);
                        //  f.Header.Version = 2.0;
                    }
                    catch
                    {
                        f.Header.Version = 1.0;
                    }
                }
            }

            using (StreamReader sr = new StreamReader(navFilePath, UnicodeEncoding.UTF8))
            {
                RinexUtil.SkipHeader(sr);

                while (sr.Peek() != -1)
                {
                    GlonassNavRecord record = null;
                    if (f.Header.Version < 3)
                    {
                        record = GlonassNaviFileReader.ReadRecordV2(sr, f.Header);
                    }
                    else if (f.Header.Version >= 3)
                    {
                        record = GlonassNaviFileReader.ReadRecordV3(sr, f.Header);
                    }
                    else
                    {
                        throw new ArgumentException(" 导航文件版本 " + f.Header.Version);
                    }
                    f.Add(record);
                }
            }
            return(f);
        }
 /// <summary>
 /// 构造函数
 /// </summary>
 public SingleGlonassNavFileEphService(GlonassNavFile GlonassNavFile)
 {
     this.NavFile = GlonassNavFile;
 }