/// <summary> /// 抓拍图片 /// </summary> /// <param name="video">要抓拍的摄像机</param> /// <param name="optimized">如果启用优化,则发现视频没有打开时不再尝试打开视频,而是直接返回</param> /// <returns></returns> public bool SnapShotTo(VideoSourceInfo video, string path, bool optimized) { bool success = false; VideoPanel vp = videoGrid.VideoPanelCollection.SingleOrDefault(v => (v.VideoSource == video)); if (vp != null) { //如果没有启用视频抓拍性能优化功能,则在抓拍时如果视频没有打开,会先尝试打开视频,启用优化后,视频由地感检测车到时打开,在抓拍时就不负责打开视频 //这样的话如果系统中存在有问题的视频,也不会影响软件的处理速度 if (vp.Status != VideoStatus.Playing && !optimized) { vp.Play(false); } if (vp.Status == VideoStatus.Playing) { success = vp.SnapShotTo(path); if (optimized) { lock (_TagLocker) { vp.Tag = success ? path : "fail"; //抓拍失败时也要通知下一次不要再继续抓拍了 } } } } return(success); }
/// ------------------------------------------------------------------------------------ public TextAnnotationEditor(ComponentFile file, string imageKey, Project project) : base(file, null, imageKey) { Logger.WriteEvent("TextAnnotationEditor constructor. file = {0}; imagekey = {1}", file, imageKey); InitializeComponent(); Name = "Annotations"; _toolStrip.Renderer = new NoToolStripBorderRenderer(); _comboPlaybackSpeed.Font = Program.DialogFont; _project = project; InitializeGrid(); LoadPlaybackSpeedCombo(); _comboPlaybackSpeed.SelectedIndexChanged += HandlePlaybackSpeedValueChanged; SetSpeedPercentage(Settings.Default.AnnotationEditorPlaybackSpeedIndex); _videoPanel = new VideoPanel(); _videoPanel.BackColor = Color.Black; _videoPanel.SetPlayerViewModel(_grid.PlayerViewModel); _splitter.Panel1.Controls.Add(_videoPanel); SetComponentFile(file); _splitter.Panel1.ClientSizeChanged += HandleSplitterPanel1ClientSizeChanged; _buttonHelp.Click += delegate { // SP-887: Change Help link for Annotations Program.ShowHelpTopic("/Using_Tools/Sessions_tab/Annotations_tab/Annotations_tab_overview.htm"); }; }
/// <summary> /// 抓拍图片 /// </summary> /// <param name="video">要抓拍的摄像机</param> /// <param name="path">抓拍图片路径,如摄像机自动抓拍,返回抓拍到的图片路径</param> /// <param name="optimized">如果启用优化,则发现视频没有打开时不再尝试打开视频,而是直接返回</param> /// <returns></returns> public bool SnapShotTo(VideoSourceInfo video, ref string path, bool optimized, bool force) { bool success = false; VideoPanel vp = videoGrid.VideoPanelCollection.SingleOrDefault(v => (v.VideoSource == video)); if (vp != null) { //如果没有启用视频抓拍性能优化功能,则在抓拍时如果视频没有打开,会先尝试打开视频,启用优化后,视频由地感检测车到时打开,在抓拍时就不负责打开视频 //这样的话如果系统中存在有问题的视频,也不会影响软件的处理速度 if (!vp.IsReadyForSnapshot && !optimized) { vp.OpenForSnapshot(false); } if (vp.IsReadyForSnapshot) { success = vp.SnapShotTo(ref path, 1000, force); if (optimized) { lock (_TagLocker) { vp.Tag = success ? path : "fail"; //抓拍失败时也要通知下一次不要再继续抓拍了 } } } } return(success); }
/// <summary> /// 清除最近保存的抓拍图片信息 /// </summary> /// <param name="video">摄像机</param> public void ClearSnapShot(VideoSourceInfo video) { VideoPanel vp = videoGrid.VideoPanelCollection.SingleOrDefault(v => (v.VideoSource == video)); if (vp != null) { vp.ClearSnapShot(); } }
void Start() { //Call this in Start() to ensure that the CameraStreamHelper is already "Awake". CameraStreamHelper.Instance.GetVideoCaptureAsync(OnVideoCaptureCreated); //You could also do this "shortcut": //CameraStreamManager.Instance.GetVideoCaptureAsync(v => videoCapture = v); _videoPanelUI = GameObject.FindObjectOfType <VideoPanel>(); }
void Start() { //Fetch a pointer to Unity's spatial coordinate system if you need pixel mapping _spatialCoordinateSystemPtr = UnityEngine.XR.WSA.WorldManager.GetNativeISpatialCoordinateSystemPtr(); //Call this in Start() to ensure that the CameraStreamHelper is already "Awake". CameraStreamHelper.Instance.GetVideoCaptureAsync(OnVideoCaptureCreated); //You could also do this "shortcut": //CameraStreamManager.Instance.GetVideoCaptureAsync(v => videoCapture = v); _videoPanelUI = GameObject.FindObjectOfType <VideoPanel>(); }
void Start() { _videoPanelUI = GameObject.FindObjectOfType <VideoPanel>(); #if !UNITY_EDITOR && (UNITY_WSA || NETFX_CORE) //Call this in Start() to ensure that the CameraStreamHelper is already "Awake". CameraStreamHelper.Instance.GetVideoCaptureAsync(OnVideoCaptureCreated); //You could also do this "shortcut": //CameraStreamManager.Instance.GetVideoCaptureAsync(v => videoCapture = v); #else StartCoroutine(initAndWaitForWebCamTexture()); #endif }
private void FillExistedPointInfo() { this.txtName.Text = _pointInfo.Name; this.txtIP.Text = _pointInfo.IP; this.txtPort.Text = _pointInfo.Port; //Fill items if (_pointInfo.Items == null || _pointInfo.Items.Count() == 0)//no item { return; } foreach (var item in _pointInfo.Items) { IItemControl itemCtr = null; if (item.Type == ItemType.App.ToString()) { itemCtr = new AppPanel(); } else if (item.Type == ItemType.Flash.ToString()) { itemCtr = new FlashPanel(); } else if (item.Type == ItemType.Image.ToString()) { itemCtr = new ImagePanel(); } else if (item.Type == ItemType.PPT.ToString()) { itemCtr = new PPTPanel(); } else if (item.Type == ItemType.Video.ToString()) { itemCtr = new VideoPanel(); } else if (item.Type == ItemType.WebPage.ToString()) { itemCtr = new WebPagePanel(); } //load config if (itemCtr != null) { this.flpItem.Controls.Add(itemCtr as UserControl); itemCtr.LoadItem(item); AddDeleteEvent(itemCtr); } } }
public QuadcopterApp() { InitializeComponent(); // merge menu strips foreach (ToolStripMenuItem menuItem in menuStrip1.Items) { menuItem.MergeAction = MergeAction.Append; } toolsToolStripMenuItem.MergeAction = MergeAction.MatchOnly; ToolStripManager.Merge(menuStrip1, base.MenuStrip); menuStrip1.Visible = false; // create panels dataPanel = new DataPanel(); mapPanel = new GMapPanel(); videoPanel = new DummyVideoPanel(); quickTools = new QuickTools(); dataPanel.Text = "Telemetry Data"; mapPanel.Text = "Map"; videoPanel.Text = "Dummy Video (not working)"; quickTools.Text = "Quick Tools"; Panels.Add(dataPanel, DockState.DockRight); Panels.Add(mapPanel, DockState.Document); Panels.Add(videoPanel, DockState.Document); Panels.Add(quickTools, DockState.DockLeft); // create message processors messageProcessorData = new MessageProcessor_Data(); messageProcessorPath = new MessageProcessor_Path(); messageProcessorMap = new MessageProcessor_Map(); messageProcessorData.Target = dataPanel; messageProcessorPath.Target = mapPanel; messageProcessorMap.Target = mapPanel; AddMessageProcessor(messageProcessorData); AddMessageProcessor(messageProcessorPath); AddMessageProcessor(messageProcessorMap); // init quick tools quickTools.AddMap(mapPanel); }
// Use this for initialization void Start() { //Fetch a pointer to Unity's spatial coordinate system if you need pixel mapping _spatialCoordinateSystemPtr = WorldManager.GetNativeISpatialCoordinateSystemPtr(); _videoPanelUI = GameObject.FindObjectOfType <VideoPanel>(); //Call this in Start() to ensure that the CameraStreamHelper is already "Awake". CameraStreamHelper.Instance.GetVideoCaptureAsync(OnVideoCaptureCreated); Debug.Log("Listening for top-down calib messages on port " + Port); #if NETFX_CORE Debug.Log("before starting ListenForMessages_UWP()"); ListenForMessages_UWP(Port); Debug.Log("after starting ListenForMessages_UWP()"); #else _tcpListenerThread = new Thread(() => ListenForMessages_UnityEditor(Port)); _tcpListenerThread.Start(); #endif }
// Use this for initialization void Start() { OutputDirectoryBasePath = MeshSaver.MeshFolderName; m_ToggleRecordingButtonText = ToggleRecordingButton.GetComponentInChildren <Text>(); Button btn = ToggleRecordingButton.GetComponent <Button>(); btn.onClick.AddListener(ToggleButtonOnClick); m_CurrentRecordingState = RecordingState.NotRecording; UpdateRecordingUI(); //Fetch a pointer to Unity's spatial coordinate system if you need pixel mapping _spatialCoordinateSystemPtr = WorldManager.GetNativeISpatialCoordinateSystemPtr(); //Call this in Start() to ensure that the CameraStreamHelper is already "Awake". CameraStreamHelper.Instance.GetVideoCaptureAsync(OnVideoCaptureCreated); //You could also do this "shortcut": //CameraStreamManager.Instance.GetVideoCaptureAsync(v => videoCapture = v); _videoPanelUI = GameObject.FindObjectOfType <VideoPanel>(); }
private void AddItem_Click(object sender, EventArgs e) { ItemType itemType = (ItemType)cbType.SelectedIndex; IItemControl itemtoAdd = null; switch (itemType) { case ItemType.Image: itemtoAdd = new ImagePanel(); break; case ItemType.PPT: itemtoAdd = new PPTPanel(); break; case ItemType.App: itemtoAdd = new AppPanel(); break; case ItemType.Flash: itemtoAdd = new FlashPanel(); break; case ItemType.Video: itemtoAdd = new VideoPanel(); break; case ItemType.WebPage: itemtoAdd = new WebPagePanel(); break; default: break; } itemtoAdd.IsChanged = true; AddDeleteEvent(itemtoAdd); }
public void ProcessReport(ReportBase r) { ParkInfo park = ParkBuffer.Current.GetPark(r.ParkID); if (park != null && park.RootParkID > 0) { park = ParkBuffer.Current.GetPark(park.RootParkID); } if (park == null) { return; } if (park.HostWorkstation == WorkStationInfo.CurrentStation.StationID) //如果本机是停车场的通讯主机,则它要负责抓拍图片 { EntranceInfo entrance = ParkBuffer.Current.GetEntrance(r.EntranceID); if (entrance != null) { foreach (VideoSourceInfo video in entrance.VideoSources) { if (r is CarSenseReport) { CarSenseReport cp = r as CarSenseReport; if (cp.InOrOutFlag == 1) //车到时打开视频 { VideoPanel vp = videoGrid.VideoPanelCollection.SingleOrDefault(v => (v.VideoSource == video)); if (vp != null) { if (UserSetting.Current.SnapshotWhenCarArrive) //车压地感时抓拍图片 { string path = Path.Combine(TempFolderManager.GetCurrentFolder(), string.Format("{0}_{1}_{2}.jpg", "CarArrive", Guid.NewGuid().ToString(), video.VideoID)); vp.Play(false); if (vp.Status == VideoStatus.Playing && vp.SnapShotTo(path)) { SnapShot shot = new SnapShot(cp.EventDateTime, video.VideoID, string.Empty, path); (new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); } } else { vp.Play(true); } } } else { if (AppSettings.CurrentSetting.Optimized) //启用视频优化车走时关闭视频 { VideoPanel vp = videoGrid.VideoPanelCollection.SingleOrDefault(v => (v.VideoSource == video)); if (vp != null) { vp.Close(); } } } } else if (r is CardEventReport) { CardEventReport cardEvent = r as CardEventReport; if (cardEvent.EventStatus == CardEventStatus.Valid) { VideoPanel vp = videoGrid.VideoPanelCollection.SingleOrDefault(v => (v.VideoSource == video)); if (vp != null) //如果视频已经抓拍了一张,则此次用同一张图 { object tag = null; lock (_TagLocker) //加锁是防止多个线程同时写 { tag = vp.Tag; vp.Tag = null; } if (tag != null) { string path = tag.ToString(); if (path != "fail") { SnapShot shot = new SnapShot(cardEvent.EventDateTime, video.VideoID, cardEvent.CardID, path); (new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); } } else { string path = Path.Combine(TempFolderManager.GetCurrentFolder(), string.Format("{0}_{1}_{2}.jpg", "CardEvent", Guid.NewGuid().ToString(), video.VideoID)); if (SnapShotTo(video, path, false)) { SnapShot shot = new SnapShot(cardEvent.EventDateTime, video.VideoID, cardEvent.CardID, path); (new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); } } } } } else if (r is AlarmReport) { AlarmReport ar = r as AlarmReport; if (ar.AlarmType == Ralid.Park.BusinessModel.Enum.AlarmType.Opendoor) { string path = Path.Combine(TempFolderManager.GetCurrentFolder(), string.Format("{0}_{1}_{2}.jpg", "OpenDoor", Guid.NewGuid().ToString(), video.VideoID)); if (SnapShotTo(video, path, false)) { SnapShot shot = new SnapShot(ar.EventDateTime, video.VideoID, string.Empty, path); (new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); } } } } } } }
/// <summary> /// Начинает отрисовку записи /// </summary> /// <param name="repUser">Пользователь, у которого сделали репост (null, если нет)</param> private void BeginLayoutDesign(User repUser, bool rep) { if (Copied_Post != null) { repost.Children.Add(new ctrPost(Copied_Post, repUser, true)); } if (!rep) { BitmapImage bilikes = new BitmapImage(); bilikes.BeginInit(); var streamlike = File.OpenRead(Environment.CurrentDirectory + @"\like.png"); bilikes.StreamSource = streamlike; bilikes.EndInit(); likesImage.Source = bilikes; BitmapImage bireps = new BitmapImage(); bireps.BeginInit(); var streamrep = File.OpenRead(Environment.CurrentDirectory + @"\rep.png"); bireps.StreamSource = streamrep; bireps.EndInit(); repImage.Source = bireps; } else { foot.Height = 0; user_ico.Width = 40; user_ico.Height = 40; user_ico_circle.RadiusX = 20; user_ico_circle.RadiusY = 20; user_ico_circle.Rect = new Rect(0, 0, 40, 40); } if (Videos != null) { videos.Margin = new Thickness(5, 0, 5, 5); //-------------adding-videos-------------\\ foreach (Video vid in Videos) { VideoPanel.Add(new ctrVideo(vid)); } } if (Photos != null) { photos.Margin = new Thickness(5, 0, 5, 5); //------------adding-photos--------------\\ foreach (Photo phot in Photos) { PhotoPanel.Add(new ctrPhoto(phot)); } } if (Poll != null) { polls.Margin = new Thickness(5, 0, 5, 5); //----------------add-poll---------------\\ PollPanel.Add(new ctrPoll(Poll)); } if (Audios != null) { foreach (Media.Audio aud in Audios) { AudioPanel.Add(new Audio(aud)); } } if (Links != null) { links.Margin = new Thickness(5, 0, 5, 5); //----------------add-link---------------\\ links.Children.Add(new ctrLink(Links[0])); } }
public void ProcessReport(ReportBase r) { ParkInfo park = ParkBuffer.Current.GetPark(r.ParkID); if (park != null && park.RootParkID > 0) { park = ParkBuffer.Current.GetPark(park.RootParkID); } if (park == null) { return; } if (park.HostWorkstation == WorkStationInfo.CurrentStation.StationID) //如果本机是停车场的通讯主机,则它要负责抓拍图片 { EntranceInfo entrance = ParkBuffer.Current.GetEntrance(r.EntranceID); if (entrance != null) { foreach (VideoSourceInfo video in entrance.VideoSources) { if (r is CarSenseReport) { CarSenseReport cp = r as CarSenseReport; if (cp.InOrOutFlag == 1) //车到时打开视频 { VideoPanel vp = videoGrid.VideoPanelCollection.SingleOrDefault(v => (v.VideoSource == video)); if (vp != null) { if (UserSetting.Current.SnapshotWhenCarArrive) //车压地感时抓拍图片 { string path = Path.Combine(TempFolderManager.GetCurrentFolder(), string.Format("{0}_{1}_{2}.jpg", "CarArrive", Guid.NewGuid().ToString(), video.VideoID)); if (SnapShotTo(video, ref path, false, false)) { SnapShot shot = new SnapShot(cp.EventDateTime, video.VideoID, string.Empty, path); string master = AppSettings.CurrentSetting.ImageDBConnStr; string standby = AppSettings.CurrentSetting.CurrentStandbyConnect; CommandResult result = (new SnapShotBll(master)).Insert(shot); if (result.Result != ResultCode.Successful && !string.IsNullOrEmpty(standby)) { (new SnapShotBll(standby)).Insert(shot); } //(new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); } else { if (AppSettings.CurrentSetting.Debug) { string logmsg = string.Format("【{0}】车压地感时抓拍图片失败 ", vp.VideoSource.VideoName); Ralid.GeneralLibrary.LOG.FileLog.Log("FrmSnapShoter", logmsg); } } } else { vp.OpenForSnapshot(true); } } } else { if (AppSettings.CurrentSetting.Optimized) //启用视频优化车走时关闭视频 { VideoPanel vp = videoGrid.VideoPanelCollection.SingleOrDefault(v => (v.VideoSource == video)); if (vp != null) { vp.Close(); } } } } else if (r is CardEventReport) { CardEventReport cardEvent = r as CardEventReport; if (cardEvent.EventStatus == CardEventStatus.Valid) { VideoPanel vp = videoGrid.VideoPanelCollection.SingleOrDefault(v => (v.VideoSource == video)); if (vp != null) //如果视频已经抓拍了一张,则此次用同一张图 { object tag = null; lock (_TagLocker) //加锁是防止多个线程同时写 { tag = vp.Tag; vp.Tag = null; } if (tag != null) { string path = tag.ToString(); if (path != "fail") { SnapShot shot = new SnapShot(cardEvent.EventDateTime, video.VideoID, cardEvent.CardID, path); string master = AppSettings.CurrentSetting.ImageDBConnStr; string standby = AppSettings.CurrentSetting.CurrentStandbyConnect; CommandResult result = (new SnapShotBll(master)).Insert(shot); if (result.Result != ResultCode.Successful && !string.IsNullOrEmpty(standby)) { (new SnapShotBll(standby)).Insert(shot); } //(new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); } else { if (AppSettings.CurrentSetting.Debug) { string logmsg = string.Format("【{0}】刷卡事件之前的视频抓拍失败,无图片 ", vp.VideoSource.VideoName); Ralid.GeneralLibrary.LOG.FileLog.Log("FrmSnapShoter", logmsg); } } } else { string path = Path.Combine(TempFolderManager.GetCurrentFolder(), string.Format("{0}_{1}_{2}.jpg", "CardEvent", Guid.NewGuid().ToString(), video.VideoID)); if (SnapShotTo(video, ref path, false, false)) { SnapShot shot = new SnapShot(cardEvent.EventDateTime, video.VideoID, cardEvent.CardID, path); string master = AppSettings.CurrentSetting.ImageDBConnStr; string standby = AppSettings.CurrentSetting.CurrentStandbyConnect; CommandResult result = (new SnapShotBll(master)).Insert(shot); if (result.Result != ResultCode.Successful && !string.IsNullOrEmpty(standby)) { (new SnapShotBll(standby)).Insert(shot); } //(new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); } else { if (AppSettings.CurrentSetting.Debug) { string logmsg = string.Format("【{0}】刷卡事件抓拍图片失败 ", vp.VideoSource.VideoName); Ralid.GeneralLibrary.LOG.FileLog.Log("FrmSnapShoter", logmsg); } } } vp.ClearSnapShot();//清空抓拍图片信息 } } } else if (r is AlarmReport) { AlarmReport ar = r as AlarmReport; if (ar.AlarmType == Ralid.Park.BusinessModel.Enum.AlarmType.Opendoor || ar.AlarmType == Ralid.Park.BusinessModel.Enum.AlarmType.GateAlarm) { string path = Path.Combine(TempFolderManager.GetCurrentFolder(), string.Format("{0}_{1}_{2}.jpg", "OpenDoor", Guid.NewGuid().ToString(), video.VideoID)); if (SnapShotTo(video, ref path, false, true)) { //这里清除抓拍图片信息,是因为使用信路通或大华进行抓拍时,会保存抓拍图片和识别到的车牌,如果不清除,有可能会用到下一辆车上 ClearSnapShot(video); SnapShot shot = new SnapShot(ar.EventDateTime, video.VideoID, string.Empty, path); string master = AppSettings.CurrentSetting.ImageDBConnStr; string standby = AppSettings.CurrentSetting.CurrentStandbyConnect; CommandResult result = (new SnapShotBll(master)).Insert(shot); if (result.Result != ResultCode.Successful && !string.IsNullOrEmpty(standby)) { (new SnapShotBll(standby)).Insert(shot); } //(new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); } else { if (AppSettings.CurrentSetting.Debug) { string logmsg = string.Format("【{0}】报警抓拍图片失败 ", video.VideoName); Ralid.GeneralLibrary.LOG.FileLog.Log("FrmSnapShoter", logmsg); } } } } } } } }
// Use this for initialization void Start() { Initialize(); videoPanelUI = GameObject.FindObjectOfType <VideoPanel>(); videoPanelUI.SetResolution(640, 480); }
public Video(VideoPanel panel) { videoPanel = panel; videoPanel.OnVideoCompleted += CompleteCommand; }