Beispiel #1
0
        /// <summary>
        /// 数据源读取
        /// </summary>
        private void LoadDataSource()
        {
            startTime = DateTime.Now;

            //星历数据源
            ephemerisDataSource = null;
            if (IsSetEphemerisFile)//读取星历数据
            {
                string            ephemerisPath = this.textBox_navPath.Text;
                FileEphemerisType ephType       = EphemerisDataSourceFactory.GetFileEphemerisTypeFromPath(ephemerisPath);
                ephemerisDataSource = EphemerisDataSourceFactory.Create(ephemerisPath);
            }
            //加载文件数据
            this.rovPath          = this.textBox_obsFile_rov.Text;
            this.RefObsDataSource = new RinexFileObsDataSource(this.textBox_obsPath_ref.Text);
            this.RovObsDataSource = new RinexFileObsDataSource(rovPath);

            //使用外部设置的概略坐标。
            if (this.rmsedXyzControl_rov.IsEnabled)
            {
                this.RovObsDataSource.SiteInfo.SetApproxXyz(this.rmsedXyzControl_rov.RmsedXyz.Value);
                this.RovObsDataSource.SiteInfo.EstimatedXyzRms = this.rmsedXyzControl_rov.RmsedXyz.Rms;
            }
            //概略坐标显示到界面上。
            rmsedXyzControl_rov.SetRmsedXyz(new RmsedXYZ(RovObsDataSource.SiteInfo.ApproxXyz, RovObsDataSource.SiteInfo.EstimatedXyzRms));


            //使用外部设置的概略坐标。
            if (this.rmsedXyzControl_ref.IsEnabled)
            {
                this.RefObsDataSource.SiteInfo.SetApproxXyz(this.rmsedXyzControl_ref.RmsedXyz.Value);
                this.RefObsDataSource.SiteInfo.EstimatedXyzRms = this.rmsedXyzControl_ref.RmsedXyz.Rms;
            }
            //概略坐标显示到界面上。
            rmsedXyzControl_ref.SetRmsedXyz(new RmsedXYZ(RefObsDataSource.SiteInfo.ApproxXyz, RefObsDataSource.SiteInfo.EstimatedXyzRms));



            //检查是否读取钟差数据
            clockFile = null;
            if (this.checkBox_enableClockFile.Checked)
            {
                clockFile = new Data.SimpleClockService(this.textBox_ClockPath.Text);
            }

            TimeSpan span = DateTime.Now - startTime;

            ShowInfo("数据已读入,时间(秒):" + span.TotalSeconds);
        }
Beispiel #2
0
        /// <summary>
        /// 创建单点定位
        /// </summary>
        /// <param name="obsPath">测站信息</param>
        /// <param name="startTime">起始计算时间</param>
        /// <returns></returns>
        private IonFreeDoubleDifferPositioner BuildPositioner(string obsPath, RinexFileObsDataSource refStationPath, BufferedTimePeriod startTime)
        {
            GnssProcessOption PositionOption = GetModel(startTime);

            #region 星历钟差数据源配置
            #region 星历数据配置
            FileEphemerisService ephemerisDataSource = null;
            if (IsSetEphemerisFile)
            {
                string ephemerisPath = this.textBox_navPath.Text;
                if (!File.Exists(ephemerisPath))
                {
                    throw new FileNotFoundException("指定星历文件不存在!\r\n" + ephemerisPath);
                }
                FileEphemerisType ephType = EphemerisDataSourceFactory.GetFileEphemerisTypeFromPath(ephemerisPath);
                ephemerisDataSource = EphemerisDataSourceFactory.Create(ephemerisPath);
            }
            #endregion
            #region 钟差数据配置
            Data.ISimpleClockService clock = null;
            if (this.checkBox_enableClockFile.Checked)
            {
                clock = new Data.SimpleClockService(this.textBox_ClockPath.Text);
            }
            #endregion
            #endregion

            #region 定位器构造


            //加载文件数据
            RinexFileObsDataSource refObservationDataSource = (refStationPath);

            var rovObservationDataSource = new RinexFileObsDataSource(obsPath);

            DataSourceContext             context = DataSourceContext.LoadDefault(PositionOption, rovObservationDataSource, ephemerisDataSource, clock);
            IonFreeDoubleDifferPositioner pp      = new IonFreeDoubleDifferPositioner(context, PositionOption);

            //pp.Produced += pp_ProgressIncreased;
            return(pp);

            #endregion
        }
Beispiel #3
0
        private void button_read_Click(object sender, EventArgs e)
        {
            bool fillWithZero = checkBox1.Checked;
            var  intervalSec  = int.Parse(textBox_interval.Text) * 60;
            var  directory    = this.directorySelectionControl1.Path;

            Geo.Utils.FileUtil.CheckOrCreateDirectory(directory);

            var prns = SatelliteNumber.ParsePRNsBySplliter(textBox_satPrns.Text, new char[] { ',' });
            Dictionary <SatelliteNumber, StreamWriter> prnWriters = new Dictionary <SatelliteNumber, StreamWriter>();


            string[] pathes         = this.textBox_Pathes.Lines;
            string   fileName       = Path.GetFileName(pathes[0]).Substring(0, 3);
            string   firstDayOfWeek = Path.GetFileNameWithoutExtension(pathes[0]).Substring(3, 5);
            string   lastDayOfWeek  = Path.GetFileNameWithoutExtension(pathes[pathes.Length - 1]).Substring(3, 5);
            string   timePeriod     = firstDayOfWeek + "-" + lastDayOfWeek;

            string type = EphemerisDataSourceFactory.GetFileEphemerisTypeFromPath(pathes[0]).ToString();

            foreach (var item in prns)
            {
                var path = Path.Combine(directory, item.ToString() + "-" + fileName + "." + type + timePeriod + ".txt");
                prnWriters[item] = new StreamWriter(new FileStream(path, FileMode.Create));
            }

            Time start = Time.MaxValue;

            foreach (var path in pathes)
            {
                singleColl = EphemerisDataSourceFactory.Create(path);
                Time start0 = singleColl.TimePeriod.Start;
                Time end0   = singleColl.TimePeriod.End + intervalSec;
                if (start < start0)
                {
                    start0 = start;
                }
                foreach (var prn in prns)
                {
                    var writer = prnWriters[prn];

                    var all = singleColl.Gets(prn, start0, end0);
                    if (all == null)
                    {
                        continue;
                    }
                    for (Time i = start0; i < end0; i = i + intervalSec)
                    {
                        var find = all.SingleOrDefault(m => m.Time == i);
                        if (find == null)
                        {
                            if (!fillWithZero)
                            {
                                continue;
                            }

                            find = new Ephemeris()
                            {
                                Time = i, Prn = prn
                            };
                        }
                        writer.WriteLine(find.GetTabValues());
                    }
                }
                start = end0;
            }

            foreach (var item in prnWriters)
            {
                item.Value.Flush();
                item.Value.Close();
            }

            Geo.Utils.FileUtil.OpenDirectory(directory);
        }