Ejemplo n.º 1
0
 public void thGetCrowdRealtime(object cameraId)
 {
     while (isRunRealTh)
     {
         try
         {
             CrowdInfo crowdInfo = SearchService.GET_HOTIMAGE_REAL_DATA(CameraId);
             WinFormAppUtil.AppContainer.Instance.EvtAggregator.GetEvent <CrowdRealTimeEvent>().Publish(crowdInfo);
             // publish Event
             for (int i = 0; i < RealThreadTime; i++)
             {
                 if (isRunRealTh)
                 {
                     System.Threading.Thread.Sleep(100);
                 }
                 else
                 {
                     break;
                 }
             }
         }
         catch (SDKCallException ex)
         {
             CrowdInfo crowdInfo = new CrowdInfo();
             crowdInfo.CameraID          = "SDKError";
             crowdInfo.DirectionImageURL = "大客流实时-查询错误[" + ex.ErrorCode + "]:" + ex.Message;
             WinFormAppUtil.AppContainer.Instance.EvtAggregator.GetEvent <CrowdRealTimeEvent>().Publish(crowdInfo);
             break;
         }
     }
     isRunRealTh = false;
     // set RealTime thread
     thCrowdRealtime = null;
 }
Ejemplo n.º 2
0
        void ucCrowdRealSearchFinsh(object corwdInfoObj, EventArgs e)
        {
            if (corwdInfoObj == null)
            {
                m_crowdVM.Stop();
                Init();
                MyLog4Net.Container.Instance.Log.Debug("ucCrowdRealtime SearchFinsh no Data");
                return;
            }

            curInfo = (CrowdInfo)corwdInfoObj;
            if (curInfo.CameraID == "SDKError")
            {
                MessageBoxEx.Show(curInfo.DirectionImageURL, Framework.Environment.PROGRAM_NAME, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                MyLog4Net.Container.Instance.Log.Debug("ucCrowdRealtime ucCrowdRealSearchFinsh" + curInfo.DirectionImageURL);
                curInfo = null;
                return;
            }
            curInfo.CameraID = curItem.CameraName;
            m_SingleCrowdInfo.RefreshInfo(curInfo);
            LabelTime.Text     = DataModel.Common.ConvertLinuxTime(curInfo.TimeSec).ToString();
            playBtn.Enabled    = true;
            Savebutton.Enabled = true;
            isPlay             = true;
            playBtn.Image      = IVX.Live.MainForm.Properties.Resources.暂停1;
            MyLog4Net.Container.Instance.Log.Debug("ucCrowdRealtime SearchFinsh " + curInfo.CameraID);
        }
        public void Start(SearchItemV3_1 cameraItem)
        {
            /*
             * 订阅 CrowdRealTimeEvent 事件
             * start
             */
            string cameraId = "";

            if (cameraItem != null)
            {
                cameraId = cameraItem.CameraID;
            }
            if (m_vm == null)
            {
                var info = Framework.Container.Instance.CommService.GET_RESULT_STORE_LIST(cameraId, E_VIDEO_ANALYZE_TYPE.E_ANALYZE_CROWD);
                if (info == null)
                {
                    // notify UI
                    if (RealSearchFinished != null)
                    {
                        CrowdInfo crowdInfo = new CrowdInfo();
                        crowdInfo.CameraID          = "SDKError";
                        crowdInfo.DirectionImageURL = "大客流实时-查询错误:无结果数据";
                        RealSearchFinished((object)crowdInfo, null);
                    }
                    return;
                }
                string ip   = info.StoreIP;
                uint   port = info.StortPort;
                m_vm = new SearchViewModelBase(ip, port);
                WinFormAppUtil.AppContainer.Instance.EvtAggregator.GetEvent <CrowdRealTimeEvent>().Subscribe(OnSearchResultReturned, Microsoft.Practices.Prism.Events.ThreadOption.WinFormUIThread);
            }
            curTask = Framework.Container.Instance.CommService.GET_TASK(cameraItem.TaskId);
            m_vm.StartCrowdRealtime(cameraId);
        }
Ejemplo n.º 4
0
 private void ucCrowdRealtime_Load(object sender, EventArgs e)
 {
     m_crowdVM = new CrowdRealtimeViewModel();
     curInfo   = null;
     ucCrowdRealCameraTree1.SelectedTaskChanged += ucCrowdRealCameraTree1_SelectedTask;
     m_crowdVM.RealSearchFinished += ucCrowdRealSearchFinsh;
     SetTreeArg();
     ucCrowdRealCameraTree1.InitTree();
 }
Ejemplo n.º 5
0
        public void StartCrowd(UInt32 startTime, UInt32 endTime, string cameraId)
        {
            List <CrowdInfo> crowdInfoList = SearchService.GET_HOTIMAGE_HISTORY_DATA(startTime, endTime, cameraId);

            if (crowdInfoList == null)
            {
                crowdInfoList = new List <CrowdInfo> {
                };
                CrowdInfo info = new CrowdInfo();
                info.CameraID = "OutTime";
                crowdInfoList.Add(info);
            }
            WinFormAppUtil.AppContainer.Instance.EvtAggregator.GetEvent <CrowdEvent>().Publish(crowdInfoList);
        }
 private void RefreshInfo(int index)
 {
     if (this.IsHandleCreated)
     {
         SetPlayIndex(index, Count);
         CrowdInfo curInfo = m_ListInfo[index - 1];
         curInfo.CameraID = cameraName;
         if (m_singleCrowdInfo != null)
         {
             m_singleCrowdInfo.RefreshInfo(curInfo);
         }
         LabelTime.Text = DataModel.Common.ConvertLinuxTime(curInfo.TimeSec).ToString();
     }
 }
        private void trackBarEx1_ValueChangedByMouse(object sender, EventArgs e)
        {
            lock (lockObj)
            {
                CurIndex = (int)trackBarEx1.Value + 1;
            }
            //Update info
            playIndex.Text = CurIndex.ToString() + "/" + Count.ToString();
            CrowdInfo curInfo = m_ListInfo[CurIndex - 1];

            curInfo.CameraID = cameraName;
            m_singleCrowdInfo.RefreshInfo(curInfo);
            LabelTime.Text = DataModel.Common.ConvertLinuxTime(curInfo.TimeSec).ToString();
        }
Ejemplo n.º 8
0
        public void RefreshInfo(CrowdInfo crowdInfo)
        {
            if (crowdInfo == null)
            {
                return;
            }
            string peopleCount = crowdInfo.PeopleCount.ToString() + "人";
            string area        = crowdInfo.RegionArea.ToString() + "m²";

            peoCountLabel.Text     = peopleCount + "/" + area;;
            cameraIdLabel.Text     = crowdInfo.CameraID;
            pictureOrig.Image      = Common.GetImage(crowdInfo.OriginaloImageURL);
            pictureHot.Image       = Common.GetImage(crowdInfo.HotImageURL);
            pictureDirection.Image = Common.GetImage(crowdInfo.DirectionImageURL);
            DrawRegion(crowdInfo.RegionPoints);
        }
 public void OnSearchResultReturned(CrowdInfo crowdInfo)
 {
     if (crowdInfo != null)
     {
         if (curTask.TaskType == TaskType.History)
         {
             uint beginTime = DataModel.Common.ConvertLinuxTime(curTask.StartTime);
             crowdInfo.TimeSec += beginTime;
         }
     }
     // notify UI
     if (RealSearchFinished != null)
     {
         RealSearchFinished((object)crowdInfo, null);
     }
 }
        private void stepUpBtn_Click_1(object sender, EventArgs e)
        {
            lock (lockObj)
            {
                int nextindex = CurIndex + 1;
                if (nextindex > Count)
                {
                    nextindex = nextindex % Count;
                }
                CurIndex = nextindex;
            }
            //Update info
            SetPlayIndex(CurIndex, Count);
            CrowdInfo curInfo = m_ListInfo[CurIndex - 1];

            curInfo.CameraID = cameraName;
            m_singleCrowdInfo.RefreshInfo(curInfo);
            LabelTime.Text = DataModel.Common.ConvertLinuxTime(curInfo.TimeSec).ToString();
        }
        public void RefreshInfo(List <CrowdInfo> crowdInfoList)
        {
            SetBtnEnble(true);
            playBtn.Enabled      = true;
            playBtn.Image        = IVX.Live.MainForm.Properties.Resources.播放1;
            m_ListInfo           = crowdInfoList;
            Count                = crowdInfoList.Count;
            CurIndex             = 1;
            trackBarEx1.MaxValue = Count - 1;
            trackBarEx1.Value    = CurIndex;
            SetPlayIndex(CurIndex, Count);
            CrowdInfo curInfo = m_ListInfo[CurIndex - 1];

            cameraName = curInfo.CameraID;
            if (m_singleCrowdInfo != null)
            {
                LabelTime.Text = DataModel.Common.ConvertLinuxTime(curInfo.TimeSec).ToString();
                m_singleCrowdInfo.RefreshInfo(curInfo);
            }
        }
        public List <CrowdInfo> QueryCrowdData(DateTime startT, DateTime endT, RealtimeCameraInfo[] SelectedCrowdCameraInfo)
        {
            List <CrowdInfo> CrowdDatas = new List <CrowdInfo>();

            string cameras   = "";
            string startTime = Convert.ToUInt64(startT.Subtract(DataModel.Common.ZEROTIME).TotalSeconds).ToString();
            string endTime   = Convert.ToUInt64(endT.Subtract(DataModel.Common.ZEROTIME).TotalSeconds).ToString();

            if (SelectedCrowdCameraInfo != null && SelectedCrowdCameraInfo.Length > 0)
            {
                foreach (var item in SelectedCrowdCameraInfo)
                {
                    cameras += "\"" + item.CameraCode + "\",";
                }
                cameras = cameras.TrimEnd(',');
            }
            using (MySql.Data.MySqlClient.MySqlConnection conn
                       = new MySql.Data.MySqlClient.MySqlConnection(string.Format(m_connString, RTRISServerIP, "rtrs_server_db")))
            {
                try
                {
                    string sql = "SELECT"
                                 + " info.ID,"
                                 + " info.CAMERA_CODE,"
                                 + " info.TIME_MILLI_SEC,"
                                 + " info.PEOPLE_COUNT,"
                                 + " info.REGION_AREA,"
                                 + " info.REGION_POINT_NUM,"
                                 + " info.REGION_POINT,"
                                 + " info.RESERVED"
                                 + " FROM"
                                 + " rt_crowd_result_info AS info "
                                 + " WHERE info.TIME_MILLI_SEC BETWEEN \"" + startTime + "\" AND \"" + endTime + "\"";


                    if (!string.IsNullOrEmpty(cameras))
                    {
                        sql += " AND info.CAMERA_CODE in (" + cameras + ")";
                    }
                    MyLog4Net.Container.Instance.Log.Debug("QueryData sql:" + sql);
                    conn.Open();
                    MySql.Data.MySqlClient.MySqlCommand    cmd    = new MySql.Data.MySqlClient.MySqlCommand(sql, conn);
                    MySql.Data.MySqlClient.MySqlDataReader reader = cmd.ExecuteReader();
                    DataTable table = new DataTable();
                    table.Load(reader);
                    conn.Close();

                    CrowdDatas = new List <CrowdInfo>();
                    foreach (DataRow item in table.Rows)
                    {
                        CrowdInfo info = new CrowdInfo();
                        info.ID          = Convert.ToUInt64(item["ID"].ToString());
                        info.CameraCode  = item["CAMERA_CODE"].ToString();
                        info.TimeSec     = DataModel.Common.ZEROTIME.AddSeconds(Convert.ToUInt64(item["TIME_MILLI_SEC"].ToString()));
                        info.PeopleCount = Convert.ToUInt32(item["PEOPLE_COUNT"].ToString());
                        info.RegionArea  = Convert.ToUInt32(item["REGION_AREA"].ToString());
                        string[]     ps     = item["REGION_POINT"].ToString().Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
                        List <Point> listps = new List <Point>();
                        for (int i = 0; i < ps.Length; i += 2)
                        {
                            listps.Add(new Point(Convert.ToInt32(ps[i]), Convert.ToInt32(ps[i + 1])));
                        }
                        info.RegionPoints = listps;//691/84/1852/142/1891/1020/716/1036/
                        //byte[] bytes1 = (byte[])item["HOT_IMAGE_BUFFER"];
                        //int len1 = Convert.ToInt32(item["HOT_IMAGE_LEN"].ToString());
                        //info.HotImage = BOCOM.RealtimeProtocol.Model.ModelParser.GetImage(bytes1, len1);
                        //byte[] bytes2 = (byte[])item["DIRECTION_IMAGE_BUFFER"];
                        //int len2 = Convert.ToInt32(item["DIRECTION_IMAGE_LEN"].ToString());
                        //info.DirectionImage = BOCOM.RealtimeProtocol.Model.ModelParser.GetImage(bytes2, len2);
                        //byte[] bytes3 = (byte[])item["ORIGINAL_IMAGE_BUFFER"];
                        //int len3 = Convert.ToInt32(item["ORIGINAL_IMAGE_LEN"].ToString());
                        //info.OriginaloImage = BOCOM.RealtimeProtocol.Model.ModelParser.GetImage(bytes3, len3);

                        CrowdDatas.Add(info);
                    }
                    return(CrowdDatas);
                    //if (FinishQueryData != null)
                    //    FinishQueryData(CrowdDatas, null);
                }
                catch (Exception ex)
                {
                    MyLog4Net.Container.Instance.Log.DebugWithDebugView("QueryCrowdData sql error:" + ex.ToString());

                    //Framework.Container.Instance.InteractionService.ShowMessageBox("数据库失败", Framework.Environment.PROGRAM_NAME);
                    return(new List <CrowdInfo>());
                }
            }
        }