传输优化

This commit is contained in:
liu.wenjie
2021-03-17 16:08:13 +08:00
parent 1451352125
commit 0af0e8b01a
348 changed files with 12192 additions and 863190 deletions

View File

@@ -32,7 +32,6 @@
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.superTabControl1 = new DevComponents.DotNetBar.SuperTabControl();
this.superTabControlPanel1 = new DevComponents.DotNetBar.SuperTabControlPanel();
this.txbLog = new System.Windows.Forms.TextBox();
this.panelMultImage = new System.Windows.Forms.Panel();
this.gpb_multImage = new System.Windows.Forms.GroupBox();
this.btn_selectImageDirectory = new System.Windows.Forms.Button();
@@ -68,6 +67,10 @@
this.superTabControl2 = new DevComponents.DotNetBar.SuperTabControl();
this.imageDispPanel = new DevComponents.DotNetBar.SuperTabControlPanel();
this.superTabItem1 = new DevComponents.DotNetBar.SuperTabItem();
this.statusStrip = new System.Windows.Forms.StatusStrip();
this.lb_RunStatus = new System.Windows.Forms.ToolStripStatusLabel();
this.lb_Split = new System.Windows.Forms.ToolStripStatusLabel();
this.lb_RunTime = new System.Windows.Forms.ToolStripStatusLabel();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -82,11 +85,14 @@
this.superTabControlPanel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.superTabControl2)).BeginInit();
this.superTabControl2.SuspendLayout();
this.statusStrip.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
//
@@ -97,8 +103,8 @@
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.superTabControl2);
this.splitContainer1.Size = new System.Drawing.Size(1111, 477);
this.splitContainer1.SplitterDistance = 590;
this.splitContainer1.Size = new System.Drawing.Size(1111, 517);
this.splitContainer1.SplitterDistance = 605;
this.splitContainer1.TabIndex = 1;
//
// superTabControl1
@@ -128,7 +134,7 @@
this.superTabControl1.ReorderTabsEnabled = true;
this.superTabControl1.SelectedTabFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold);
this.superTabControl1.SelectedTabIndex = 0;
this.superTabControl1.Size = new System.Drawing.Size(590, 477);
this.superTabControl1.Size = new System.Drawing.Size(605, 517);
this.superTabControl1.TabFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.superTabControl1.TabIndex = 1;
this.superTabControl1.Tabs.AddRange(new DevComponents.DotNetBar.BaseItem[] {
@@ -139,7 +145,6 @@
//
// superTabControlPanel1
//
this.superTabControlPanel1.Controls.Add(this.txbLog);
this.superTabControlPanel1.Controls.Add(this.panelMultImage);
this.superTabControlPanel1.Controls.Add(this.panelOneImage);
this.superTabControlPanel1.Controls.Add(this.btn_browseImage);
@@ -152,19 +157,10 @@
this.superTabControlPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.superTabControlPanel1.Location = new System.Drawing.Point(0, 36);
this.superTabControlPanel1.Name = "superTabControlPanel1";
this.superTabControlPanel1.Size = new System.Drawing.Size(590, 441);
this.superTabControlPanel1.Size = new System.Drawing.Size(605, 481);
this.superTabControlPanel1.TabIndex = 1;
this.superTabControlPanel1.TabItem = this.tabReadFormLocal;
//
// txbLog
//
this.txbLog.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txbLog.Location = new System.Drawing.Point(3, 420);
this.txbLog.Name = "txbLog";
this.txbLog.Size = new System.Drawing.Size(585, 21);
this.txbLog.TabIndex = 93;
//
// panelMultImage
//
this.panelMultImage.BackColor = System.Drawing.Color.White;
@@ -593,7 +589,7 @@
this.superTabControl2.ReorderTabsEnabled = true;
this.superTabControl2.SelectedTabFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold);
this.superTabControl2.SelectedTabIndex = 0;
this.superTabControl2.Size = new System.Drawing.Size(517, 477);
this.superTabControl2.Size = new System.Drawing.Size(502, 517);
this.superTabControl2.TabFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.superTabControl2.TabIndex = 0;
this.superTabControl2.Tabs.AddRange(new DevComponents.DotNetBar.BaseItem[] {
@@ -606,7 +602,7 @@
this.imageDispPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.imageDispPanel.Location = new System.Drawing.Point(0, 36);
this.imageDispPanel.Name = "imageDispPanel";
this.imageDispPanel.Size = new System.Drawing.Size(517, 441);
this.imageDispPanel.Size = new System.Drawing.Size(502, 481);
this.imageDispPanel.TabIndex = 1;
this.imageDispPanel.TabItem = this.superTabItem1;
//
@@ -617,11 +613,42 @@
this.superTabItem1.Name = "superTabItem1";
this.superTabItem1.Text = "显示图像";
//
// statusStrip
//
this.statusStrip.BackColor = System.Drawing.Color.White;
this.statusStrip.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.lb_RunStatus,
this.lb_Split,
this.lb_RunTime});
this.statusStrip.Location = new System.Drawing.Point(0, 518);
this.statusStrip.Name = "statusStrip";
this.statusStrip.Size = new System.Drawing.Size(1111, 24);
this.statusStrip.TabIndex = 95;
this.statusStrip.Text = "statusStrip1";
//
// lb_RunStatus
//
this.lb_RunStatus.Name = "lb_RunStatus";
this.lb_RunStatus.Size = new System.Drawing.Size(0, 19);
//
// lb_Split
//
this.lb_Split.Name = "lb_Split";
this.lb_Split.Size = new System.Drawing.Size(189, 19);
this.lb_Split.Text = " ";
//
// lb_RunTime
//
this.lb_RunTime.Name = "lb_RunTime";
this.lb_RunTime.Size = new System.Drawing.Size(0, 19);
//
// FormHalconTool
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1111, 477);
this.ClientSize = new System.Drawing.Size(1111, 542);
this.Controls.Add(this.statusStrip);
this.Controls.Add(this.splitContainer1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FormHalconTool";
@@ -645,7 +672,10 @@
this.superTabControlPanel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.superTabControl2)).EndInit();
this.superTabControl2.ResumeLayout(false);
this.statusStrip.ResumeLayout(false);
this.statusStrip.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
@@ -689,6 +719,9 @@
private DevComponents.DotNetBar.SuperTabControl superTabControl2;
private DevComponents.DotNetBar.SuperTabControlPanel imageDispPanel;
private DevComponents.DotNetBar.SuperTabItem superTabItem1;
public System.Windows.Forms.TextBox txbLog;
public System.Windows.Forms.StatusStrip statusStrip;
public System.Windows.Forms.ToolStripStatusLabel lb_RunStatus;
private System.Windows.Forms.ToolStripStatusLabel lb_Split;
public System.Windows.Forms.ToolStripStatusLabel lb_RunTime;
}
}

Binary file not shown.

View File

@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

View File

@@ -8,9 +8,11 @@ using System.Windows.Forms;
using CommonMethods;
using HalconDotNet;
using ToolBase;
using System.Diagnostics;
namespace HalconTool
{
[Serializable]
public class HalconTool: IToolBase
{
/// <summary>
@@ -82,6 +84,14 @@ namespace HalconTool
/// </summary>
internal WorkMode workMode = WorkMode.ReadMultImage;
public ToolRunStatu toolRunStatu { get; set; } = ToolRunStatu.Not_Run;
/// <summary>
/// 运行过程信息
/// </summary>
public string runMessage { get; set; }
/// <summary>
/// 工具运行时间
/// </summary>
public string runTime { get; set; } = string.Empty;
public HObject inputImage { get; set; } = null;
@@ -110,8 +120,14 @@ namespace HalconTool
public void Run(SoftwareRunState softwareState)
{
Stopwatch sw = new Stopwatch();
sw.Restart();
softwareRunState = softwareState;
DispImage();
SetToolStatusDisp();
sw.Stop();
runTime = $"工具运行时间:{sw.ElapsedMilliseconds.ToString()} ms";
}
public void DispImage()
@@ -119,7 +135,7 @@ namespace HalconTool
HObject image = new HObject();
try
{
if(outputImageFilePath != null)
if(outputImageFilePath != null && outputImageFilePath != "")
{
HOperatorSet.ReadImage(out image, outputImageFilePath);
if (RGBToGray)
@@ -131,12 +147,19 @@ namespace HalconTool
}
outputImage = image;
}
else
{
runMessage = $"图像文件路径为空!";
toolRunStatu = ToolRunStatu.File_Error_Or_Path_Invalid;
return;
}
}
catch
catch(Exception ex)
{
if(softwareRunState == SoftwareRunState.Debug)
{
FormHalconTool.Instance.txbLog.Text = "图像文件异常或路径不合法";
runMessage = $"图像文件异常或路径不合法{ex}";
toolRunStatu = ToolRunStatu.File_Error_Or_Path_Invalid;
}
return;
}
@@ -144,10 +167,31 @@ namespace HalconTool
{
if (softwareRunState == SoftwareRunState.Debug)
{
FormHalconTool.Instance.myHwindow.HobjectToHimage(outputImage);
FormHalconTool.Instance.myHwindow.DispImage(outputImage);
}
}
else
{
runMessage = $"图像为空!";
toolRunStatu = ToolRunStatu.Lack_Of_Input_Image;
return;
}
toolRunStatu = ToolRunStatu.Succeed;
}
public void SetToolStatusDisp()
{
FormHalconTool.Instance.lb_RunStatus.Text = toolRunStatu == ToolRunStatu.Succeed ? "工具运行成功!" : $"工具运行异常, 异常原因:{runMessage}";
FormHalconTool.Instance.lb_RunTime.Text = runTime;
if (toolRunStatu == ToolRunStatu.Succeed)
{
FormHalconTool.Instance.statusStrip.BackColor = System.Drawing.Color.LimeGreen;
}
else
{
FormHalconTool.Instance.statusStrip.BackColor = System.Drawing.Color.Red;
}
}
}
}

View File

@@ -54,6 +54,7 @@
<DependentUpon>FormHalconTool.cs</DependentUpon>
</Compile>
<Compile Include="HalconTool.cs" />
<Compile Include="HalconToolRun.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
@@ -66,14 +67,26 @@
<Project>{1C8D0DDC-2086-48A9-9586-F2B643E2FC54}</Project>
<Name>CommonHelper</Name>
</ProjectReference>
<ProjectReference Include="..\HalconWindowTest\HalconWindow.csproj">
<Project>{4ADC75AE-59C7-4D36-B675-A6CE51B6F5BA}</Project>
<Name>HalconWindow</Name>
<ProjectReference Include="..\FormLib\FormLib.csproj">
<Project>{8c6fc8c6-8874-494b-8260-071f291aa33d}</Project>
<Name>FormLib</Name>
</ProjectReference>
<ProjectReference Include="..\ImageWindow\HWindow_Tool.csproj">
<Project>{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}</Project>
<Name>HWindow_Tool</Name>
</ProjectReference>
<ProjectReference Include="..\ToolBase\ToolBase.csproj">
<Project>{7CD50B44-BF56-4E8E-8FA1-05F6968C1835}</Project>
<Name>ToolBase</Name>
</ProjectReference>
<ProjectReference Include="..\ToolLib.Log\Logger\Logger.csproj">
<Project>{D4E052B9-E541-4B67-A1F9-273073EF1D4B}</Project>
<Name>Logger</Name>
</ProjectReference>
<ProjectReference Include="..\ToolLib.VisionJob\ToolLib.VisionJob.csproj">
<Project>{16E8FF17-98A8-4452-AB9E-C433DC9C21F7}</Project>
<Name>ToolLib.VisionJob</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@@ -0,0 +1,47 @@
/*
* ==============================================================================
*
* Filename: HalconToolRun
* Description:
*
* Version: 1.0
* Created: 2021/2/25 16:03:59
*
* Author: liu.wenjie
*
* ==============================================================================
*/
using CommonMethods.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CommonMethods;
using System.Windows.Forms;
using System.Drawing;
using FormLib;
using ToolLib.VisionJob;
namespace HalconTool
{
public class HalconToolRun : IToolRun
{
public void ToolRun(string jobName, int toolIndex, int inputItemNum, TreeNode selectNode, List<IToolInfo> L_toolList)
{
Type a = this.GetType();
HalconTool myHalconTool = (HalconTool)L_toolList[toolIndex].tool;
VisionJob myJob = VisionJobParams.pVisionProject.Project[jobName];
myHalconTool.Run(SoftwareRunState.Release);
if (myHalconTool.toolRunStatu != ToolRunStatu.Succeed)
{
myJob.FormLogDisp($"{L_toolList[toolIndex].toolName} 运行失败,失败原因:{myHalconTool.runMessage}", Color.Red, selectNode, Logger.MsgLevel.Exception);
}
else
{
myJob.FormLogDisp($"{L_toolList[toolIndex].toolName} 运行成功,{myHalconTool.runTime}", Color.Green, selectNode);
FormImageWindow.Instance.myHWindow.HobjectToHimage(myHalconTool.outputImage);
}
}
}
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -1,34 +1,34 @@
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\HalconTool.dll
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\HalconTool.pdb
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\CommonMethods.dll
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\DevComponents.DotNetBar2.dll
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\halcondotnet.dll
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\HalconWindow.exe
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\ToolBase.dll
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\CommonMethods.pdb
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\HalconWindow.pdb
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\ToolBase.pdb
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\DevComponents.DotNetBar2.xml
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\halcondotnet.xml
F:\VSCode\VisionEditTest\HalconTool\obj\Debug\HalconTool.csprojResolveAssemblyReference.cache
F:\VSCode\VisionEditTest\HalconTool\obj\Debug\HalconTool.FormHalconTool.resources
F:\VSCode\VisionEditTest\HalconTool\obj\Debug\HalconTool.csproj.GenerateResource.Cache
F:\VSCode\VisionEditTest\HalconTool\obj\Debug\HalconTool.dll
F:\VSCode\VisionEditTest\HalconTool\obj\Debug\HalconTool.pdb
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\HalconTool.dll
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\HalconTool.pdb
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\CommonMethods.dll
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\DevComponents.DotNetBar2.dll
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\halcondotnet.dll
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\HalconWindow.exe
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\ToolBase.dll
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\CommonMethods.pdb
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\HalconWindow.pdb
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\ToolBase.pdb
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\DevComponents.DotNetBar2.xml
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\halcondotnet.xml
G:\VisionEdit\VisionEdit\HalconTool\obj\Debug\HalconTool.csprojResolveAssemblyReference.cache
G:\VisionEdit\VisionEdit\HalconTool\obj\Debug\HalconTool.FormHalconTool.resources
G:\VisionEdit\VisionEdit\HalconTool\obj\Debug\HalconTool.csproj.GenerateResource.Cache
G:\VisionEdit\VisionEdit\HalconTool\obj\Debug\HalconTool.dll
G:\VisionEdit\VisionEdit\HalconTool\obj\Debug\HalconTool.pdb
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\HalconTool.dll
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\HalconTool.pdb
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\CommonMethods.dll
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\DevComponents.DotNetBar2.dll
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\halcondotnet.dll
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\HalconWindow.exe
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\ToolBase.dll
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\CommonMethods.pdb
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\HalconWindow.pdb
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\ToolBase.pdb
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\DevComponents.DotNetBar2.xml
F:\VSCode\VisionEditTest\HalconTool\bin\Debug\halcondotnet.xml
F:\VSCode\VisionEditTest\HalconTool\obj\Debug\HalconTool.csprojResolveAssemblyReference.cache
F:\VSCode\VisionEditTest\HalconTool\obj\Debug\HalconTool.FormHalconTool.resources
F:\VSCode\VisionEditTest\HalconTool\obj\Debug\HalconTool.csproj.GenerateResource.Cache
F:\VSCode\VisionEditTest\HalconTool\obj\Debug\HalconTool.dll
F:\VSCode\VisionEditTest\HalconTool\obj\Debug\HalconTool.pdb
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\HalconTool.dll
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\HalconTool.pdb
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\CommonMethods.dll
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\DevComponents.DotNetBar2.dll
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\halcondotnet.dll
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\HalconWindow.exe
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\ToolBase.dll
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\CommonMethods.pdb
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\HalconWindow.pdb
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\ToolBase.pdb
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\DevComponents.DotNetBar2.xml
G:\VisionEdit\VisionEdit\HalconTool\bin\Debug\halcondotnet.xml
G:\VisionEdit\VisionEdit\HalconTool\obj\Debug\HalconTool.csprojResolveAssemblyReference.cache
G:\VisionEdit\VisionEdit\HalconTool\obj\Debug\HalconTool.FormHalconTool.resources
G:\VisionEdit\VisionEdit\HalconTool\obj\Debug\HalconTool.csproj.GenerateResource.Cache
G:\VisionEdit\VisionEdit\HalconTool\obj\Debug\HalconTool.dll
G:\VisionEdit\VisionEdit\HalconTool\obj\Debug\HalconTool.pdb

Binary file not shown.

Binary file not shown.