Esempio n. 1
0
        private int HK_FindRecogAreaInVideoChan(int videoChan, int vchlane)
        {
            foreach (ClsRecogArea area in Global.recogAreaList)
            {
                if (area.videoChannel == videoChan && area.videoLaneNo == vchlane)
                {
                    return(area.id);
                }
            }

            //没有匹配上,说明此识别区没有添加过,关联视频通道进行添加
            foreach (ClsVideoChannel video in Global.videoList)
            {
                if (video.channelNo == videoChan)
                {
                    ClsRecogArea area = new ClsRecogArea();
                    area.videoid      = video.id;
                    area.left         = 0;
                    area.right        = 0;
                    area.top          = 0;
                    area.bottom       = 0;
                    area.videoLaneNo  = vchlane;
                    area.videoChannel = videoChan;
                    area.id           = Global.mysqlHelper.ExecuteSql(area.getInsertString());
                    Global.recogAreaList.Add(area);
                    video.areaList.Add(area);
                    return(area.id);
                }
            }
            return(-1);
        }
Esempio n. 2
0
        private bool GetRecogAreaListFromDB()
        {
            string queryString = "select * from analysisarea";

            try
            {
                Global.recogAreaList.Clear();
                DataTable dt = Global.mysqlHelper.GetDataTable(queryString);
                if (dt == null || dt.Rows.Count < 1)
                {
                    return(true);
                }
                foreach (DataRow dr in dt.Rows)
                {
                    ClsRecogArea area = new ClsRecogArea();
                    area.videoid     = int.Parse(dr["vchid"].ToString());
                    area.id          = int.Parse(dr["id"].ToString());
                    area.left        = double.Parse(dr["X1"].ToString());
                    area.right       = double.Parse(dr["X2"].ToString());
                    area.top         = double.Parse(dr["Y1"].ToString());
                    area.bottom      = double.Parse(dr["Y2"].ToString());
                    area.videoLaneNo = int.Parse(dr["vchlane"].ToString());
                    foreach (ClsNozzle nozzle in Global.nozzleList)
                    {
                        if (nozzle.areaid == area.id)
                        {
                            area.nozzleList.Add(nozzle);
                        }
                    }

                    Global.recogAreaList.Add(area);
                    Global.LogServer.Add(new LogInfo("ParamSet-Debug", "Main->GetRecogAreaListFromDB areaid:" +
                                                     area.id.ToString() + "  videoid:" + area.videoid.ToString(), (int)EnumLogLevel.DEBUG));
                }
                return(true);
            }
            catch (System.Exception ex)
            {
                Global.LogServer.Add(new LogInfo("ParamSet-Error", "Main->InitParam->GetRecogAreaListFromDB 运行初始化失败:" + ex.Message, (int)EnumLogLevel.ERROR));
                return(false);
            }
        }
Esempio n. 3
0
        private void AddOrUpdateArea(int AoU)
        {
            switch (AoU)
            {
            case 1:
                foreach (ClsNVRInfo nvr in Global.nvrList)
                {
                    if (nvr.nvrName == Global.sCurSelectedNvrName)
                    {
                        foreach (ClsVideoChannel video in nvr.videoList)
                        {
                            if (video.channelNo == Global.nCurSelectedVideoChan)
                            {
                                ClsRecogArea area = new ClsRecogArea();
                                area.videoid     = video.id;
                                area.left        = (double)Math.Round((decimal)struDrawInfo.start.X / this.videoBox.Width, 4);
                                area.right       = (double)Math.Round((decimal)struDrawInfo.end.X / this.videoBox.Width, 4);
                                area.top         = (double)Math.Round((decimal)struDrawInfo.start.Y / this.videoBox.Height, 4);
                                area.bottom      = (double)Math.Round((decimal)struDrawInfo.end.Y / this.videoBox.Height, 4);
                                area.videoLaneNo = comboHKArea.SelectedIndex + 1;
                                area.id          = Global.mysqlHelper.ExecuteSql(area.getInsertString());
                                Global.recogAreaList.Add(area);
                                video.areaList.Add(area);
                                return;
                            }
                        }
                    }
                }
                break;

            case 2:
                foreach (ClsRecogArea area in Global.recogAreaList)
                {
                    if (area.id.ToString() == comboArea.Text.Trim())
                    {
                        area.left   = (double)Math.Round((decimal)struDrawInfo.start.X / this.videoBox.Width, 4);
                        area.right  = (double)Math.Round((decimal)struDrawInfo.end.X / this.videoBox.Width, 4);
                        area.top    = (double)Math.Round((decimal)struDrawInfo.start.Y / this.videoBox.Height, 4);
                        area.bottom = (double)Math.Round((decimal)struDrawInfo.end.Y / this.videoBox.Height, 4);
                        Global.mysqlHelper.ExecuteSql(area.getUpdateString());
                    }
                }
                break;

            case 3:
                ClsNozzle nozzle = new ClsNozzle();
                nozzle.nozzleNo = int.Parse(comboNozzleNo.Text);
                nozzle.oilType  = comboOilType.SelectedIndex;
                nozzle.areaid   = int.Parse(comboMainArea.Text);
                nozzle.id       = Global.mysqlHelper.ExecuteSql(nozzle.getInsertString());

                string linkSqlString = "insert into nozzle_area (nozzleNo,areaid,linkmode) values (" + nozzle.nozzleNo.ToString() +
                                       "," + comboMainArea.Text + ",1)";
                nozzle.linkedMainAreaList.Add(int.Parse(comboMainArea.Text));
                if (comboMainArea2.Text != "不使用")
                {
                    linkSqlString += ",(" + nozzle.nozzleNo.ToString() + "," + comboMainArea.Text + ",1)";
                    nozzle.linkedMainAreaList.Add(int.Parse(comboMainArea2.Text));
                }
                if (comboSubArea.Text != "不使用")
                {
                    linkSqlString += ",(" + nozzle.nozzleNo.ToString() + "," + comboSubArea.Text + ",2)";
                    nozzle.linkedSubAreaList.Add(int.Parse(comboSubArea.Text));
                }

                if (comboSubArea2.Text != "不使用")
                {
                    linkSqlString += ",(" + nozzle.nozzleNo.ToString() + "," + comboSubArea2.Text + ",2)";
                    nozzle.linkedSubAreaList.Add(int.Parse(comboSubArea2.Text));
                }

                Global.mysqlHelper.ExecuteSql(linkSqlString);
                Global.nozzleList.Add(nozzle);
                break;

            case 4:

                break;

            default:
                break;
            }
        }