/// <summary> /// 匹配人员坐标 /// </summary> /// <param name="SubjectString"></param> private void MatchPerson(string SubjectString) { try { string strPosition = Regex.Match(SubjectString, "\\|[0-9]*\\|-?[0-9]*\\.[0-9]*,-?[0-9]*\\.[0-9]*,-?[0-9]*\\.[0-9]*").Value; if (!string.IsNullOrEmpty(strPosition)) { FramePosition position = FramePosition.Parse(strPosition.Substring(1, strPosition.LastIndexOf("|") - 1), strPosition.Substring(strPosition.LastIndexOf("|") + 1)); if (position != null) { if (Rmode == Runmode.Match) { Cmatch?.AddPosition(position); } else if (rmode == Runmode.Train) { Ctrain?.AddPosition(position); } } } } catch (ArgumentException ex) { LogText.Error("MatchPerson", ex.Message); } }
/// <summary> /// 匹配人员坐标 /// </summary> /// <param name="SubjectString"></param> private void MatchPerson(string SubjectString) { try { string strPosition = Regex.Match(SubjectString, "\\|[0-9]*\\|-?[0-9]*\\.[0-9]*,-?[0-9]*\\.[0-9]*,-?[0-9]*\\.[0-9]*").Value; if (!string.IsNullOrEmpty(strPosition)) { FramePosition position = FramePosition.Parse(strPosition); if (position != null) { AddPosition(position); } } } catch (ArgumentException ex) { LogText.Error("MatchPerson", ex.Message); } }
/// <summary> /// 从字符串中解析出对象 /// </summary> /// <param name="strValue"></param> /// <returns></returns> public static Track Parse(string strValue) { Track t = new RigourTech.Service.Track(); if (string.IsNullOrEmpty(strValue)) { return(null); } t.TraceString = strValue; 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 (System.Text.RegularExpressions.Match m in results) { t.Trace.Add( FramePosition.Parse( m.Value.Substring(0, m.Value.IndexOf(",")), m.Value.Substring(m.Value.IndexOf(",") + 1) ) ); } MatchCollection mtouchdownpoints = Regex.Matches(items[2], "-?[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", "数据格式错误:" + items[2]); } MatchCollection mtimes = Regex.Matches(items[3], "[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", "数据格式错误:" + items[3]); } string[] vls = items[4].Split(';'); if (vls.Length == 2) { t.TouchdonwMarkNumber = vls[0]; t.Radius = double.Parse(vls[1]); } t.MaxRotateSpeed = double.Parse(items[5]); t.Direction = Convert.ToInt32(t.FirstPosition?.Position.Y - t.EndPosition?.Position.Y); LogText.Info("Track.prase", "成功解析出一条轨迹:方向{0},旋转速度{1},落地区域{2},半径{3}", t.direction, t.MaxRotateSpeed, t.TouchdonwMarkNumber, t.radius); return(t); }