private void button_show_Click(object sender, EventArgs e)
        {
            if (ephemerisA == null)
            {
                Geo.Utils.FormUtil.ShowErrorMessageBox("读入数据 A 先!"); return;
            }
            if (ephemerisB == null)
            {
                Geo.Utils.FormUtil.ShowErrorMessageBox("读入数据 B 先!"); return;
            }

            if (this.comboBox_prn.SelectedItem == null)
            {
                Geo.Utils.FormUtil.ShowWarningMessageBox("没有共同卫星,无法比较!");
                return;
            }

            SatelliteNumber PRN = SatelliteNumber.Parse(this.comboBox_prn.SelectedItem.ToString());

            //每次取10个数计算
            sortedRecordsA = ephemerisA.Gets(PRN);
            sortedRecordsB = ephemerisB.Gets(PRN);//, new Time(this.TimeFrom.Value), new Time(this.TimeTo.Value));

            this.bindingSource1.DataSource = sortedRecordsA;
            this.bindingSource2.DataSource = sortedRecordsB;
            this.bindingSource3.DataSource = GetDifferEphemeirs(sortedRecordsA, sortedRecordsB);
        }
        private void button_read_Click(object sender, EventArgs e)
        {
            //try
            //{
            var path = this.fileOpenControl_eph.FilePath;

            if (!System.IO.File.Exists(path))
            {
                Geo.Utils.FormUtil.ShowWarningMessageBox("文件不存在!" + path);
                return;
            }
            dataSourse = EphemerisDataSourceFactory.Create(path);
            this.dataGridView1.DataSource  = bindingSource1;
            this.bindingSource1.DataSource = dataSourse.Gets();


            bindingSource_prn.DataSource = dataSourse.Prns;


            arrayCheckBoxControl_prns.Init(dataSourse.Prns);


            //设置时间间隔
            this.timePeriodControl1.SetTimePerid(dataSourse.TimePeriod);
            //}
            //catch (Exception ex)
            //{
            //    Geo.Utils.FormUtil.HandleException(ex, ex.Message);
            //}
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(Path.GetFileName(path) + ",卫星数量 : " + dataSourse.Prns.Count);

            var types = SatelliteNumber.GetSatTypes(dataSourse.Prns);

            types.Sort();
            foreach (var type in types)
            {
                var prns = dataSourse.GetPrns(type);
                prns.Sort();
                sb.AppendLine(type + " ,共" + prns.Count + " 颗:" + Geo.Utils.EnumerableUtil.ToString(prns, ","));
            }

            log.Info(sb.ToString());
        }
        private void button_read_Click(object sender, EventArgs e)
        {
            try
            {
                ephemerisA = EphemerisDataSourceFactory.Create(this.textBox_pathA.Text, FileEphemerisType.Unkown, false);
                ephemerisB = EphemerisDataSourceFactory.Create(this.textBox_pathB.Text, FileEphemerisType.Unkown, false);
                List <SatelliteNumber> commonPrns = ephemerisA.Prns.FindAll(m => ephemerisB.Prns.Contains(m));

                if (commonPrns.Count == 0)
                {
                    Geo.Utils.FormUtil.ShowWarningMessageBox("没有共同卫星,无法比较!");
                }

                this.bindingSource_prns.DataSource = commonPrns;
                this.bindingSource1.DataSource     = ephemerisA.Gets();
                this.bindingSource2.DataSource     = ephemerisB.Gets();
                //设置时间间隔
                this.dateTimePicker_from.Value = ephemerisA.TimePeriod.Start.DateTime > ephemerisB.TimePeriod.Start.DateTime ? ephemerisA.TimePeriod.Start.DateTime : ephemerisB.TimePeriod.Start.DateTime;
                this.dateTimePicker_to.Value   = ephemerisA.TimePeriod.End.DateTime < ephemerisB.TimePeriod.End.DateTime ? ephemerisA.TimePeriod.End.DateTime : ephemerisB.TimePeriod.End.DateTime;
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
Exemple #4
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);
        }
 private void button_show_Click(object sender, EventArgs e)
 {
     this.bindingSource1.DataSource = dataSourse.Gets(Prn, Time.Parse(TimeFrom), Time.Parse(TimeTo));
 }