コード例 #1
0
        /// <summary>
        /// 分析文件路径最后一个字符,判断导航文件的类型。
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        public static FileEphemerisType GetFileEphemerisTypeFromPath(string filePath)
        {
            FileEphemerisType type = FileEphemerisType.Unkown;
            char lastChar          = filePath.ToUpper()[filePath.Length - 1];

            switch (lastChar)
            {
            case 'P':
                type = FileEphemerisType.Mixed;
                break;

            case 'N':
                type = FileEphemerisType.GpsNFile;
                break;

            case 'R':
            case 'C':
                type = FileEphemerisType.Compass;
                break;

            case 'G':
                type = FileEphemerisType.Glonass;
                break;

            case '3':     //sp3
            case 'H':     //eph
                type = FileEphemerisType.Sp3;
                break;

            default: break;
            }
            return(type);
        }
コード例 #2
0
        /// <summary>
        /// 自动判断路径文件类型,进行星历数据源类的初始化。
        /// </summary>
        /// <param name="naviFilePath"></param>
        /// <param name="fileType"></param>
        /// <param name="IsAvailableOnly"></param>
        /// <param name="MinSequentialSatCount"></param>
        /// <param name="MaxBreakingCount"></param>
        /// <param name="ephInterOrder"></param>
        /// <returns></returns>
        public static FileEphemerisService  Create(string naviFilePath,
                                                   FileEphemerisType fileType = FileEphemerisType.Unkown,
                                                   bool IsAvailableOnly       = true,
                                                   int MinSequentialSatCount  = 11,
                                                   int MaxBreakingCount       = 5,
                                                   int ephInterOrder          = 10
                                                   )
        {
            if (!File.Exists(naviFilePath) || new FileInfo(naviFilePath).Length == 0)
            {
                return(null);
            }

            var fileName = Path.GetFileName(naviFilePath);

            if (FileEphemerisServicePool.Contains(fileName))
            {
                return(FileEphemerisServicePool[fileName]);
            }

            //如果没有手动指定,则自动判断,大多数情况下是可行的。
            if (fileType == FileEphemerisType.Unkown)
            {
                fileType = GetFileEphemerisTypeFromPath(naviFilePath);
            }

            FileEphemerisService ephemerisFile = null;

            switch (fileType)
            {
            case FileEphemerisType.Mixed:
                var reader2 = new MixedNavFileReader(naviFilePath);
                ephemerisFile = new MixedNavFileEphService(reader2.ReadGnssNavFlie());
                break;

            case FileEphemerisType.Compass:
            case FileEphemerisType.Galileo:
            case FileEphemerisType.GpsNFile:
                ParamNavFileReader reader = new ParamNavFileReader(naviFilePath);
                ephemerisFile = new SingleParamNavFileEphService(reader.ReadGnssNavFlie());
                break;

            case FileEphemerisType.Glonass:
                ephemerisFile = new SingleGlonassNavFileEphService(new GlonassNaviFileReader(naviFilePath).Read());
                break;

            case FileEphemerisType.Sp3:
                //MinSequentialSatCount = 11, int MaxBreakingCount = 5
                ephemerisFile = new SingleSp3FileEphService(naviFilePath, MinSequentialSatCount, MaxBreakingCount, IsAvailableOnly, ephInterOrder); break;

            default: break;
            }
            FileEphemerisServicePool[fileName] = ephemerisFile;

            return(ephemerisFile);
        }
コード例 #3
0
ファイル: BaseLinePositionForm.cs プロジェクト: yxw027/GNSSer
        /// <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);
        }
コード例 #4
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
        }