コード例 #1
0
        private void button_run_Click(object sender, EventArgs e)
        {
            try
            {
                var files  = this.fileOpenControlA.FilePathes;
                var output = this.fileOutputControl1.FilePath;
                using (var writer = new GnsserXyzCoordWriter(output))
                {
                    writer.WriteHeaderLine();

                    List <NamedXyz> coords = new List <NamedXyz>();
                    foreach (var item in files)
                    {
                        var reader = new GnsserXyzCoordReader(item);
                        var all    = reader.ReadAll();
                        foreach (var item1 in all)
                        {
                            writer.Write(item1);
                        }
                    }
                    writer.Close();
                }
                Geo.Utils.FormUtil.ShowIfOpenDirMessageBox(output);
            }
            catch (Exception ex)
            {
                Geo.Utils.FormUtil.ShowWarningMessageBox("抱歉不支持这种格式," + ex.Message);
            }
        }
コード例 #2
0
        private void button_run_Click(object sender, EventArgs e)
        {
            try
            {
                var files  = this.fileOpenControlA.FilePathes;
                var output = this.fileOutputControl1.FilePath;
                List <GnsserXyzCoord> coords = new List <GnsserXyzCoord>();

                using (GnsserXyzCoordWriter writer = new GnsserXyzCoordWriter(output))
                {
                    writer.WriteHeaderLine();

                    foreach (var item in files)
                    {
                        GnsserXyzCoordReader reader = new GnsserXyzCoordReader(item);
                        var all = reader.ReadAll();
                        coords.AddRange(all);

                        //foreach (var item1 in all)
                        //{
                        //    writer.Write(item1);
                        //}
                    }

                    Dictionary <string, List <GnsserXyzCoord> > dic = new Dictionary <string, List <GnsserXyzCoord> >();
                    foreach (var coord in coords)
                    {
                        if (!dic.ContainsKey(coord.Id))
                        {
                            dic.Add(coord.Id, new List <GnsserXyzCoord>());
                        }
                        dic[coord.Id].Add(coord);
                    }

                    foreach (var item in dic)
                    {
                        var ave = GnsserXyzCoord.Average(item.Value);
                        writer.Write(ave);
                    }
                }

                Geo.Utils.FormUtil.ShowIfOpenDirMessageBox(output);
            }
            catch (Exception ex)
            {
                Geo.Utils.FormUtil.ShowWarningMessageBox("抱歉不支持这种格式," + ex.Message);
            }
        }