Exemplo n.º 1
0
 /// <summary>
 /// 添加坐标
 /// </summary>
 /// <param name="p"></param>
 public void AddPosition(FramePosition p)
 {
     if (Contain(p))
     {
         allPositions.Add(p);
     }
 }
Exemplo n.º 2
0
        public void AddPosition(string sp)
        {
            FramePosition p = FramePosition.Parse(sp);

            if (Contain(p))
            {
                allPositions.Add(p);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 从字符串中解析出对象
        /// </summary>
        /// <param name="strValue"></param>
        /// <returns></returns>
        public static Track Parse(string strValue)
        {
            Track t = new RigourTech.Track();

            if (string.IsNullOrEmpty(strValue))
            {
                return(null);
            }

            string[] items = strValue.Split('|');
            if (items.Length != 6)
            {
                LogText.Error("Track.pase", "数据格式错误:" + strValue);
            }


            MatchCollection results = Regex.Matches(items[1], "[0-9]*,-?[0-9]*\\.[0-9]*,-?[0-9]*\\.[0-9]*,-?[0-9]*\\.[0-9]*");

            foreach (Match m in results)
            {
                t.Trace.Add(FramePosition.Parse(m.Value.Substring(0, m.Value.LastIndexOf(","))));
            }
            MatchCollection mtouchdownpoints = Regex.Matches(items[1], "-?[0-9]*\\.[0-9]*,-?[0-9]*\\.[0-9]*,-?[0-9]*\\.[0-9]*");

            if (mtouchdownpoints.Count == 2)
            {
                t.Touchdown_P1 = Point3D.Prase(mtouchdownpoints[0].Value);
                t.Touchdown_P2 = Point3D.Prase(mtouchdownpoints[1].Value);
            }
            else
            {
                LogText.Error("Track.pase", "数据格式错误:" + strValue);
            }
            MatchCollection mtimes = Regex.Matches(items[2], "[0-9]*");

            if (mtimes.Count == 2)
            {
                t.BeginTime = long.Parse(mtimes[0].Value);
                t.Endtime   = long.Parse(mtimes[1].Value);
            }
            else
            {
                LogText.Error("Track.pase", "数据格式错误:" + strValue);
            }

            t.TouchdonwMarkNumber = Regex.Match(items[3], "[0-9]?").Value;

            t.Radius = double.Parse(Regex.Match(items[3], "[0-9]*\\.[0-9]*").Value);

            t.MaxRotateSpeed = double.Parse(items[4]);
            return(t);
        }
Exemplo n.º 4
0
 /// <summary>
 /// 判断是否属于当前用户
 /// </summary>
 /// <param name="p"></param>
 /// <returns></returns>
 private bool Contain(FramePosition p)
 {
     return(user.X1 <= p.Position.X && user.X2 >= p.Position.X && user.Y1 <= p.Position.Y && user.Y2 >= p.Position.Y);
 }