Exemplo n.º 1
0
        /// <summary>
        /// 初始化修改通道信息
        /// </summary>
        /// <param name="_ChannelCfg"></param>
        public void SetChannelInfo(MyChannelCfg _ChannelCfg)
        {
            try
            {
                btnChannelNumGeneration.IsEnabled = false;
                cIViewModel.Title               = "修改通道";
                cIViewModel.ChannelId           = _ChannelCfg.TcChaneelID;
                cIViewModel.ChannelName         = _ChannelCfg.Name;
                cIViewModel.SelectedChannelType = _ChannelCfg.ChannelType;
                cIViewModel.Remark              = _ChannelCfg.TcDescription;

                cIViewModel.CaptureAddr         = _ChannelCfg.Addr;
                cIViewModel.CapturePort         = "" + _ChannelCfg.Port;
                cIViewModel.SelectedType        = _ChannelCfg.CaptureCfg.NCaptureType;
                cIViewModel.VideoAddr           = _ChannelCfg.CaptureCfg.TcAddr;
                cIViewModel.UID                 = _ChannelCfg.CaptureCfg.TcUID;
                cIViewModel.PSW                 = _ChannelCfg.CaptureCfg.TcPSW;
                cIViewModel.VideoPort           = "" + _ChannelCfg.CaptureCfg.NPort;
                cIViewModel.MinFace             = "" + _ChannelCfg.CatchFaceCfg.NMinFace;
                cIViewModel.MinQuality          = "" + _ChannelCfg.CatchFaceCfg.NMinQuality;
                cIViewModel.MinCapDistance      = "" + _ChannelCfg.CatchFaceCfg.NMinCapDistance;
                cIViewModel.MaxFaceSaveDistance = "" + _ChannelCfg.CatchFaceCfg.NMaxFaceSaveDistance;
                cIViewModel.Yaw                 = "" + _ChannelCfg.CatchFaceCfg.NYaw;
                cIViewModel.Pitch               = "" + _ChannelCfg.CatchFaceCfg.NPitch;
                cIViewModel.Yoll                = "" + _ChannelCfg.CatchFaceCfg.NYoll;
                cIViewModel.Channel_address     = _ChannelCfg.Channel_address;
                cIViewModel.Latitude            = _ChannelCfg.Latitude;
                cIViewModel.Longitude           = _ChannelCfg.Longitude;

                try
                {
                    ObservableCollection <PointLatLngImg> points = new ObservableCollection <PointLatLngImg>();
                    PointLatLngImg point = new PointLatLngImg();
                    point.Point         = new PointLatLng(Convert.ToDouble(_ChannelCfg.Latitude ?? "0"), Convert.ToDouble(_ChannelCfg.Longitude ?? "0"));
                    point.Id            = _ChannelCfg.TcChaneelID;
                    point.Img           = ImageConvert.ToImageSource("pack://application:,,,/Images/home-icon-bluecamera.png");
                    point.ImgVisibility = Visibility.Visible;
                    points.Add(point);

                    MainMap.Points          = points;
                    MainMap.CurrentPosition = point.Point;
                }
                catch (Exception ex)
                {
                    Logger <ChannelInfo> .Log.Error("SetChannelInfo", ex);
                }
            }
            catch (Exception ex)
            {
                Logger <ChannelInfo> .Log.Error("SetChannelInfo", ex);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="channel"></param>
        /// <param name="blueCamera">"pack://application:,,,/Images/home-icon-bluecamera.png"</param>
        /// <param name="redCamera">"pack://application:,,,/Images/home-icon-redcamera.png"</param>
        /// <param name="anchorVar"></param>
        public static ObservableCollection <PointLatLngImg> BrushCameraForChannel(IEnumerable channel, string blueCamera, string redCamera, params string[] anchorVar)
        {
            ObservableCollection <PointLatLngImg> Points = new ObservableCollection <PointLatLngImg>();
            ImageSourceConverter imageSourceConverter    = new ImageSourceConverter();
            StreamResourceInfo   streamResourceInfo      = Application.GetResourceStream(new Uri(blueCamera));
            StreamResourceInfo   redCameraStreamResource = null;

            if (!string.IsNullOrEmpty(redCamera))
            {
                redCameraStreamResource = Application.GetResourceStream(new Uri(redCamera));
            }

            foreach (MyChannelCfg mcc in channel)
            {
                PointLatLngImg point = new PointLatLngImg();
                point.Id          = mcc.TcChaneelID;
                point.ChannelName = mcc.Name;
                point.Location    = mcc.Channel_address;

                if (!string.IsNullOrEmpty(mcc.Latitude) && !string.IsNullOrEmpty(mcc.Longitude))
                {
                    point.Point = new GMap.NET.PointLatLng(Convert.ToDouble(mcc.Latitude), Convert.ToDouble(mcc.Longitude));
                }

                if (GlobalCache.AlarmCamera.Contains(mcc.TcChaneelID))
                {
                    point.Img = (ImageSource)imageSourceConverter.ConvertFrom(redCameraStreamResource.Stream);
                }
                else
                {
                    point.Img = (ImageSource)imageSourceConverter.ConvertFrom(streamResourceInfo.Stream);
                }
                //if (mcc.ChannelType == 1 && !string.IsNullOrEmpty(redCamera))
                //{
                //    point.Img = (ImageSource)imageSourceConverter.ConvertFrom(redCameraStreamResource.Stream);
                //}
                //else
                //{
                //    point.Img = (ImageSource)imageSourceConverter.ConvertFrom(streamResourceInfo.Stream);
                //}

                point.ChannelNameVisibility = Visibility.Visible;
                point.LocationVisibility    = Visibility.Visible;
                point.ImgVisibility         = Visibility.Visible;
                Points.Add(point);
            }

            return(Points);
        }
        public NoTargetControl()
        {
            InitializeComponent();
            MainControlViewModel.NoTargetControlContent = this;

            try
            {
                PointLatLngImg point = new PointLatLngImg();
                point.Point = new PointLatLng(GlobalCache.Latitude, GlobalCache.Longitude);
                MainControlViewModel.NoTargetControlContent.MainMap.CurrentPosition = point.Point;
            }
            catch (Exception ex)
            {
                Logger <NoTargetControl> .Log.Error("NoTargetControl", ex);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="datasource"></param>
        /// <param name="photoBuffer"></param>
        /// <param name="str">不许为空</param>
        /// <returns></returns>
        public static ObservableCollection <PointLatLngImg> SetMapAnchor <T>(IEnumerable datasource, byte[] photoBuffer, params string[] str)
            where T : class, new()
        {
            T t = new T();
            ObservableCollection <PointLatLngImg> Points = new ObservableCollection <PointLatLngImg>();

            try
            {
                if (t is CameraSnapPerson)
                {
                    foreach (CameraSnapPerson item in datasource)
                    {
                        PointLatLngImg point = new PointLatLngImg();
                        if (string.IsNullOrEmpty(item.CameraInfo.Longitude) && string.IsNullOrEmpty(item.CameraInfo.Latitude))
                        {
                            point.Point = new GMap.NET.PointLatLng(0, 0);
                        }
                        else
                        {
                            point.Point = new GMap.NET.PointLatLng(Convert.ToDouble(item.CameraInfo.Latitude),
                                                                   Convert.ToDouble(item.CameraInfo.Longitude));
                        }
                        point.Img                = ImageConvert.ToBitmapImage(photoBuffer);
                        point.ImgVisibility      = Visibility.Visible;
                        point.ImgframeVisibility = Visibility.Visible;

                        //point.Name = item.Name;
                        point.Name                      = str[0].Substring(3);
                        point.ChannelName               = item.CameraInfo.Name;
                        point.Location                  = item.CameraInfo.Location;
                        point.SnapPersonCount           = item.CameraInfo.SnapPersonCount;
                        point.NameVisibility            = Visibility.Visible;
                        point.ChannelNameVisibility     = Visibility.Visible;
                        point.LocationVisibility        = Visibility.Visible;
                        point.SnapPersonCountVisibility = Visibility.Visible;

                        Points.Add(point);
                    }
                }
            }
            catch (Exception)
            {
            }
            return(Points);
        }
Exemplo n.º 5
0
        private void MainMap_ClickAnchor(PointLatLngImg point)
        {
            //try
            //{
            //    if (_ChannelManageViewModel.ChannelList != null && _ChannelManageViewModel.ChannelList.Count > 0)
            //    {
            //        foreach (ChannelListItemViewModel channel in _ChannelManageViewModel.ChannelList)
            //        {
            //            if (channel.MyChannelCfg.TcChaneelID == point.Id)
            //            {
            //                _ChannelManageViewModel.CurrentPointChannelListItem = channel;
            //                break;
            //            }
            //        }
            //    }
            //    if (_ChannelManageViewModel.CurrentPointChannelListItem != null)
            //    {
            //        var video1 = Application.Current.Windows.Cast<Window>().FirstOrDefault(x => x is VideoPreview);
            //        if (video1 == null)
            //        {
            //            VideoPreview video = new VideoPreview(_ChannelManageViewModel);
            //            video.Show();
            //        }
            //        else
            //        {
            //            VideoPreview video2 = video1 as VideoPreview;
            //            video2.Close();
            //            if (video2.wfh.Tag != null && video2.wfh.Tag.ToString() == video2.lbi.MyChannelCfg.TcChaneelID)
            //            {
            //                (video2.wfh.Child as UserControl1).closecamera();
            //                video2.wfh.Child = null;
            //                video2.wfh.Tag = null;
            //            }

            //            VideoPreview video = new VideoPreview(_ChannelManageViewModel);
            //            video.Show();
            //        }
            //    }
            //}
            //catch (Exception ex)
            //{
            //    Logger<ChannelManage>.Log.Error("ChannelManageListBox_MouseDoubleClick", ex);
            //}
        }
Exemplo n.º 6
0
        public ChannelInfo()
        {
            InitializeComponent();

            GlobalCache.ChannePropertiesList = THRIFTSERVICES.Services.ThriftServiceBasic.SelectChannelPropertiesList();

            cIViewModel                       = new ChannelInfoViewModel();
            this.DataContext                  = cIViewModel;
            this.MouseLeftButtonDown         += ChannelInfo_MouseLeftButtonDown;
            btnChannelNumGeneration.IsEnabled = true;


            try
            {
                PointLatLngImg point = new PointLatLngImg();
                point.Point             = new PointLatLng(GlobalCache.Latitude, GlobalCache.Longitude);
                MainMap.CurrentPosition = point.Point;
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// new Uri("pack://application:,,,/Images/home-icon-bluecamera.png")
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="datasource"></param>
        /// <param name="uri"></param>
        /// <returns></returns>
        public static ObservableCollection <PointLatLngImg> SetMapAnchor <T>(IEnumerable datasource, Uri uri)
            where T : class, new()
        {
            T t = new T();
            ObservableCollection <PointLatLngImg> Points = new ObservableCollection <PointLatLngImg>();

            if (t is TargetedAnalysis)
            {
                try
                {
                    foreach (TargetedAnalysis item in datasource)
                    {
                        PointLatLngImg point = new PointLatLngImg();
                        point.Point = new GMap.NET.PointLatLng(Convert.ToDouble(item.Latitude),
                                                               Convert.ToDouble(item.Longitude));

                        ImageSourceConverter imageSourceConverter = new ImageSourceConverter();
                        StreamResourceInfo   streamResourceInfo   = Application.GetResourceStream(uri);
                        point.Img           = (ImageSource)imageSourceConverter.ConvertFrom(streamResourceInfo.Stream);
                        point.ImgVisibility = Visibility.Visible;

                        point.ChannelName               = item.Name;
                        point.Location                  = item.Channel_address;
                        point.SnapPersonCount           = item.Count;
                        point.ChannelNameVisibility     = Visibility.Visible;
                        point.LocationVisibility        = Visibility.Visible;
                        point.SnapPersonCountVisibility = Visibility.Visible;

                        Points.Add(point);
                    }
                }
                catch (Exception ex)
                {
                    Logger <GMapForWpf> .Log.Error("SetMapAnchor<T>", ex);
                }
            }
            return(Points);
        }
        public MainTraceAnalysisView()
        {
            InitializeComponent();

            try
            {
                LoadingVisiblity = Visibility.Collapsed;
                StartDay         = DateTime.Today.ToShortDateString();
                EndDay           = DateTime.Today.ToShortDateString();
                StartHours       = new List <string>();
                EndHours         = new List <string>();
                StartMinutes     = new List <int>();
                EndMinutes       = new List <int>();

                for (int i = 0; i <= 60; i++)
                {
                    if (i <= 24)
                    {
                        StartHours.Add(i + ":00");
                        EndHours.Add(i + ":00");
                    }
                    StartMinutes.Add(i);
                    EndMinutes.Add(i);
                }

                EndHour          = 23;
                EndMinute        = 59;
                this.DataContext = this;

                PointLatLngImg point = new PointLatLngImg();
                point.Point             = new PointLatLng(GlobalCache.Latitude, GlobalCache.Longitude);
                MainMap.CurrentPosition = point.Point;
            }
            catch (Exception ex)
            {
                Logger <MainTraceAnalysisView> .Log.Error("MainTraceAnalysisView()", ex);
            }
        }
        async void SearchResult(object sender, RoutedEventArgs e, ObservableCollection <PointLatLngImg> Points)
        {
            LoadingVisiblity = Visibility.Visible;

            await Task.Run(() =>
            {
                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 = AsyncSelectTrack(SnapPersonInfo.SnapId, SnapPersonInfo.PhotoByteArray, start, end).Result;
                        //thirft.QueryTrackPlayback(SnapPersonInfo.SnapId, SnapPersonInfo.PhotoByteArray, start, end);
                    }
                    else
                    {
                        comServer.SocketOpter.ExceptionMsgFromSTAThread("请添加照片");
                    }

                    this.LoadData(TrackInfos);//async

                    foreach (TrackInfo item in TrackInfos)
                    {
                        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);
                    }

                    if (TrackInfos.Count > 0)
                    {
                        this.MainMap.IsDisplayPolyline = true;
                        this.MainMap.Points            = Points;

                        if (MainMap.Points.Count > 0)
                        {
                            MainMap.CurrentPosition = MainMap.Points[MainMap.Points.Count - 1].Point;
                        }
                        else
                        {
                            MainMap.CurrentPosition = new GMap.NET.PointLatLng(GlobalCache.Latitude, GlobalCache.Longitude);
                        }
                    }
                    else
                    {
                        this.MainMap.IsDisplayPolyline = true;
                        this.MainMap.Points            = new ObservableCollection <PointLatLngImg>();
                    }
                }
                catch (Exception ex)
                {
                    Logger <MainTraceAnalysisView> .Log.Error("SearchResult", ex);
                }
                finally
                {
                    LoadingVisiblity = Visibility.Collapsed;
                }
            });
        }