示例#1
0
        public static ObsData ReadFile(string filepath)
        {
            ObsData data = new ObsData();

            try
            {
                string       line;
                string[]     strs;
                StreamReader sr = new StreamReader(filepath);
                //读椭球参数
                line = sr.ReadLine();
                strs = line.Split(',');
                double a = double.Parse(strs[1]);
                //因为str[0]等于a

                line = sr.ReadLine();
                strs = line.Split(',');
                double invF = double.Parse(strs[1]);
                //同理[0]为1/f
                var ell = new Ellipsoid(a, invF);
                data.Datum = ell;

                line = sr.ReadLine();
                strs = line.Split(',');

                data.L0 = GeoPro.Dms2Rad(double.Parse(strs[1]));
                line    = sr.ReadLine();

                PointInfo p;
                //方法调用?数据类型声明?定义?创建实例?
                while ((line = sr.ReadLine()) != null)
                {
                    p      = new PointInfo();//创建实例的一种方式?
                    strs   = line.Split(',');
                    p.Name = strs[0];
                    p.B    = GeoPro.Dms2Rad(double.Parse(strs[1]));
                    p.L    = GeoPro.Dms2Rad(double.Parse(strs[2]));
                    p.H    = double.Parse(strs[3]);
                    data.Data.Add(p);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(data);
        }
示例#2
0
 /// <summary>
 /// 增加一组记录
 /// </summary>
 /// <param name="record">一次测量记录</param>
 public void Add(PointInfo record)
 {
     Data.Add(record);
 }