| LB_SmartVision/Forms/Pages/ProcessPage/AllProcessesPage.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| LB_SmartVision/VisionForm.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| LB_VisionControl/UserHSmartWindowControl.Designer.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| LB_VisionControl/UserHSmartWindowControl.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| LB_VisionProcesses/Alogrithms/VisualLargeModel/VisualSegmentationModel.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| LB_VisionProcesses/LB_VisionProcesses.csproj | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
LB_SmartVision/Forms/Pages/ProcessPage/AllProcessesPage.cs
@@ -9,7 +9,12 @@ public partial class AllProcessesPage : TabPage { public ObservableConcurrentDictionary<string, ProcessControl> dicProcessControls = new ObservableConcurrentDictionary<string, ProcessControl>(); // ä¿åæ§ä»¶åå§å¸å±ï¼å°ºå¯¸+ä½ç½®ï¼ï¼ç¨äºæ¢å¤ç©éµå¸å± private Dictionary<string, (Size Size, Point Location)> _originalControlLayouts = new Dictionary<string, (Size, Point)>(); // æ è®°æ¯å¦å¤äºå ¨å±ç¶æ private bool _isFullScreen = false; // è®°å½å½åå ¨å±çæ§ä»¶æ é¢ private string _fullScreenControlTitle = string.Empty; /// <summary> /// å®ä¾åæµç¨çé¢ /// </summary> @@ -49,8 +54,16 @@ { if (dicProcessControls.ContainsKey(title)) { // ç§»é¤åå è§£ç»äºä»¶ï¼é¿å å åæ³æ¼ var control = dicProcessControls[title]; control.event_MouseDoubleClick -= ProcessControl_DoubleClick; this.controlsPanel.Controls.Remove(dicProcessControls[title]); dicProcessControls.TryRemove(title, out _); // ç§»é¤åå§å¸å±è®°å½ if (_originalControlLayouts.ContainsKey(title)) _originalControlLayouts.Remove(title); } } } @@ -61,45 +74,142 @@ if (GlobalVar.dicProcesses.ContainsKey(layout.ProcessName)) enableLayout++; } //æ»è¡æ°ï¼åä¸åæ´ int matrixRows = (int)Math.Floor(Math.Sqrt(enableLayout)); if (enableLayout == 0 || matrixRows == 0) { _originalControlLayouts.Clear(); _isFullScreen = false; _fullScreenControlTitle = string.Empty; // æ å¯ç¨å¸å±æ¶ç´æ¥è¿åï¼é¿å é¤é¶é误 return; } //æ»åæ°ï¼åä¸åæ´ int matrixColumns = (int)Math.Ceiling((double)enableLayout / matrixRows); int index = 0; // è®¡ç®æ¯ä¸ªProcessControlçå°ºå¯¸ï¼æè¡ååå颿¿å¤§å°ï¼ int controlWidth = this.controlsPanel.Width / matrixColumns; int controlHeight = this.controlsPanel.Height / matrixRows; // æ¯æ¬¡éæå¸å±æ¶æ¸ 空åå§è®°å½ _originalControlLayouts.Clear(); for (int i = 0; i < GlobalVar.dicLayout.Count; i++) { string name = GlobalVar.dicLayout[i].ProcessName; string title = GlobalVar.dicLayout[i].Title; if (GlobalVar.dicProcesses.ContainsKey(name)) { // 计ç®å½åæ§ä»¶çè¡åç´¢å¼ int colIndex = index % matrixColumns; // åç´¢å¼ï¼0,1,0,1...ï¼ int rowIndex = index / matrixColumns; // è¡ç´¢å¼ï¼0,0,1,1...ï¼ // 计ç®åå§ä½ç½®å尺寸ï¼ç©éµå¸å±ï¼ Size originalSize = new Size(controlWidth, controlHeight); Point originalLocation = new Point(colIndex * controlWidth, rowIndex * controlHeight); ProcessControl processControl; if (dicProcessControls.ContainsKey(title)) { ProcessControl processControl = dicProcessControls[title]; processControl.Size = new Size(this.controlsPanel.Size.Width / enableLayout , this.controlsPanel.Size.Height); processControl.Location = new Point(processControl.Size.Width * index, 0); if (GlobalVar.dicProcesses[name].GetImage(GlobalVar.dicLayout[i], out _, out HObject RecordImage)) dicProcessControls[title].ShowHoImage(RecordImage); // å¤ç¨å·²ææ§ä»¶ï¼æ´æ°å°ºå¯¸åä½ç½® processControl = dicProcessControls[title]; processControl.Size = originalSize; processControl.Location = originalLocation; processControl.Visible = true; // è§£ç»æ§äºä»¶ï¼é¿å éå¤ç»å® processControl.event_MouseDoubleClick -= ProcessControl_DoubleClick; } else { ProcessControl processControl = new ProcessControl(GlobalVar.dicLayout[i]); processControl.Size = new Size(this.controlsPanel.Size.Width / enableLayout , this.controlsPanel.Size.Height); processControl.Location = new Point(processControl.Size.Width * index, 0); // æ°å»ºæ§ä»¶ï¼æç©éµå¸å±èµå¼å°ºå¯¸åä½ç½® processControl = new ProcessControl(GlobalVar.dicLayout[i]); processControl.Size = originalSize; processControl.Location = originalLocation; processControl.SetTitle(title); // æ·»å å°åå ¸å颿¿ dicProcessControls.TryAdd(title, processControl); this.controlsPanel.Controls.Add(processControl); if (GlobalVar.dicProcesses[name].GetImage(GlobalVar.dicLayout[i], out _, out HObject RecordImage)) dicProcessControls[title].ShowHoImage(RecordImage); } index++; // ç»å®åå»äºä»¶ï¼å·¦é®ï¼åé¼ æ æä¸äºä»¶ï¼å³é®åå»ï¼ processControl.event_MouseDoubleClick += ProcessControl_DoubleClick; // ä¿ååå§å¸å±ï¼ç©éµç¶æï¼ _originalControlLayouts[title] = (originalSize, originalLocation); // æ´æ°å¾ç if (GlobalVar.dicProcesses[name].GetImage(GlobalVar.dicLayout[i], out _, out HObject recordImage)) dicProcessControls[title].ShowHoImage(recordImage); index++; // ä» å¯ç¨çå¸å±ç´¢å¼éå¢ } } // 妿å½åæ¯å ¨å±ç¶æï¼æ¢å¤ç©éµå¸å±åéç½®ç¶æ if (_isFullScreen) { _isFullScreen = false; _fullScreenControlTitle = string.Empty; } } #region åå»äºä»¶å¤çï¼å ¨å±/æ¢å¤å¸å±ï¼ /// <summary> /// å·¦é®åå»äºä»¶ï¼å ¨å±æ¾ç¤ºå½åProcessControl /// </summary> private void ProcessControl_DoubleClick(object sender, EventArgs e) { if (_isFullScreen) { RestoreMatrixLayout(); return; } var targetControl = sender as ProcessControl; if (targetControl == null || string.IsNullOrEmpty(targetControl.Title)) return; // è®°å½å ¨å±çæ§ä»¶æ é¢ _fullScreenControlTitle = targetControl.Title; _isFullScreen = true; // éèææå ¶ä»ProcessControlï¼ä» æ¾ç¤ºç®æ æ§ä»¶ foreach (var kvp in dicProcessControls) { if (kvp.Key != _fullScreenControlTitle) { kvp.Value.Visible = false; } else { // ç®æ æ§ä»¶è®¾ä¸ºé¢æ¿å¤§å°ï¼ä½ç½®(0,0)ï¼å ¨å±ï¼ kvp.Value.Size = this.controlsPanel.Size; kvp.Value.Location = new Point(0, 0); kvp.Value.BringToFront(); // ç¡®ä¿å¨æä¸å± } } } /// <summary> /// æ¢å¤ç©éµå¸å±ï¼å¤ç¨InitVisionUIçæ ¸å¿é»è¾ï¼é¿å 代ç éå¤ï¼ /// </summary> private void RestoreMatrixLayout() { // 1. éç½®å ¨å±ç¶æ _isFullScreen = false; _fullScreenControlTitle = string.Empty; // 2. æ¢å¤æææ§ä»¶çåå§å°ºå¯¸ãä½ç½®åå¯è§æ§ foreach (var kvp in dicProcessControls) { string title = kvp.Key; var control = kvp.Value; // 3. ä»åå§å¸å±åå ¸ä¸æ¢å¤å°ºå¯¸åä½ç½® if (_originalControlLayouts.TryGetValue(title, out var originalLayout)) { control.Size = originalLayout.Size; control.Location = originalLayout.Location; } control.Visible = true; // æ¾ç¤ºæ§ä»¶ } } #endregion } } LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs
@@ -10,6 +10,25 @@ { UserHSmartWindowControl UserHSmartWindowControl = new UserHSmartWindowControl(); public string Title = string.Empty; public event Control_MouseDown event_MouseDown; public event Control_MouseDoubleClick event_MouseDoubleClick; private void event_mouseDown(object sender, MouseEventArgs e) { if (event_MouseDown != null) { event_MouseDown(sender, e); } } private void event_mouseDoubleClick(object sender, MouseEventArgs e) { if (event_MouseDoubleClick != null) { event_MouseDoubleClick(this, e); } } ProcessRunBll ProcessRunBll { get @@ -38,12 +57,13 @@ { this.panel1.Controls.Add(this.UserHSmartWindowControl); this.UserHSmartWindowControl.Dock = DockStyle.Fill; this.UserHSmartWindowControl.event_MouseDoubleClick += event_mouseDoubleClick; this.UserHSmartWindowControl.event_MouseDown += event_mouseDown; SetTitle(_Layout.ProcessName); Title = _Layout.Title; if (ProcessRunBll != null) this.label1.Text = $"æ»æ°ï¼{ProcessRunBll.total}"; this.isClosed = false ; this.isClosed = false; var TaskPhotoContinue = Task.Factory.StartNew(() => { ThreadCircleRun(); LB_SmartVision/VisionForm.cs
@@ -1402,6 +1402,7 @@ GlobalVar.strProductName = com_ProductName.SelectedItem?.ToString(); foreach (BaseCamera camera in GlobalVar.dicCameras.Values) { camera.TriggerRunMessageReceived -= TriggerRunMessageReceived; camera.Dispose(); } GlobalVar.dicCameras.Clear(); LB_VisionControl/UserHSmartWindowControl.Designer.cs
@@ -44,14 +44,15 @@ // // RightContextMenuStrip // RightContextMenuStrip.ImageScalingSize = new Size(20, 20); RightContextMenuStrip.Items.AddRange(new ToolStripItem[] { resizeImageStripMenuItem, autoSizeStripMenuItem, mouseIndexStripMenuItem }); RightContextMenuStrip.Name = "RightContextMenuStrip"; RightContextMenuStrip.Size = new Size(149, 70); RightContextMenuStrip.Size = new Size(169, 82); // // resizeImageStripMenuItem // resizeImageStripMenuItem.Name = "resizeImageStripMenuItem"; resizeImageStripMenuItem.Size = new Size(148, 22); resizeImageStripMenuItem.Size = new Size(168, 26); resizeImageStripMenuItem.Text = "éæ°ç¼©æ¾å¾å"; resizeImageStripMenuItem.Click += resizeImageStripMenuItem_Click; // @@ -60,39 +61,41 @@ autoSizeStripMenuItem.Checked = true; autoSizeStripMenuItem.CheckState = CheckState.Checked; autoSizeStripMenuItem.Name = "autoSizeStripMenuItem"; autoSizeStripMenuItem.Size = new Size(148, 22); autoSizeStripMenuItem.Size = new Size(168, 26); autoSizeStripMenuItem.Text = "å¾åèªå¨éåº"; autoSizeStripMenuItem.Click += autoSizeStripMenuItem_Click; // // mouseIndexStripMenuItem // mouseIndexStripMenuItem.Name = "mouseIndexStripMenuItem"; mouseIndexStripMenuItem.Size = new Size(148, 22); mouseIndexStripMenuItem.Size = new Size(168, 26); mouseIndexStripMenuItem.Text = "é¼ æ ç´¢å¼åç´ "; mouseIndexStripMenuItem.Click += mouseIndexStripMenuItem_Click; // // BtmStatusStrip // BtmStatusStrip.ImageScalingSize = new Size(20, 20); BtmStatusStrip.Items.AddRange(new ToolStripItem[] { StatusLabel }); BtmStatusStrip.Location = new Point(0, 220); BtmStatusStrip.Location = new Point(0, 280); BtmStatusStrip.Name = "BtmStatusStrip"; BtmStatusStrip.Padding = new Padding(1, 0, 16, 0); BtmStatusStrip.Size = new Size(274, 22); BtmStatusStrip.Padding = new Padding(1, 0, 20, 0); BtmStatusStrip.Size = new Size(342, 22); BtmStatusStrip.TabIndex = 44; BtmStatusStrip.Text = "statusStrip1"; // // StatusLabel // StatusLabel.Name = "StatusLabel"; StatusLabel.Size = new Size(0, 17); StatusLabel.Size = new Size(0, 16); // // pnl // pnl.Controls.Add(hWindowControl); pnl.Dock = DockStyle.Fill; pnl.Location = new Point(0, 0); pnl.Margin = new Padding(4); pnl.Name = "pnl"; pnl.Size = new Size(274, 220); pnl.Size = new Size(342, 280); pnl.TabIndex = 45; // // hWindowControl @@ -104,29 +107,30 @@ hWindowControl.Dock = DockStyle.Fill; hWindowControl.HDoubleClickToFitContent = true; hWindowControl.HDrawingObjectsModifier = HalconDotNet.HSmartWindowControl.DrawingObjectsModifier.None; hWindowControl.HImagePart = new Rectangle(0, 88, 2591, 1767); hWindowControl.HImagePart = new Rectangle(-321, -152, 3233, 2247); hWindowControl.HKeepAspectRatio = true; hWindowControl.HMoveContent = true; hWindowControl.HZoomContent = HalconDotNet.HSmartWindowControl.ZoomContent.WheelForwardZoomsIn; hWindowControl.Location = new Point(0, 0); hWindowControl.Margin = new Padding(4); hWindowControl.Margin = new Padding(5); hWindowControl.Name = "hWindowControl"; hWindowControl.Size = new Size(274, 220); hWindowControl.Size = new Size(342, 280); hWindowControl.TabIndex = 43; hWindowControl.WindowSize = new Size(274, 220); hWindowControl.WindowSize = new Size(342, 280); hWindowControl.HMouseMove += hWindowControl_HMouseMove; hWindowControl.HMouseDown += hWindowControl_HMouseDown; hWindowControl.HMouseUp += hWindowControl_HMouseUp; hWindowControl.HMouseDoubleClick += hWindowControl_HMouseDoubleClick; // // UserHSmartWindowControl // AutoScaleDimensions = new SizeF(96F, 96F); AutoScaleDimensions = new SizeF(120F, 120F); AutoScaleMode = AutoScaleMode.Dpi; Controls.Add(pnl); Controls.Add(BtmStatusStrip); Margin = new Padding(4); Margin = new Padding(5); Name = "UserHSmartWindowControl"; Size = new Size(274, 242); Size = new Size(342, 302); Load += UserHSmartWindowControl_Load; SizeChanged += UserHSmartWindowControl_SizeChanged; MouseWheel += UserHSmartWindowControl_HMouseWheel; LB_VisionControl/UserHSmartWindowControl.cs
@@ -1,9 +1,12 @@ using HalconDotNet; using Sunny.UI.Win32; using System.Diagnostics; using System.Windows.Forms; namespace LB_VisionControl { public delegate void Control_MouseDown(object sender, MouseEventArgs e); public delegate void Control_MouseDoubleClick(object sender, MouseEventArgs e); public partial class UserHSmartWindowControl : UserControl { public UserHSmartWindowControl() @@ -19,7 +22,22 @@ // 设置é»è®¤åä½ä¸º 20å· monoåä½å ç² set_display_font(this.hWindowControl.HalconWindow, 20, "mono", "true", "false"); } public event Control_MouseDown event_MouseDown; public event Control_MouseDoubleClick event_MouseDoubleClick; private void event_mouseDown(object sender, MouseEventArgs e) { if (event_MouseDown != null) { event_MouseDown(sender, e); } } private void event_mouseDoubleClick(object sender, MouseEventArgs e) { if (event_MouseDoubleClick != null) { event_MouseDoubleClick(sender, e); } } private void UserHSmartWindowControl_Load(object sender, EventArgs e) { // å¯ç¨åç¼å²åå°éªç @@ -969,6 +987,8 @@ default: break; } MouseEventArgs mouseEventArgs = new MouseEventArgs(e.Button, e.Clicks, (int)e.X, (int)e.Y, e.Delta); event_mouseDown(sender, mouseEventArgs); } catch { } } @@ -1171,5 +1191,11 @@ { ShowHoImage(hImage); } private void hWindowControl_HMouseDoubleClick(object sender, HMouseEventArgs e) { MouseEventArgs mouseEventArgs = new MouseEventArgs(e.Button, e.Clicks, (int)e.X, (int)e.Y, e.Delta); event_mouseDoubleClick(sender, mouseEventArgs); } } } LB_VisionProcesses/Alogrithms/VisualLargeModel/VisualSegmentationModel.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,13 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LB_VisionProcesses.Alogrithms.VisualLargeModel { [Process("è§è§å岿¨¡å", Category = "深度å¦ä¹ å·¥å ·", Description = "å建è§è§å岿¨¡åå·¥å ·")] public class VisualSegmentationModel : TAlgorithm { } } LB_VisionProcesses/LB_VisionProcesses.csproj
@@ -36,10 +36,6 @@ </ItemGroup> <ItemGroup> <Folder Include="Alogrithms\VisualLargeModel\" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\LB_SmartVisionCameraDevice\LB_SmartVisionCameraDevice.csproj" /> <ProjectReference Include="..\LB_SmartVisionCommon\LB_SmartVisionCommon.csproj" /> <ProjectReference Include="..\LB_VisionControl\LB_VisionControl.csproj" />