Пример #1
0
        /// <summary>
        /// 插值器
        /// </summary>
        /// <param name="prnStr"></param>
        /// <returns></returns>
        private ClockInterpolator GetClockInterpolator(string prnStr)
        {
            if (clockInterpolators.ContainsKey(prnStr))
            {
                return(clockInterpolators[prnStr]);
            }
            lock (locker2)
            {
                if (clockInterpolators.ContainsKey(prnStr))
                {
                    return(clockInterpolators[prnStr]);
                }
                if (SatelliteNumber.IsPrn(prnStr))
                {
                    var prn   = SatelliteNumber.Parse(prnStr);
                    var items = ClockFile.Get(prn);
                    if (items == null || items.Count == 0)
                    {
                        return(null);
                    }

                    var inter = new ClockInterpolator(items.Values);
                    clockInterpolators.TryAdd(prnStr, inter);
                    return(inter);
                }
            }

            return(null);
        }
Пример #2
0
        private void button_inter_Click(object sender, EventArgs e)
        {
            double             interval      = double.Parse(this.textBox_interval.Text);
            List <AtomicClock> sortedRecords = this.bindingSource_clk.DataSource as List <AtomicClock>;

            if (sortedRecords == null)
            {
                MessageBox.Show("请先读取,并删选数据。"); return;;
            }

            //    Data.ClockDataSource datasource = new Data.ClockDataSource(_clockFile);

            ClockInterpolator interp = new ClockInterpolator(sortedRecords, 2);

            this.Clocks = interp.GetAtomicClocks(Time.Parse(from), Time.Parse(to), interval);

            this.bindingSource_clk.DataSource = this.Clocks;
            string          name = this.comboBox_name.SelectedItem.ToString();
            SatelliteNumber prn  = SatelliteNumber.Parse(name);

            this.Ephemerides = sp3File.Gets(SatelliteNumber.Parse(name), Time.Parse(from), Time.Parse(to), interval);
            this.bindingSource_sp3.DataSource = Ephemerides;

            ShowComparing();
        }
Пример #3
0
        /// <summary>
        /// 是否可用
        /// </summary>
        /// <param name="prn"></param>
        /// <param name="time"></param>
        /// <returns></returns>
        public bool IsAvailable(SatelliteNumber prn, Time time)
        {
            string            prnStr            = prn.ToString();
            ClockInterpolator clockInterpolator = GetClockInterpolator(prnStr);

            if (!clockInterpolator.IsAvailable(time))
            {
                return(false);
            }
            return(true);
        }
Пример #4
0
        /// <summary>
        /// 根据接收机时间和位置,获取计算卫星发射时刻的位置。不计算相对地面的延迟。
        /// </summary>
        /// <param name="nameOrPrn">卫星编号</param>
        /// <param name="gpsTime">时间</param>
        /// <returns>如果返回 null,在表示计算失败</returns>
        public override AtomicClock Get(string nameOrPrn, Time gpsTime)
        {
            ClockInterpolator clockInterpolator = GetClockInterpolator(nameOrPrn);

            if (clockInterpolator == null || !clockInterpolator.IsAvailable(gpsTime))
            {
                return(null);
            }

            #region czs
            AtomicClock fittedClock = clockInterpolator.GetAtomicClock(gpsTime);
            #endregion

            return(fittedClock);
        }
Пример #5
0
        private void button_inter_Click(object sender, EventArgs e)
        {
            double             interval      = double.Parse(this.textBox_interval.Text);
            List <AtomicClock> sortedRecords = this.bindingSource1.DataSource as List <AtomicClock>;

            if (sortedRecords == null)
            {
                MessageBox.Show("请先读取,并删选数据。"); return;;
            }
            ClockInterpolator interp = new ClockInterpolator(sortedRecords);

            List <AtomicClock> fitedResult = new List <AtomicClock>();
            double             cacuCount   = (ClockFileTo - ClockFileFrom).TotalSeconds / interval;

            for (int xi = 0; xi <= cacuCount; xi++)
            {
                Time gpsTime = sortedRecords[0].Time + interval * xi;
                fitedResult.Add(interp.GetAtomicClock(gpsTime));
            }

            this.bindingSource1.DataSource = fitedResult;
        }
Пример #6
0
        /// <summary>
        /// 插值器
        /// </summary>
        /// <param name="prnStr"></param>
        /// <returns></returns>
        private ClockInterpolator GetClockInterpolator(string prnStr)
        {
            if (clockInterpolators.ContainsKey(prnStr))
            {
                return(clockInterpolators[prnStr]);
            }
            lock (locker2)
            {
                if (clockInterpolators.ContainsKey(prnStr))
                {
                    return(clockInterpolators[prnStr]);
                }

                var items = ClockFile.GetClockItems(prnStr);
                if (items == null || items.Count == 0)
                {
                    return(null);
                }

                var inter = new ClockInterpolator(items);
                clockInterpolators.TryAdd(prnStr, inter);
                return(inter);
            }
        }