Exemple #1
0
        /// <summary>
        /// NUM  STATION NAME           VX (M/Y)       VY (M/Y)       VZ (M/Y)  FLAG   PLATE
        /// 1  ALGO 40104M002          -0.0154        -0.0054         0.0043    IG00 NOAM
        /// </summary>
        /// <param name="line"></param>
        /// <returns></returns>
        public static VelItem ParseLine(string line)
        {
            string[] strs = line.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            int     i     = 0;
            VelItem coord = new VelItem()
            {
                Num         = int.Parse(strs[i++]),
                StationName = strs[i++],
                Code        = strs[i++],
                Vxyz        = new XYZ(
                    double.Parse(strs[i++]),
                    double.Parse(strs[i++]),
                    double.Parse(strs[i++])
                    )
            };

            if (strs.Length > i)
            {
                coord.Flag = strs[i++];
            }
            if (strs.Length > i)
            {
                coord.Plate = strs[i++];
            }
            return(coord);
        }
Exemple #2
0
 /// <summary>
 /// 添加。
 /// </summary>
 /// <param name="key"></param>
 public void Add(VelItem item)
 {
     if (!Items.Contains(item))
     {
         Items.Add(item);
     }
 }
Exemple #3
0
        /// <summary>
        /// 是否相等
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            VelItem o = obj as VelItem;

            if (o == null)
            {
                return(false);
            }

            return(StationName.Equals(o.StationName));
        }
Exemple #4
0
        /// <summary>
        /// 读取Bernese速度文件
        /// </summary>
        /// <param name="stream"></param>
        /// <returns></returns>
        public static VelFile Read(Stream stream)
        {
            VelFile file = new VelFile();

            if (file.Comments == null)
            {
                file.Comments = new List <string>();
            }

            using (StreamReader reader = new StreamReader(stream))
            {
                string line;
                //第一行
                //PPP_021430_143MATE                                               24-JAN-13 09:21
                line            = reader.ReadLine();
                file.Label      = line.Substring(0, 65).Trim();
                file.DateString = line.Substring(65).Trim();

                //第二行
                //--------------------------------------------------------------------------------
                line = reader.ReadLine();

                //第3行
                //LOCAL GEODETIC DATUM: IGS00             EPOCH: 2002-05-23 11:57:30
                line = reader.ReadLine();
                if (line.Contains("DATUM"))
                {
                    file.Datum = line.Substring(line.IndexOf(":") + 1, 15).Trim();
                }
                if (line.Contains("EPOCH"))
                {
                    file.Epoch = new Time(DateTime.Parse(line.Substring(line.IndexOf("EPOCH") + 6)));
                }

                while ((line = reader.ReadLine()) != null)
                {
                    //正式记录
                    if (line.StartsWith("NUM"))
                    {
                        file.Items = new List <VelItem>();
                        line       = reader.ReadLine();//空了一行。
                        while (line != null)
                        {
                            line = line.Trim();
                            if (line == "")
                            {
                                line = reader.ReadLine();
                                continue;
                            }

                            VelItem coord = VelItem.ParseLine(line);
                            file.Items.Add(coord);

                            line = reader.ReadLine();
                            if (line == "")
                            {
                                break;            //跳出
                            }
                        }

                        //末尾有些东西
                        while ((line = reader.ReadLine()) != null)
                        {
                            file.Comments.Add(line);
                        }
                    }
                }
                return(file);
            }
        }