public List <BreakRegion> Pdo_FencePolygonsGet(UInt32 hPdoHandle) { TPDO_DRAW_FENCEPOLYGONS fencePolygons; List <BreakRegion> list = new List <BreakRegion>(); MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXDrawSDKProtocol Pdo_DrawRectGet hPdoHandle:" + hPdoHandle); UInt32 retVal = IVXDrawSDKProtocol.Pdo_FencePolygonsGet(hPdoHandle, out fencePolygons); MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXDrawSDKProtocol Pdo_DrawRectGet ret:" + retVal); for (int i = 0; i < fencePolygons.dwNum; i++) { BreakRegion temp = new BreakRegion() { ID = (uint)i, RegionType = fencePolygons.atCrossLineList[i].uDirectType, RegionPointList = new List <Point>(), }; for (int j = 0; j < fencePolygons.atCrossLineList[i].sPointSet.nRealSize; j++) { temp.RegionPointList.Add(fencePolygons.atCrossLineList[i].sPointSet.Points[j]); } list.Add(temp); } return(list); }
private List <BreakRegion> GetAnalysePassRegion(string xml) { List <BreakRegion> brList = new List <BreakRegion> { }; if (string.IsNullOrEmpty(xml)) { return(brList); } System.Xml.XmlDocument xmldoc = new System.Xml.XmlDocument(); xmldoc.LoadXml(xml); System.Xml.XmlNode item = xmldoc.SelectSingleNode("root/AlgorithmInitParam/InOutSideRegion/Region"); CheckInOutSide.Checked = item.SelectSingleNode("OutputResult").InnerText == "TRUE"; TimeInOutSide.Checked = item.SelectSingleNode("OutputResult").InnerText == "TRUE"; InOutSideInput.Text = item.SelectSingleNode("TimelyReportTimeInterval").InnerText; AllowInSide.Checked = item.SelectSingleNode("InSide").InnerText == "TRUE"; AllowOutSide.Checked = item.SelectSingleNode("OutSide").InnerText == "TRUE"; InSideCheck.Checked = item.SelectSingleNode("HumanSuperscale/InSide/Enable").InnerText == "TRUE"; if (btnCheckPosBeyond.Checked) { InSideUnitTime.Text = item.SelectSingleNode("HumanSuperscale/InSide/UnitTime").InnerText; InSideUpperLimit.Text = item.SelectSingleNode("HumanSuperscale/InSide/UpperLimit").InnerText; } OutSideCheck.Checked = item.SelectSingleNode("HumanSuperscale/OutSide/Enable").InnerText == "TRUE"; if (OutSideCheck.Checked) { OutSideUnitTime.Text = item.SelectSingleNode("HumanSuperscale/OutSide/UnitTime").InnerText; OutSideUpperLimit.Text = item.SelectSingleNode("HumanSuperscale/OutSide/UpperLimit").InnerText; } BreakRegion bRegion = BreakRegion.LoadFromXml(item); brList.Add(bRegion); return(brList); }
/// <summary> /// 获取播放绘制的闯入闯出区域信息 /// </summary> /// <param name="vodHandle">播放标示句柄</param> /// <returns>绘制的闯入闯出区域信息</returns> public List <BreakRegion> GetPlayDrawBreakRegion(Int32 vodHandle) { MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXSDKProtocol VdaSdk_GetPlayDrawBreakRegion lVodHandle:" + vodHandle); TVDASDK_DRAW_BREAK_REGION ptDrawBreakRegion = new TVDASDK_DRAW_BREAK_REGION(); bool retVal = IVXSDKProtocol.VdaSdk_GetPlayDrawBreakRegion(vodHandle, out ptDrawBreakRegion); if (!retVal) { // 调用失败,抛异常 CheckError(); } MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, string.Format("IVXSDKProtocol VdaSdk_GetPlayDrawBreakRegion ret:{0}," , retVal)); List <BreakRegion> ret = new List <BreakRegion>(); for (int i = 0; i < ptDrawBreakRegion.dwBreakRegionNum; i++) { TVDASDK_SEARCH_BREAK_REGION region = ptDrawBreakRegion.atBreakRegionList[i]; BreakRegion newregion = new BreakRegion(); newregion.RegionPointList = new List <System.Drawing.Point>(); newregion.RegionType = region.dwRegionType; for (int j = 0; j < region.dwPointNum; j++) { newregion.RegionPointList.Add( new System.Drawing.Point((int)region.atRegionPointList[j].dwX, (int)region.atRegionPointList[j].dwY) ); } ret.Add(newregion); } return(ret); }
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); } }