コード例 #1
0
        private void BtnSend_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            string err = string.Empty;
            Button btn = sender as Button;
            MyCmpFaceLogWidthImgModel selectedData = new MyCmpFaceLogWidthImgModel();

            try
            {
                foreach (MyCmpFaceLogWidthImgModel obj in ViewDataModel.WarningData.Property.CompareLogDatas)
                {
                    if (obj.ID == btn.CommandParameter.ToString())
                    {
                        selectedData = obj;
                        break;
                    }
                }
                int res = WarningMessageCmd.SendOneResultInfo(selectedData);
                Function.ClearPushedWaringData.ClearPushedData(ref err, res, selectedData);
            }
            catch (System.Exception ex)
            {
                err = ex.Message;
                MB_MODULES.Views.MyMessage.showYes(err);
            }
        }
コード例 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="obj"></param>
 public SuspectAlarmViewModel(object obj, params object[] param)
 {
     if (obj is Compare)
     {
         DataObject = obj as Compare;
     }
     else if (obj is MyCmpFaceLogWidthImgModel)
     {
         //CloseWindowCmd = new DelegateCommand<object>(CloseWindowCmdFunc);
         PublishSuspectDataCmd = new DelegateCommand <object>(PublishSuspectDataCmdFunc);
         MyCmpFaceLogWidthImgModel suspectObj = obj as MyCmpFaceLogWidthImgModel;
         DataObject                           = new Compare();
         DataObject.Score                     = suspectObj.score;
         DataObject.Source                    = suspectObj.type;
         DataObject.Snap                      = new Snap();
         DataObject.Snap.Guid                 = suspectObj.ID;
         DataObject.Snap.SanpDateTime         = suspectObj.time;
         DataObject.Snap.SnapPhoto            = suspectObj.SnapImage;
         DataObject.Camera                    = new Camera();
         DataObject.Camera.Location           = suspectObj.channelName;
         DataObject.Template                  = new Template();
         DataObject.Template.Guid             = suspectObj.tcUuid;
         DataObject.Template.PersonInfo       = new Person();
         DataObject.Template.PersonInfo.Name  = suspectObj.name;
         DataObject.Template.PersonInfo.Photo = suspectObj.DBImage;
     }
 }
コード例 #3
0
        public static string ClearPushedDataFormCodeBehind(ref string err, Button btn)
        {
            try
            {
                MyCmpFaceLogWidthImgModel selectedData = new MyCmpFaceLogWidthImgModel();
                foreach (MyCmpFaceLogWidthImgModel obj in ViewDataModel.WarningData.Property.CompareLogDatas)
                {
                    if (obj.ID == btn.CommandParameter.ToString())
                    {
                        selectedData = obj;
                        break;
                    }
                }

                if (ViewDataModel.WarningData.Property.CurCompareLogDatas.Count > 0 && ViewDataModel.WarningData.Property.CurCompareLogDatas.Contains(selectedData))
                {
                    ViewDataModel.WarningData.Property.CurCompareLogDatas.Remove(selectedData);
                }
                ViewDataModel.WarningData.Property.CompareLogDatas.Remove(selectedData);
                ViewDataModel.WarningData.Property.CompareLogDatasCache.Remove(selectedData);
                ViewDataModel.WarningData.RefreshProperty();
            }
            catch (System.Exception ex)
            {
                err = ex.Message;
                MB_MODULES.Views.MyMessage.showYes(ex.Message);
            }

            return(err);
        }
コード例 #4
0
        private void listComparisonRecord_MouseDoubleClick(object sender, RoutedEventArgs e)
        {
            ThriftServiceNameSpace.ThriftService thirft             = new ThriftServiceNameSpace.ThriftService();
            MyCmpFaceLogWidthImgModel            cmpFaceLogWidthImg = listComparisonRecord.SelectedItem as MyCmpFaceLogWidthImgModel;

            if (cmpFaceLogWidthImg != null)
            {
                if (!isHeader)
                {
                    try
                    {
                        List <byte[]> senceImg = thirft.QuerySenceImg(cmpFaceLogWidthImg.ID, cmpFaceLogWidthImg.date.Split(' ')[0].Replace(@"/", "").Replace(@"/", ""));
                        if (senceImg != null && senceImg.Count > 0 && senceImg[0].Length > 0)
                        {
                            CompInfo    comInfoWin = new CompInfo();
                            BitmapImage bitImage   = ImageConvert.ToBitmapImage(senceImg[0]);

                            comInfoWin.SetCmpInfo(cmpFaceLogWidthImg.SnapImage, cmpFaceLogWidthImg.T1.TemplateImage, bitImage, cmpFaceLogWidthImg.score, cmpFaceLogWidthImg.T1.UserName, cmpFaceLogWidthImg.type,
                                                  cmpFaceLogWidthImg.date + " " + cmpFaceLogWidthImg.time, cmpFaceLogWidthImg.channelName);
                            comInfoWin.Show();
                        }
                        else
                        {
                            MB_MODULES.Views.MyMessage.showYes("获取抓拍实时帧失败!");
                        }
                    }
                    catch (Exception ex)
                    {
                        MB_MODULES.Views.MyMessage.showYes(ex.Message);
                        Logger <OperaExcel> .Log.Error("listComparisonRecord_MouseDoubleClick", ex);
                    }
                }
            }
        }
コード例 #5
0
 /// <summary>
 /// 单个清理已推送结果
 /// </summary>
 /// <param name="selectedData"></param>
 /// <returns></returns>
 public static void ClearSinglePushedData(MyCmpFaceLogWidthImgModel selectedData)
 {
     if (ViewDataModel.WarningData.Property.CurCompareLogDatas.Count > 0 && ViewDataModel.WarningData.Property.CurCompareLogDatas.Contains(selectedData))
     {
         ViewDataModel.WarningData.Property.CurCompareLogDatas.Remove(selectedData);
     }
     ViewDataModel.WarningData.Property.CompareLogDatas.Remove(selectedData);
     ViewDataModel.WarningData.Property.CompareLogDatasCache.Remove(selectedData);
     ViewDataModel.WarningData.RefreshProperty();
 }
コード例 #6
0
        private void GotoBICommandFunc(object obj)
        {
            MyCmpFaceLogWidthImgModel model = obj as MyCmpFaceLogWidthImgModel;

            if (string.IsNullOrEmpty(model.T1.UserName) && string.IsNullOrEmpty(model.T1.TemplateType))
            {
                MyMessage.Show("因智能分析取自模板照片\n请添加模板照片后重新进入智能分析功能");
                return;
            }
            GoToCommandFunc(model, 6);
        }
コード例 #7
0
        /// <summary>
        /// 异步线程,执行告警结果推送服务
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public async Task ExecSendOpt()
        {
            await Task.Run(() =>
            {
                MyCmpFaceLogWidthImgModel gt10Obj = new MyCmpFaceLogWidthImgModel();

                try
                {
                    lock (ViewDataModel.WarningData.Property.OccurNumber)
                    {
                        foreach (var item in ViewDataModel.WarningData.Property.OccurNumber)
                        {
                            //自动推送一条分数较高的

                            /**
                             *
                             * **/
                            if (item.Value == GlobalCache.AppearLimited)
                            {
                                int max  = 0;
                                int curr = 1;
                                MyCmpFaceLogWidthImgModel willSendObj = new MyCmpFaceLogWidthImgModel();
                                foreach (var highScore in ViewDataModel.WarningData.Property.CompareLogDatas)
                                {
                                    //推送完成,删除
                                    Function.ClearPushedWaringData.ClearSinglePushedData(willSendObj);//逐条删除告警结果

                                    if (item.Key.name == highScore.name)
                                    {
                                        ViewDataModel.WarningData.Property.OccurNumber[item.Key] = 0;

                                        curr = highScore.score;
                                        if (curr > max)
                                        {
                                            max         = curr;
                                            willSendObj = highScore;
                                            gt10Obj     = highScore;
                                        }
                                    }
                                }

                                //推送分数较高的告警结果
                                SendOneResultInfo(willSendObj);
                            }
                            //ViewDataModel.WarningData.RefreshProperty();
                        }
                    }
                }
                catch (Exception)
                {
                }
            });
        }
コード例 #8
0
        public static string ClearPushedData(ref string err, object isPushSuccessed, MyCmpFaceLogWidthImgModel selectedData)
        {
            if ((int)isPushSuccessed == 0)
            {
                if (ViewDataModel.WarningData.Property.CurCompareLogDatas.Count > 0 && ViewDataModel.WarningData.Property.CurCompareLogDatas.Contains(selectedData))
                {
                    ViewDataModel.WarningData.Property.CurCompareLogDatas.Remove(selectedData);
                }
                ViewDataModel.WarningData.Property.CompareLogDatas.Remove(selectedData);
                ViewDataModel.WarningData.Property.CompareLogDatasCache.Remove(selectedData);
                ViewDataModel.WarningData.RefreshProperty();
            }

            return(err);
        }
コード例 #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <returns></returns>
        //async Task<ObservableCollection<PointLatLngImg>> SearchResult(object sender, RoutedEventArgs e)
        //{
        //    return await Task<ObservableCollection<PointLatLngImg>>.Run(() =>
        //    {
        //        ObservableCollection<PointLatLngImg> Points = new ObservableCollection<PointLatLngImg>();
        //        if (Convert.ToDateTime(StartDay) <= Convert.ToDateTime(EndDay))
        //        {
        //            long start = DateTimeConvert.ToTotalSeconds(true, StartDay, StartHour, StartMinute);
        //            long end = DateTimeConvert.ToTotalSeconds(false, EndDay, EndHour, EndMinute);

        //            try
        //            {
        //                List<TrackInfo> TrackInfos = new List<TrackInfo>();
        //                if (SnapPersonInfo != null)
        //                {
        //                    TrackInfos = thirft.QueryTrackPlayback(SnapPersonInfo.SnapId, SnapPersonInfo.PhotoByteArray, start, end);
        //                }
        //                else
        //                {
        //                    comServer.SocketOpter.ExceptionMsgFromSTAThread("请添加照片");
        //                }

        //                ListItemSourceObj = new List<CameraSnapPerson>();

        //                int row = 0;
        //                foreach (TrackInfo item in TrackInfos)
        //                {
        //                    CameraSnapPerson csp = new CameraSnapPerson();

        //                    csp.RowNumber = ++row;
        //                    csp.CameraInfo = new Camera();
        //                    csp.CameraInfo.Name = item.Name;
        //                    csp.Datetime = item.Capimg != null ? DateTimeConvert.LongTimeToString(item.Capimg[0].Time) : "";
        //                    csp.CameraInfo.Location = item.Channel_address;
        //                    csp.CameraInfo.Longitude = item.Longitude;
        //                    csp.CameraInfo.Latitude = item.Latitude;
        //                    ListItemSourceObj.Add(csp);

        //                    PointLatLngImg ipoint = new PointLatLngImg();
        //                    if (!string.IsNullOrEmpty(item.Latitude) && !string.IsNullOrEmpty(item.Longitude))
        //                        ipoint.Point = new GMap.NET.PointLatLng(Convert.ToDouble(item.Latitude), Convert.ToDouble(item.Longitude));
        //                    ipoint.Img = ImageConvert.ToBitmapImage(SnapPersonInfo.PhotoByteArray);
        //                    ipoint.ImgVisibility = Visibility.Visible;
        //                    ipoint.ImgframeVisibility = Visibility.Visible;
        //                    Points.Add(ipoint);
        //                }

        //            }
        //            catch (Exception ex)
        //            {
        //                Logger<MainTraceAnalysisView>.Log.Error(ex);
        //            }
        //            OnPropertyChanged("ListItemSourceObj");
        //        }
        //        else
        //        {
        //            comServer.SocketOpter.ExceptionMsgFromSTAThread("结束时间不能大于开始时间");
        //        }

        //        return Points;
        //    }).ConfigureAwait(false);
        //}


        public void GetPersonInfo(object obj)
        {
            Type type = obj.GetType();

            SnapPersonInfo = new CameraSnapPerson();

            try
            {
                if (obj is MyCmpFaceLogWidthImgModel)//对比记录至此
                {
                    MyCmpFaceLogWidthImgModel mfl = obj as MyCmpFaceLogWidthImgModel;
                    SnapPersonInfo.Name                 = mfl.T1.UserName;
                    SnapPersonInfo.Photo                = mfl.SnapImage;
                    SnapPersonInfo.PhotoByteArray       = mfl.SnapImageBuffer;
                    SnapPersonInfo.Datetime             = mfl.date + mfl.time;
                    SnapPersonInfo.CameraInfo           = new Camera();
                    SnapPersonInfo.CameraInfo.Location  = mfl.Address;
                    SnapPersonInfo.CameraInfo.Longitude = mfl.Longitude;
                    SnapPersonInfo.CameraInfo.Latitude  = mfl.Latitude;
                    SnapPersonInfo.Score                = mfl.Score;
                    SnapPersonInfo.Source               = "抓拍库";
                }
                else if (obj is CameraSnapPerson)//静态分析至此
                {
                    SnapPersonInfo        = obj as CameraSnapPerson;
                    SnapPersonInfo.Name   = "通道:" + SnapPersonInfo.Name;
                    SnapPersonInfo.Source = "抓拍库";
                }
                else if (obj is MyFaceObj)//模板库至此
                {
                    MyFaceObj mfo = obj as MyFaceObj;
                    SnapPersonInfo.Name           = "姓名:" + mfo.tcName;
                    SnapPersonInfo.Photo          = mfo.img;
                    SnapPersonInfo.Source         = "模板库";
                    SnapPersonInfo.PhotoByteArray = mfo.imgStream; //ImageConvert.ToImageStream(mfo.img as BitmapImage);
                    SnapPersonInfo.Datetime       = mfo.fa_ob_dTm;
                }
            }
            catch (Exception ex)
            {
                Logger <MainTraceAnalysisView> .Log.Error(ex);
            }
            finally
            {
                OnPropertyChanged("SnapPersonInfo");
            }
        }
コード例 #10
0
        private void GotoTRCommandFunc(object obj)
        {
            MyCmpFaceLogWidthImgModel model = obj as MyCmpFaceLogWidthImgModel;

            GoToCommandFunc(model, 5);
        }
コード例 #11
0
        /// <summary>
        /// 推送一条
        /// </summary>
        /// <param name="signleObj"></param>
        public static int SendOneResultInfo(MyCmpFaceLogWidthImgModel signleObj)
        {
            int res = -1;

            ThriftServiceNameSpace.ThriftService thirft = new ThriftServiceNameSpace.ThriftService();
            try
            {
                RealtimeCmpInfoLBS newRci = new RealtimeCmpInfoLBS();
                newRci.CapID     = signleObj.ID;
                newRci.ObjID     = signleObj.tcUuid;
                newRci.Name      = signleObj.name;
                newRci.Channel   = signleObj.channelName;
                newRci.Longitude = signleObj.Longitude;
                newRci.Latitude  = signleObj.Latitude;
                newRci.Address   = signleObj.Address;
                List <byte[]> snapImgStream = thirft.QueryCmpLogImageH(
                    signleObj.ID,
                    DataConvert.DatetimeConvertToStr.ConvertToString(Convert.ToDateTime(signleObj.time), "yyyyMMdd")
                    );
                if (snapImgStream.Count > 0 && snapImgStream[0].Length > 0)
                {
                    newRci.CapImg = snapImgStream[0];
                }
                List <FaceObj> templateList = thirft.QueryFaceObj(signleObj.tcUuid);
                if (templateList.Count > 0)
                {
                    newRci.Name += "|" + templateList[0].TcRemarks;
                    if (templateList[0].NMain_ftID > 0)
                    {
                        newRci.ObjImg = templateList[0].Tmplate.FirstOrDefault(x => x.NIndex == templateList[0].NMain_ftID - 1).Img;
                    }
                    else
                    {
                        newRci.ObjImg = templateList[0].Tmplate[0].Img;
                    }
                }

                #region old
                //RealtimeCmpInfo info = new RealtimeCmpInfo();
                //info.CapID = signleObj.ID;
                //info.ObjID = signleObj.tcUuid;
                //info.Name = signleObj.name;
                //info.Channel = signleObj.channelName;
                //List<byte[]> listImageBytes = thirft.QueryCmpLogImageH(signleObj.ID, DataConvert.DatetimeConvertToStr.ConvertToString(Convert.ToDateTime(signleObj.time), "yyyyMMdd"));
                //if (listImageBytes.Count > 0 && listImageBytes[0].Length > 0)
                //{
                //    info.CapImg = listImageBytes[0];
                //    Console.WriteLine("抓拍照片大小为:" + listImageBytes[0].Length);
                //}
                //List<FaceObj> ListFaceObj = thirft.QueryFaceObj(signleObj.tcUuid);
                //if (ListFaceObj.Count > 0)
                //{
                //    info.Name += "|" + ListFaceObj[0].TcRemarks;
                //    if (ListFaceObj[0].NMain_ftID > 0)
                //    {
                //        for (int i = 0; i < ListFaceObj[0].Tmplate.Count; i++)//遍历查找主模板照片
                //        {
                //            if (ListFaceObj[0].NMain_ftID - 1 == ListFaceObj[0].Tmplate[i].NIndex)
                //            {
                //                info.ObjImg = ListFaceObj[0].Tmplate[i].Img;
                //                Console.WriteLine("模版照片大小为:" + ListFaceObj[0].Tmplate[i].Img.Length);
                //            }
                //        }
                //    }
                //    else
                //    {
                //        info.ObjImg = ListFaceObj[0].Tmplate[0].Img;
                //        Console.WriteLine("模版照片大小为:" + ListFaceObj[0].Tmplate[0].Img.Length);
                //    }
                //}
                #endregion
                newRci.Time =
                    DateTimeConvert.ToLongFromSubstract(Convert.ToDateTime(signleObj.time), new DateTime(1970, 1, 1));
                //info.Type = cORViewModel.Type.IndexOf(cmpface.type) + 1;
                newRci.Type  = 2;
                newRci.Score = signleObj.score;
                res          = SendCmpToClient(newRci);
            }
            catch (Exception ex)
            {
                MB_MODULES.Views.MyMessage.showYes(ex.Message);
            }
            return(res);
        }
コード例 #12
0
        /// <summary>
        /// 接收跳转过来的对象
        /// 1、智能分析
        /// 2、比对记录
        /// 3、
        /// </summary>
        /// <param name="obj"></param>
        void SetReceivedData(object obj)
        {
            //Type type = obj.GetType();
            Points = new ObservableCollection <PointLatLngImg>();

            try
            {
                if (obj is MyCmpFaceLogWidthImgModel)
                {
                    MyCmpFaceLogWidthImgModel mfl = obj as MyCmpFaceLogWidthImgModel;
                    ForTargetPage                      = new CameraSnapPerson();
                    ForTargetPage.Name                 = mfl.T1.UserName;
                    ForTargetPage.Photo                = mfl.SnapImage;
                    ForTargetPage.PhotoByteArray       = mfl.SnapImageBuffer;
                    ForTargetPage.SnapDate             = mfl.date;
                    ForTargetPage.SnapTime             = mfl.time;
                    ForTargetPage.CameraInfo           = new Camera();
                    ForTargetPage.CameraInfo.Name      = mfl.channelName;
                    ForTargetPage.CameraInfo.Longitude = mfl.Longitude;
                    ForTargetPage.CameraInfo.Latitude  = mfl.Latitude;
                    ForTargetPage.CameraInfo.Location  = mfl.Address;
                    ForTargetPage.Score                = mfl.Score;

                    //PointLatLngImg ipoint = new PointLatLngImg();
                    //ipoint.Img = ImageConvert.ToBitmapImage((SusipciousInfo.PhotoByteArray));

                    //if (!string.IsNullOrEmpty(SusipciousInfo.CameraInfo.Latitude) && !string.IsNullOrEmpty(SusipciousInfo.CameraInfo.Longitude))
                    //    ipoint.Point = new GMap.NET.PointLatLng(Convert.ToDouble(SusipciousInfo.CameraInfo.Latitude), Convert.ToDouble(SusipciousInfo.CameraInfo.Longitude));
                    //else
                    //    ipoint.Point = new GMap.NET.PointLatLng(0, 0);

                    //ipoint.ImgVisibility = Visibility.Visible;
                    //Points.Add(ipoint);
                }
                else if (obj is CameraSnapPerson)//静态分析抓拍库跳至这里
                {
                    CameraSnapPerson cor = obj as CameraSnapPerson;
                    ForTargetPage = new CameraSnapPerson();
                    if ("抓拍库".Equals(cor.Source))
                    {
                        ForTargetPage.Name = "通道:" + cor.Name;
                    }
                    else
                    {
                        ForTargetPage.Name = "姓名:" + cor.Name;
                    }
                    ForTargetPage.Photo                = cor.Photo;
                    ForTargetPage.PhotoByteArray       = cor.PhotoByteArray;
                    ForTargetPage.SnapDate             = cor.SnapDate;
                    ForTargetPage.SnapTime             = cor.SnapTime;
                    ForTargetPage.CameraInfo           = cor.CameraInfo ?? new Camera();
                    ForTargetPage.CameraInfo.Location  = cor.CameraInfo.Location;
                    ForTargetPage.CameraInfo.Longitude = cor.CameraInfo.Longitude;
                    ForTargetPage.CameraInfo.Latitude  = cor.CameraInfo.Latitude;
                }
            }
            catch (Exception ex)
            {
                Logger <MainControlViewModel> .Log.Error("SetReceivedData", ex);
            }
            finally
            {
                //更新统计结果 柱状图
                initBarCharts(true, null);
                SearchSchemaDatas.IsTargetValue = "有目标分析";
                OnPropertyChanged("SearchSchemaDatas");
                OnPropertyChanged("SusipciousInfo");
                //OnPropertyChanged("Points");
            }

            //DrawingAnchor();
        }