Ejemplo n.º 1
0
        /// <summary>
        /// 读取文件
        /// </summary>
        /// <returns></returns>
        public Sp3File ReadAll()
        {
            this.Reset();

            Sp3File file = new Sp3File();

            file.Name   = Path.GetFileName(InputPath);
            file.Header = Header;

            //Time start = Time.MaxValue;
            //Time end = Time.MinValue;
            while (this.MoveNext())
            {
                var section = this.Current;

                if (section != null && section.Count != 0)
                {
                    file.Add(section);

                    //if (section.Time < start) start = section.Time;
                    //if (section.Time > end) end = section.Time;
                }
            }

            //file.TimePeriod = new BufferedTimePeriod(start, end);

            log.Info("完全加载了星历文件到内存 " + Name);
            return(file);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 将指定的Sp3转换成 RINEX V3.0字符串。
        /// </summary>
        /// <param name="file"></param>
        /// <param name="P_V_ModeFlag"></param>
        /// <returns></returns>
        public static string BuidSp3V3String(Sp3File file, string P_V_ModeFlag = "P")
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(BuildHeaderString(file.Header, P_V_ModeFlag));
            //Sp3Section sec = new Sp3Section();
            foreach (var item in file.Data.Values)
            {
                sb.AppendLine(BuildFirstLineSp3(item));
                foreach (var prn in file.Header.PRNs)
                {
                    Ephemeris sat = new Ephemeris();
                    if (item.Contains(prn))
                    {
                        sat = item[prn];
                    }
                    else
                    {
                        sat.Prn = prn;
                        sat.XYZ = new XYZ();

                        sat.ClockBias = 0.999999999999;
                    }
                    sb.Append(BuildSp3Record(sat, P_V_ModeFlag));
                }
                //foreach (Sp3Record rec in key.Data.Values)
                //{
                //    sb.Append(BuildSp3Record(rec, P_V_ModeFlag));
                //}
            }
            sb.Append("EOF");
            return(sb.ToString());
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="filePath"></param>
 /// <param name="Sp3File"></param>
 /// <param name="P_V_ModeFlag"></param>
 public Sp3Writer(string filePath, Sp3File Sp3File = null, string P_V_ModeFlag = "P")
 {
     this.FilePath      = filePath;
     this.StringBuilder = new StringBuilder();
     if (Sp3File != null)
     {
         this.Sp3Header = Sp3File.Header;
         this.StringBuilder.Append(BuidSp3V3String(Sp3File, P_V_ModeFlag));
     }
 }
Ejemplo n.º 4
0
        /// <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)
        {
            var data = Sp3File.Get(prn);
            List <Gnsser.Ephemeris> prnEphes = data.Values;

            if (prnEphes == null)
            {
                return(new List <Gnsser.Ephemeris>());
            }

            return(prnEphes.FindAll(m => m.Time >= from && m.Time <= to));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 初始化插值器
        /// </summary>
        private void Init()
        {
            var interval = Sp3File.Interval == 0 ? 1 : Sp3File.Interval; // Sp3Reader.Header.EpochInterval;

            WarnedPrns       = new List <SatelliteNumber>();
            EphemerisManager = new EphemerisManager(interval, MaxBreakingCount);
            Sp3File.TimePeriod.SetSameBuffer(interval * 10);

            foreach (var prn in Sp3File.Prns)
            {
                var storage = EphemerisManager.GetOrCreate(prn);

                var all = Sp3File.Get(prn);
                if (all == null || all.Count == 0)
                {
                    continue;
                }

                storage.Add(all.Values);
            }
        }