Exemple #1
0
        /// <summary>
        /// 读取数据
        /// </summary>
        public static Data.Rinex.RinexObsFile ReadFile(string ObsPath)
        {
            Data.Rinex.RinexObsFile ObsFile = null;
            string lastChar  = Gdp.Utils.StringUtil.GetLastChar(ObsPath);
            string lastChar3 = Gdp.Utils.StringUtil.GetLastChar(ObsPath, 3);
            string lastChar5 = Gdp.Utils.StringUtil.GetLastChar(ObsPath, 5);

            if (String.Equals(lastChar, "o", StringComparison.CurrentCultureIgnoreCase) || String.Equals(lastChar3, "rnx", StringComparison.CurrentCultureIgnoreCase))
            {
                var obsFileReader = new RinexObsFileReader(ObsPath);
                ObsFile = obsFileReader.ReadObsFile();
            }

            //if (String.Equals(lastChar, "z", StringComparison.CurrentCultureIgnoreCase)
            //    || String.Equals(lastChar3, "crx", StringComparison.CurrentCultureIgnoreCase)
            //    || String.Equals(lastChar5, "crx.gz", StringComparison.CurrentCultureIgnoreCase)
            //    )
            //{
            //    Gdp.IO.InputFileManager inputFileManager = new Gdp.IO.InputFileManager(Setting.TempDirectory);
            //    ObsPath = inputFileManager.GetLocalFilePath(ObsPath, "*.*o;*.rnx", "*.*");
            //    var obsFileReader = new RinexObsFileReader(ObsPath);
            //    ObsFile = obsFileReader.ReadObsFile();
            //}
            //if (String.Equals(lastChar, "s", StringComparison.CurrentCultureIgnoreCase))
            //{
            //    ObsFile = new TableObsFileReader(ObsPath).Read();
            //}
            if (ObsFile == null)
            {
                throw new Exception("不支持输入文件格式!");
                return(ObsFile);
            }
            return(ObsFile);
        }
Exemple #2
0
        protected override void Run(string inputPath)
        {
            base.Run(inputPath);

            var obsFileReader = new RinexObsFileReader(inputPath);
            var ObsFile       = obsFileReader.ReadObsFile();
            var table         = new ObsFileToTableBuilder().Build(ObsFile);

            ObjectTableManager mgr = new ObjectTableManager(this.OutputDirectory);

            mgr.Add(table);
            mgr.WriteAllToFileAndClearBuffer();
            // Geo.Utils.FormUtil.ShowOkAndOpenDirectory(mgr.OutputDirectory);
        }
Exemple #3
0
        /// <summary>
        /// 读取数据
        /// </summary>
        private void ReadFile()
        {
            string lastChar  = Geo.Utils.StringUtil.GetLastChar(ObsPath);
            string lastChar3 = Geo.Utils.StringUtil.GetLastChar(ObsPath, 3);
            string lastChar5 = Geo.Utils.StringUtil.GetLastChar(ObsPath, 5);

            if (String.Equals(lastChar, "o", StringComparison.CurrentCultureIgnoreCase) || String.Equals(lastChar3, "rnx", StringComparison.CurrentCultureIgnoreCase))
            {
                obsFileReader = new RinexObsFileReader(ObsPath);
                ObsFile       = obsFileReader.ReadObsFile();
            }

            if (String.Equals(lastChar, "z", StringComparison.CurrentCultureIgnoreCase) ||
                String.Equals(lastChar3, "crx", StringComparison.CurrentCultureIgnoreCase) ||
                String.Equals(lastChar5, "crx.gz", StringComparison.CurrentCultureIgnoreCase)
                )
            {
                Geo.IO.InputFileManager inputFileManager = new Geo.IO.InputFileManager(Setting.TempDirectory);
                this.ObsPath  = inputFileManager.GetLocalFilePath(ObsPath, "*.*o;*.rnx", "*.*");
                obsFileReader = new RinexObsFileReader(ObsPath);
                ObsFile       = obsFileReader.ReadObsFile();
            }

            if (String.Equals(lastChar, "s", StringComparison.CurrentCultureIgnoreCase))
            {
                ObsFile = new TableObsFileReader(ObsPath).Read();
            }
            if (ObsFile == null)
            {
                Geo.Utils.FormUtil.ShowWarningMessageBox("不支持输入文件格式!");
                return;
            }

            this.bindingSource_obsInfo.DataSource = ObsFile;
            var prns = ObsFile.GetPrns();

            prns.Sort();
            this.bindingSource_sat.DataSource = prns;

            this.attributeBox1.DataGridView.DataSource = Geo.Utils.ObjectUtil.GetAttributes(ObsFile.Header, false);

            string msg = "";

            msg += "首次观测时间:" + ObsFile.Header.StartTime + "\r\n";
            msg += "最后观测时间:" + ObsFile.Header.EndTime + "\r\n";
            msg += "采样间隔:" + ObsFile.Header.Interval + " 秒" + "\r\n";

            this.textBox_show.Text = msg;
        }
Exemple #4
0
        /// <summary>
        /// 重写头部信息
        /// </summary>
        /// <param name="header"></param>
        public void ReWriteHeader(RinexObsFileHeader header)
        {
            this.Dispose();
            //读取
            RinexObsFile obsFile = null;

            using (RinexObsFileReader reader = new RinexObsFileReader(this.FilePath))
            {
                obsFile         = reader.ReadObsFile();
                header.ObsCodes = obsFile.Header.ObsCodes;
                obsFile.Header  = header;
            }
            //重写
            this.Writer = new StreamWriter(FilePath, false, Encoding.ASCII);
            this.Write(obsFile);
        }