Ejemplo n.º 1
0
 async Task <IList <TmpSnapInfo> > AsyncSelectNoTargetForSusipcious(ThirftService thrift, long startTime, long endTime)
 {
     return(await Task <IList <TmpSnapInfo> > .Run(() =>
     {
         CameraSnapPerson suspectObj = new CameraSnapPerson();
         IList <TmpSnapInfo> result = thrift.GetNoTargetAnalysisResult(ref suspectObj, startTime, endTime);
         tempSuspectObject = suspectObj;
         return result;
     }).ConfigureAwait(false));
 }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="thrift"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        async void GoNoTarget(ThirftService thrift, long startTime, long endTime)
        {
            List <TargetedAnalysis> formapResult     = new List <TargetedAnalysis>();
            IList <TmpSnapInfo>     forsuspectResult = new List <TmpSnapInfo>();

            SusipciousInfo = new CameraSnapPerson();

            await Task.Run(() =>
            {
                LoadingVisiblity = Visibility.Visible;
                OnPropertyChanged("LoadingVisiblity");

                formapResult     = formapResult = AsyncSelectNoTargetForMap(thrift, startTime, endTime).Result;
                forsuspectResult = AsyncSelectNoTargetForSusipcious(thrift, startTime, endTime).Result;
            });

            try
            {
                NoTargetControlContent.MainMap.Points =
                    GMapForWpf.SetMapAnchor <TargetedAnalysis>(formapResult,
                                                               new Uri("pack://application:,,,/Images/home-icon-bluecamera.png"));

                if (NoTargetControlContent.MainMap.Points.Count > 0)
                {
                    NoTargetControlContent.MainMap.CurrentPosition = NoTargetControlContent.MainMap.Points[NoTargetControlContent.MainMap.Points.Count - 1].Point;
                }
                else
                {
                    NoTargetControlContent.MainMap.CurrentPosition = new GMap.NET.PointLatLng(GlobalCache.Latitude, GlobalCache.Longitude);
                }

                if (forsuspectResult.Count > 0)
                {
                    var temp = tempSuspectObject;
                    //SusipciousInfo = temp;//给SusipciousInfo赋值,导致异常
                    if (temp.PhotoByteArray.Length == 0)
                    {
                        Dispatcher.CurrentDispatcher.Invoke(() =>
                        {
                            SusipciousInfo.Photo = ImageConvert.ToImageSource("pack://application:,,,/Images/unkonw.png");
                            OnPropertyChanged("SusipciousInfo");
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                Logger <MainControlViewModel> .Log.Error("GoNoTarget", ex);
            }
            finally
            {
                LoadingVisiblity = Visibility.Collapsed;
            }
        }
        /// <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");
            }
        }
Ejemplo n.º 4
0
 private void AddTeamplateCmdFunc(object obj)
 {
     if (obj is CameraSnapPerson)
     {
         CameraSnapPerson csp = obj as CameraSnapPerson;
         MethodInfo       mi  = null;
         Window           w   = null;
         foreach (var item in Application.Current.Windows)
         {
             TypeInfo ti = item.GetType() as TypeInfo;
             if (ti.FullName.Equals(ZhangXiaowen.MainWindow))
             {
                 w  = item as Window;
                 mi = ti.GetMethod("SetTemplatePopWindow");
                 break;
             }
         }
         mi.Invoke(w, new object[] { csp.PhotoByteArray });
     }
 }
        async void LoadData(List <TrackInfo> TrackInfos)
        {
            await Task.Run(() =>
            {
                ListItemSourceObj = new List <CameraSnapPerson>();
                int row           = 0;
                foreach (var 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);
                }
                ListItemSourceObj.Add(null);
            }).ConfigureAwait(false);
        }
Ejemplo n.º 6
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();
        }
Ejemplo n.º 7
0
        private void GoToBICommandFunc(object obj)
        {
            CameraSnapPerson model = obj as CameraSnapPerson;

            this.GoToCommandFunc(model, 6);
        }
Ejemplo n.º 8
0
        public IList <TmpSnapInfo> GetNoTargetAnalysisResult(ref CameraSnapPerson suspectObj, long btime, long etime)
        {
            BusinessServer.Client bServerClient = null;
            TTransport            transport     = SocketOpter.Init(GlobalCache.Host, GlobalCache.Port, 0, ref bServerClient);
            SuspectAnalysisInfo   results       = SocketOpter.GetResult <ThirftService, SuspectAnalysisInfo, long, long>(
                transport,
                bServerClient.QueryKeyAreaSuspectAnalysis,
                "GetNoTargetAnalysisResult[QueryKeyAreaSuspectAnalysis]", true,
                btime, etime
                );

            List <TmpSnapInfo> result = new List <TmpSnapInfo>();

            try
            {
                suspectObj                     = new CameraSnapPerson();
                suspectObj.Photo               = ImageConvert.ToBitmapImage(results.Capcfg.Image);
                suspectObj.PhotoByteArray      = results.Capcfg.Image;
                suspectObj.CameraInfo          = new Camera();
                suspectObj.CameraInfo.Id       = results.Capcfg.Id;
                suspectObj.CameraInfo.Name     = results.Capcfg.Channelname;
                suspectObj.CameraInfo.Location = results.Capcfg.Address;
                if (results.Capcfg.Time > 0)
                {
                    string tmp = DateTimeConvert.LongTimeToString(results.Capcfg.Time);
                    suspectObj.SnapDate = Convert.ToDateTime(tmp).ToShortDateString();
                    suspectObj.SnapTime = Convert.ToDateTime(tmp).ToShortTimeString();
                }
                else
                {
                    suspectObj.SnapDate = string.Empty;
                    suspectObj.SnapTime = string.Empty;
                }

                foreach (SuspectAnalysis item in results.Sulist)
                {
                    TmpSnapInfo ts = new TmpSnapInfo();
                    ts.CameraChannelId = item.TcChannelID;
                    ts.CameraChannel   = item.Name;
                    ts.Longitude       = item.Longitude;
                    ts.Latitude        = item.Latitude;
                    ts.Location        = item.Channel_address;

                    #region TopFive
                    for (int i = 0; i < item.Capimg.Count; i++)
                    {
                        switch (i)
                        {
                        case 0:
                            ts.CameraTopOne = new Camera
                            {
                                Name               = item.Name,
                                SnapPersonCount    = item.Capimg[i].Count,
                                SnapPersonCountStr = item.Capimg[i].Count + " 次",
                                SnapPhoto          = ImageConvert.ToBitmapImage(item.Capimg[i].Capimg),
                                Location           = item.Channel_address,
                            };
                            break;

                        case 1:
                            ts.CameraTopTwo = new Camera
                            {
                                Name               = item.Name,
                                SnapPersonCount    = item.Capimg[i].Count,
                                SnapPersonCountStr = item.Capimg[i].Count + " 次",
                                SnapPhoto          = ImageConvert.ToBitmapImage(item.Capimg[i].Capimg),
                                Location           = item.Channel_address,
                            };
                            break;

                        case 2:
                            ts.CameraTopThree = new Camera
                            {
                                Name               = item.Name,
                                SnapPersonCount    = item.Capimg[i].Count,
                                SnapPersonCountStr = item.Capimg[i].Count + " 次",
                                SnapPhoto          = ImageConvert.ToBitmapImage(item.Capimg[i].Capimg),
                                Location           = item.Channel_address,
                            };
                            break;

                        case 3:
                            ts.CameraTopFour = new Camera
                            {
                                Name               = item.Name,
                                SnapPersonCount    = item.Capimg[i].Count,
                                SnapPersonCountStr = item.Capimg[i].Count + " 次",
                                SnapPhoto          = ImageConvert.ToBitmapImage(item.Capimg[i].Capimg),
                                Location           = item.Channel_address,
                            };
                            break;

                        case 4:
                            ts.CameraTopFive = new Camera
                            {
                                Name               = item.Name,
                                SnapPersonCount    = item.Capimg[i].Count,
                                SnapPersonCountStr = item.Capimg[i].Count + " 次",
                                SnapPhoto          = ImageConvert.ToBitmapImage(item.Capimg[i].Capimg),
                                Location           = item.Channel_address,
                            };
                            break;
                        }
                    }
                    #endregion

                    result.Add(ts);
                }
            }
            catch (Exception ex)
            {
                Logger <ThirftService> .Log.Error("GetNoTargetAnalysisResult", ex);
            }
            return(result);
        }