예제 #1
0
        /// <summary>
        ///  to RINEX String,自动采用观测文件内容更新时间。
        /// </summary>
        /// <param name="obsFile"></param>
        /// <param name="minIntervalSeconds">最小采样率</param>
        public string GetRinexString(RinexObsFile obsFile, double version, int minIntervalSeconds = 0)
        {
            if (obsFile == null || obsFile.Count == 0)
            {
                return("");
            }

            this.Header = obsFile.Header;
            obsFile.Header.StartTime = obsFile[0].ReceiverTime;
            if (obsFile.Count > 1)
            {
                obsFile.Header.EndTime  = obsFile[obsFile.Count - 1].ReceiverTime;
                obsFile.Header.Interval = (obsFile[1].ReceiverTime - obsFile[0].ReceiverTime);
            }
            StringBuilder sb = new StringBuilder();

            sb.Append(ObsHeaderToRinexString(obsFile.Header, version));
            //更新采样率
            if (obsFile.Header.Interval < minIntervalSeconds)
            {
                obsFile.Header.Interval = minIntervalSeconds;
            }

            RinexEpochObservation prevEpochObs = null;
            int i = 0;

            foreach (var item in obsFile.ToArray())
            {
                if (item.Count == 0)
                {
                    continue;
                }

                if (prevEpochObs == null)
                {
                    prevEpochObs = item;
                }                                                 //第一次

                var differ = item.ReceiverTime - prevEpochObs.ReceiverTime;
                if (differ >= minIntervalSeconds || i == 0)
                {
                    if (version >= 3)
                    {
                        sb.Append(GetRecordStringV3(item));
                    }
                    else
                    {
                        sb.Append(GetRecordStringV2(item));
                    }

                    prevEpochObs = item;//roll
                }
                i++;
            }
            return(sb.ToString());
        }
예제 #2
0
        public string Build(RinexObsFile file)
        {
            var header = file.Header;

            file.UpdateAndGetHeaderTimePeriodWithContentTime();
            file.CheckOrUpdateAndGetHeaderIntervalWithContent();
            file.Header.TrySetAndGetContryCodeWithFileName();

            return(Build(header));
        }
예제 #3
0
 /// <summary>
 /// 写入文件
 /// </summary>
 /// <param name="obsFile"></param>
 /// <param name="path"></param>
 /// <param name="verion"></param>
 /// <param name="minInterval"></param>
 public static void Write(RinexObsFile obsFile, string path, double verion = -1, int minInterval = 1)
 {
     if (verion < 2)
     {
         verion = obsFile.Header.Version;
     }
     using (RinexObsFileWriter writer = new RinexObsFileWriter(path, verion))
     {
         writer.Write(obsFile, minInterval);
     }
 }
예제 #4
0
        /// <summary>
        /// 以单观测文件路径构建。
        /// </summary>
        /// <param name="ObsFile">文件</param>
        public MemoRinexFileObsDataSource(RinexObsFile ObsFile)
        {
            this.ObsFile = ObsFile;
            EnumCount    = int.MaxValue / 2;
            if (ObsFile.Header != null)
            {
                this.Name     = ObsFile.Header.MarkerName;
                this.Header   = ObsFile.Header;
                this.SiteInfo = Header.SiteInfo;
                this.ObsInfo  = Header.ObsInfo;

                this.NavPath = Header.NavFilePath;
            }
            this.EpochInfoBuilder = new RinexEpochInfoBuilder(this.ObsInfo.SatelliteTypes);
        }
예제 #5
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);
        }
예제 #6
0
        private void DrawLine()
        {
            this.chart1.ChartAreas[0].AxisY.CustomLabels.Clear();
            lonLats.Clear();

            int i = 0;

            foreach (KeyValuePair <string, string> kv in pathes)
            {
                if (this.chart1.Series.FindByName(kv.Key) != null)
                {
                    continue;
                }

                Gnsser.Data.Rinex.RinexObsFile obsFile = (Data.Rinex.RinexObsFile) new Data.Rinex.RinexObsFileReader(kv.Value).ReadObsFile();

                //文件的物理路径所在文件夹路径
                string paths    = kv.Value;
                string tmp      = paths.Substring(0, paths.LastIndexOf("\\"));
                string orfolder = paths.Substring(0, paths.LastIndexOf("\\") + 1);
                string folder   = orfolder.Replace("\\", "\\\\");

                if (obsFile.StartTime == Time.Default || obsFile.EndTime == Time.Default)
                {
                    continue;
                }
                if (obsFile.Header.ApproxXyz != null)
                {
                    GeoCoord gCoord = CoordTransformer.XyzToGeoCoord(obsFile.Header.ApproxXyz);
                    lonLats.Add(gCoord);
                }

                DateTime first = obsFile.StartTime.DateTime;
                DateTime last  = obsFile.EndTime.DateTime;

                Series series = new Series(kv.Key);
                //series.BorderWidth = 6;
                //series.ShadowOffset = 2;
                series.ChartType  = SeriesChartType.RangeBar;
                series.YValueType = ChartValueType.DateTime;
                series.XValueType = ChartValueType.Int32;
                series.ChartArea  = "ChartArea1";

                // Set axis labels
                // chart1.ChartAreas[0].AxisY.
                //series.AxisLabel = "Month: #VALX{MMM}\nDay: #VALX{dd}";

                // series.AxisX.IsMarginVisible = true;

                this.chart1.Series.Add(series);

                //Y轴自定义标签。
                //CustomLabel c = new CustomLabel(xi-1, xi+1, kv.Key, 1, LabelMarkStyle.None);
                //this.chart1.ChartAreas[0].AxisY.CustomLabels.Add(c);

                DataPoint point = new DataPoint();
                point.SetValueXY(i + 1, first, last);
                point.AxisLabel = kv.Key;

                series.Points.Add(point);
                i++;
            }
        }
예제 #7
0
 /// <summary>
 /// 追加
 /// </summary>
 /// <param name="recs"></param>
 public void Add(RinexObsFile recs)
 {
     this.Header.EndTime = recs.EndTime;
     Add(recs._data);
 }
예제 #8
0
 /// <summary>
 /// 处理过程
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public override bool Revise(ref RinexObsFile obsFile)
 {
     //this.Message = ObsFileTypeManager.RemoveObserversInfo(ref obsFile, MaxPercentage * 0.01);
     this.Message = ObsFileCountManager.RemoveObserversInfo(ref obsFile, MaxPercentage * 0.01);
     return(true);
 }
예제 #9
0
        /// <summary>
        /// 写文件
        /// </summary>
        /// <param name="Writer"></param>
        /// <param name="obsFile"></param>
        /// <param name="version"></param>
        /// <param name="minIntervalSeconds"></param>
        public void Write(StreamWriter Writer, RinexObsFile obsFile, double version, int minIntervalSeconds = 0)
        {
            string rinex = GetRinexString(obsFile, version, minIntervalSeconds);

            Writer.Write(rinex);
        }
예제 #10
0
 /// <summary>
 /// 写入到指定的文件路径
 /// </summary>
 /// <param name="obsFile"></param>
 /// <param name="minIntervalSeconds"></param>
 public void Write(RinexObsFile obsFile, int minIntervalSeconds = 0)
 {
     Write(Writer, obsFile, obsFile.Header.Version, minIntervalSeconds);
 }