private List <PassLine> GetAnalysePassLine(string xml) { List <PassLine> pslineList = new List <PassLine> { }; if (string.IsNullOrEmpty(xml)) { return(pslineList); } System.Xml.XmlDocument xmldoc = new System.Xml.XmlDocument(); xmldoc.LoadXml(xml); System.Xml.XmlNode item = xmldoc.SelectSingleNode("root/AlgorithmInitParam/BeyondLine/Line"); checkEditPassLine.Checked = item.SelectSingleNode("OutputResult").InnerText == "TRUE"; TimePassline.Checked = item.SelectSingleNode("OutputResult").InnerText == "TRUE"; InputPassLine.Text = item.SelectSingleNode("TimelyReportTimeInterval").InnerText; // 是否正向 AllowPosBeyond.Checked = item.SelectSingleNode("PosBeyond").InnerText == "TRUE"; // 是否反向 AllowNegBeyond.Checked = item.SelectSingleNode("NegBeyond").InnerText == "TRUE"; btnCheckPosBeyond.Checked = item.SelectSingleNode("HumanSuperscale/PosBeyond/Enable").InnerText == "TRUE"; if (btnCheckPosBeyond.Checked) { PosBeyondUnitTime.Text = item.SelectSingleNode("HumanSuperscale/PosBeyond/UnitTime").InnerText; PosBeyondUpperLimit.Text = item.SelectSingleNode("HumanSuperscale/PosBeyond/UpperLimit").InnerText; } btnCheckNegBeyond.Checked = item.SelectSingleNode("HumanSuperscale/NegBeyond/Enable").InnerText == "TRUE"; if (btnCheckNegBeyond.Checked) { NegBeyondUnitTime.Text = item.SelectSingleNode("HumanSuperscale/NegBeyond/UnitTime").InnerText; NegBeyondUpperLimit.Text = item.SelectSingleNode("HumanSuperscale/NegBeyond/UpperLimit").InnerText; } PassLine pslint = PassLine.LoadFromXml(item); Point temp = pslint.DirectLineStart; pslint.DirectLineStart = pslint.DirectLineEnd; pslint.DirectLineEnd = temp; pslint.PassLineType = 0; pslineList.Add(pslint); return(pslineList); }
public void SetPicDrawData(DrawGraphType type, object o) { int nModeSel = 0; int strTypeID = 0; string strTypeName = ""; string strBody = ""; string strSelTextH = "<GraphData>" + System.Environment.NewLine + "<GraphTypeInfo typeid =\"{1}\" >" + System.Environment.NewLine + "<GraphTypeItem pattern=\"{0}\" graphname=\"{2}\">" + System.Environment.NewLine; string strSelTextT = "</GraphTypeItem>" + System.Environment.NewLine + "</GraphTypeInfo>" + System.Environment.NewLine + "</GraphData>" + System.Environment.NewLine; bool needDraw = true; switch (type) { case DrawGraphType.AnalyseAreaEx: Rectangle rect = (Rectangle)o; if (rect != null) { Point p1 = rect.Location; Point p2 = new Point(p1.X + rect.Width, p1.Y); Point p3 = new Point(p2.X, p2.Y + rect.Height); Point p4 = new Point(p1.X, p1.Y + rect.Height); strBody = "<PointList>" + System.Environment.NewLine + "<Point>" + p1.X + "," + p1.Y + "</Point>" + System.Environment.NewLine + "<Point>" + p2.X + "," + p2.Y + "</Point>" + System.Environment.NewLine + "<Point>" + p3.X + "," + p3.Y + "</Point>" + System.Environment.NewLine + "<Point>" + p4.X + "," + p4.Y + "</Point>" + System.Environment.NewLine + "</PointList>" + System.Environment.NewLine; } else { needDraw = false; } nModeSel = 3; strTypeName = "检测区域"; strTypeID = (int)type; break; case DrawGraphType.PassLine: nModeSel = 7; strTypeID = (int)type; strTypeName = "越界线"; PassLine pl = o as PassLine; if (pl != null) { strBody = "<PointList>" + System.Environment.NewLine + "<Point>" + pl.PassLineStart.X + "," + pl.PassLineStart.Y + "</Point>" + System.Environment.NewLine + "<Point>" + pl.PassLineEnd.X + "," + pl.PassLineEnd.Y + "</Point>" + System.Environment.NewLine + "</PointList>" + System.Environment.NewLine + "<LineDirection>" + pl.PassLineType + "</LineDirection>" + System.Environment.NewLine + "<StartPoint>" + pl.DirectLineStart.X + "," + pl.DirectLineStart.Y + "</StartPoint>" + System.Environment.NewLine + "<EndPoint>" + pl.DirectLineEnd.X + "," + pl.DirectLineEnd.Y + "</EndPoint>" + System.Environment.NewLine; } else { needDraw = false; } break; case DrawGraphType.PassRegion: nModeSel = 3; strTypeID = (int)type; strTypeName = "闯入闯出"; BreakRegion br = o as BreakRegion; if (br != null) { string poings = ""; foreach (Point p in br.RegionPointList) { poings += "<Point>" + p.X + "," + p.Y + "</Point>" + System.Environment.NewLine; } strBody += "<PointList>" + System.Environment.NewLine + poings + "</PointList>" + System.Environment.NewLine + "<PolygonDirection>" + br.RegionType + "</PolygonDirection>" + System.Environment.NewLine; } else { needDraw = false; } break; case DrawGraphType.DriveWay1: case DrawGraphType.DriveWay2: case DrawGraphType.DriveWay3: case DrawGraphType.DriveWay4: case DrawGraphType.DriveWay5: case DrawGraphType.DriveWay6: nModeSel = 5; strTypeID = (int)type; strTypeName = "车道" + (strTypeID - 10); DriveWayRegion dwr = o as DriveWayRegion; if (dwr != null) { string poings = ""; foreach (Point p in dwr.RegionPointList) { poings += "<Point>" + p.X + "," + p.Y + "</Point>" + System.Environment.NewLine; } strBody = "<PointList>" + System.Environment.NewLine + poings + "</PointList>" + System.Environment.NewLine + "<Angle></Angle>" + System.Environment.NewLine + "<StartPoint>" + dwr.DirectLineStart.X + "," + dwr.DirectLineStart.Y + "</StartPoint>" + System.Environment.NewLine + "<EndPoint>" + dwr.DirectLineEnd.X + "," + dwr.DirectLineEnd.Y + "</EndPoint>" + System.Environment.NewLine; } else { needDraw = false; } break; case DrawGraphType.VehicleRegion: nModeSel = 3; strTypeID = (int)type; strTypeName = "车牌检测区"; Rectangle vehrect = (Rectangle)o; if (vehrect != null) { Point p1 = vehrect.Location; Point p2 = new Point(p1.X + vehrect.Width, p1.Y); Point p3 = new Point(p2.X, p2.Y + vehrect.Height); Point p4 = new Point(p1.X, p1.Y + vehrect.Height); strBody = "<PointList>" + System.Environment.NewLine + "<Point>" + p1.X + "," + p1.Y + "</Point>" + System.Environment.NewLine + "<Point>" + p2.X + "," + p2.Y + "</Point>" + System.Environment.NewLine + "<Point>" + p3.X + "," + p3.Y + "</Point>" + System.Environment.NewLine + "<Point>" + p4.X + "," + p4.Y + "</Point>" + System.Environment.NewLine + "</PointList>" + System.Environment.NewLine; } else { needDraw = false; } break; case DrawGraphType.ImageSC: nModeSel = 3; strTypeID = (int)type; strTypeName = "标定"; List <Point> sm = (List <Point>)o; if (sm != null) { string poings = ""; foreach (Point p in sm) { poings += "<Point>" + p.X + "," + p.Y + "</Point>" + System.Environment.NewLine; } strBody += "<PointList>" + System.Environment.NewLine + poings + "</PointList>" + System.Environment.NewLine; } else { needDraw = false; } break; case DrawGraphType.FarArea: nModeSel = 3; strTypeID = (int)type; strTypeName = "远处行人框"; Rectangle recFar = (Rectangle)o; if (recFar != null) { Point p1 = recFar.Location; Point p2 = new Point(p1.X + recFar.Width, p1.Y); Point p3 = new Point(p2.X, p2.Y + recFar.Height); Point p4 = new Point(p1.X, p1.Y + recFar.Height); strBody = "<PointList>" + System.Environment.NewLine + "<Point>" + p1.X + "," + p1.Y + "</Point>" + System.Environment.NewLine + "<Point>" + p2.X + "," + p2.Y + "</Point>" + System.Environment.NewLine + "<Point>" + p3.X + "," + p3.Y + "</Point>" + System.Environment.NewLine + "<Point>" + p4.X + "," + p4.Y + "</Point>" + System.Environment.NewLine + "</PointList>" + System.Environment.NewLine; } else { needDraw = false; } break; case DrawGraphType.NearArea: nModeSel = 3; strTypeID = (int)type; strTypeName = "近处行人框"; Rectangle recNear = (Rectangle)o; if (recNear != null) { Point p1 = recNear.Location; Point p2 = new Point(p1.X + recNear.Width, p1.Y); Point p3 = new Point(p2.X, p2.Y + recNear.Height); Point p4 = new Point(p1.X, p1.Y + recNear.Height); strBody = "<PointList>" + System.Environment.NewLine + "<Point>" + p1.X + "," + p1.Y + "</Point>" + System.Environment.NewLine + "<Point>" + p2.X + "," + p2.Y + "</Point>" + System.Environment.NewLine + "<Point>" + p3.X + "," + p3.Y + "</Point>" + System.Environment.NewLine + "<Point>" + p4.X + "," + p4.Y + "</Point>" + System.Environment.NewLine + "</PointList>" + System.Environment.NewLine; } else { needDraw = false; } break; case DrawGraphType.None: needDraw = false; break; default: needDraw = false; break; } if (needDraw) { string strSelText = string.Format("<?xml version=\"1.0\"?>" + System.Environment.NewLine + strSelTextH + System.Environment.NewLine + strBody + System.Environment.NewLine + strSelTextT, nModeSel, strTypeID, strTypeName); m_PicControl.SetGraphData(strSelText); } }