mirror of
https://github.com/eggplantlwj/VisionEdit.git
synced 2026-03-23 16:26:35 +08:00
1、更改所有位置显示窗体为自定义窗体,添加坐标及灰度显示
2、添加工具移除功能 3、PMA工具添加修改模板和定义搜索区域
This commit is contained in:
Binary file not shown.
@@ -4,7 +4,7 @@ using HalconDotNet;
|
||||
using ToolBase;
|
||||
using static DataStruct.DataStruct;
|
||||
using ChoiceTech.Halcon.Control;
|
||||
|
||||
using ViewROI;
|
||||
|
||||
namespace CaliperTool
|
||||
{
|
||||
@@ -114,7 +114,7 @@ namespace CaliperTool
|
||||
{
|
||||
if (inputImage != null)
|
||||
{
|
||||
FormCaliper.Instance.myHwindow.HalconWindow.DispObj(inputImage);
|
||||
FormCaliper.Instance.myHwindow.DispHWindow.DispObj(inputImage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace CaliperTool
|
||||
|
||||
public void UpdateImage()
|
||||
{
|
||||
FormCaliper.Instance.myHwindow.HalconWindow.ClearWindow();
|
||||
FormCaliper.Instance.myHwindow.DispHWindow.ClearWindow();
|
||||
DispImage();
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ namespace CaliperTool
|
||||
HOperatorSet.GenCrossContourXld(out crossDisp, ResulttRow, ResultCol, new HTuple(80), new HTuple(0));
|
||||
if(softwareRunState == SoftwareRunState.Debug)
|
||||
{
|
||||
DispMainWindow(FormCaliper.Instance.myHwindow.HalconWindow);
|
||||
DispMainWindow(FormCaliper.Instance.myHwindow);
|
||||
FormCaliper.Instance.tbx_resultStartRow.Text = ResulttRow.ToString();
|
||||
FormCaliper.Instance.tbx_resultStartCol.Text = ResultCol.ToString();
|
||||
FormCaliper.Instance.SetToolStatus("运行成功", ToolRunStatu.Succeed);
|
||||
@@ -250,19 +250,19 @@ namespace CaliperTool
|
||||
|
||||
}
|
||||
|
||||
public override void DispMainWindow(HWindow window)
|
||||
public override void DispMainWindow(HWindowTool_Smart window)
|
||||
{
|
||||
// 显示矩形
|
||||
if (dispRec && contoursDisp != null)
|
||||
{
|
||||
window.SetColor("blue");
|
||||
window.DispObj(contoursDisp);
|
||||
window.DispHWindow.SetColor("blue");
|
||||
window.DispHWindow.DispObj(contoursDisp);
|
||||
}
|
||||
// 显示交点
|
||||
if (dispCross && crossDisp != null)
|
||||
{
|
||||
window.SetColor("green");
|
||||
window.DispObj(crossDisp);
|
||||
window.DispHWindow.SetColor("green");
|
||||
window.DispHWindow.DispObj(crossDisp);
|
||||
}
|
||||
//显示找到的线
|
||||
// window.DispObj(LineDisp, "green");
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace CaliperTool
|
||||
myCaliper.Run(SoftwareRunState.Release);
|
||||
if (myCaliper.toolRunStatu == ToolRunStatu.Succeed)
|
||||
{
|
||||
myCaliper.DispMainWindow(FormImageWindow.Instance.myHWindow.DispHWindow);
|
||||
myCaliper.DispMainWindow(FormImageWindow.Instance.myHWindow);
|
||||
myJob.FormLogDisp(L_toolList[toolIndex].toolName + " 运行成功", Color.Green, selectNode);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Windows.Forms;
|
||||
using CommonMethods;
|
||||
using ChoiceTech.Halcon.Control;
|
||||
using HalconDotNet;
|
||||
using ViewROI;
|
||||
|
||||
namespace CaliperTool
|
||||
{
|
||||
@@ -18,7 +19,7 @@ namespace CaliperTool
|
||||
|
||||
public Caliper myCaliper = null;
|
||||
public IToolInfo myToolInfo = null;
|
||||
public HSmartWindowControl myHwindow = new HSmartWindowControl();
|
||||
public HWindowTool_Smart myHwindow = new HWindowTool_Smart();
|
||||
|
||||
private static FormCaliper _instance;
|
||||
public FormCaliper(ref object caliper)
|
||||
@@ -90,7 +91,7 @@ namespace CaliperTool
|
||||
private void btn_moveCliperRegion_Click(object sender, EventArgs e)
|
||||
{
|
||||
myCaliper.UpdateImage();
|
||||
myCaliper.DrawExpectLine(myHwindow.HalconWindow);
|
||||
myCaliper.DrawExpectLine(myHwindow.DispHWindow);
|
||||
}
|
||||
|
||||
private void btn_runCaliperool_Click(object sender, EventArgs e)
|
||||
|
||||
@@ -3,6 +3,7 @@ using HalconDotNet;
|
||||
using static DataStruct.DataStruct;
|
||||
using ToolBase;
|
||||
using CommonMethods;
|
||||
using ViewROI;
|
||||
|
||||
namespace FindCircle
|
||||
{
|
||||
@@ -112,7 +113,7 @@ namespace FindCircle
|
||||
|
||||
}
|
||||
|
||||
public override void DispMainWindow(HWindow window)
|
||||
public override void DispMainWindow(HWindowTool_Smart window)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using static DataStruct.DataStruct;
|
||||
using ToolBase;
|
||||
using CommonMethods;
|
||||
using System.Diagnostics;
|
||||
using ViewROI;
|
||||
|
||||
namespace FindLineTool
|
||||
{
|
||||
@@ -334,22 +335,30 @@ namespace FindLineTool
|
||||
Point start = new Point() { Row = ResultLineStartRow, Col = ResultLineStartCol };
|
||||
Point end = new Point() { Row = ResultLineEndRow, Col = ResultLineEndCol };
|
||||
resultLine = new Line() { StartPoint = start, EndPoint = end };
|
||||
HOperatorSet.AngleLx(ResultLineStartRow, ResultLineStartCol, ResultLineEndRow, ResultLineEndCol, out _angle);
|
||||
if (softwareRunState == SoftwareRunState.Debug)
|
||||
{
|
||||
DispMainWindow(FormFindLine.Instance.myHwindow);
|
||||
FormFindLine.Instance.tbx_resultStartRow.Text = ResultLineStartRow.ToString();
|
||||
FormFindLine.Instance.tbx_resultStartCol.Text = ResultLineEndCol.ToString();
|
||||
FormFindLine.Instance.tbx_resultEndRow.Text = ResultLineEndRow.ToString();
|
||||
FormFindLine.Instance.tbx_resultEndCol.Text = ResultLineEndCol.ToString();
|
||||
}
|
||||
runMessage = "工具运行成功,已找到线!";
|
||||
toolRunStatu = ToolRunStatu.Succeed;
|
||||
}
|
||||
HOperatorSet.AngleLx(ResultLineStartRow, ResultLineStartCol, ResultLineEndRow, ResultLineEndCol, out _angle);
|
||||
if (softwareRunState == SoftwareRunState.Debug)
|
||||
else
|
||||
{
|
||||
DispMainWindow(FormFindLine.Instance.myHwindow.DispHWindow);
|
||||
FormFindLine.Instance.tbx_resultStartRow.Text = ResultLineStartRow.ToString();
|
||||
FormFindLine.Instance.tbx_resultStartCol.Text = ResultLineEndCol.ToString();
|
||||
FormFindLine.Instance.tbx_resultEndRow.Text = ResultLineEndRow.ToString();
|
||||
FormFindLine.Instance.tbx_resultEndCol.Text = ResultLineEndCol.ToString();
|
||||
runMessage = "工具运行失败,未找到线";
|
||||
toolRunStatu = ToolRunStatu.Tool_Run_Error;
|
||||
}
|
||||
HOperatorSet.ClearMetrologyModel(handleID);
|
||||
|
||||
// 参数传递
|
||||
ParamsTrans();
|
||||
sw.Stop();
|
||||
runTime = $"运行时间: {sw.ElapsedMilliseconds} ms";
|
||||
FormFindLine.Instance.SetToolStatus("工具运行成功!", ToolRunStatu.Succeed);
|
||||
FormFindLine.Instance.SetToolStatus(runMessage, toolRunStatu);
|
||||
HOperatorSet.ClearMetrologyModel(handleID);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -357,6 +366,7 @@ namespace FindLineTool
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
//homMat2DArrow.Dispose();
|
||||
//arrow.Dispose();
|
||||
//arrowTrans.Dispose();
|
||||
@@ -375,23 +385,23 @@ namespace FindLineTool
|
||||
FormFindLine.Instance.myToolInfo.toolOutput.Add(new ToolIO("EndPoint.Column", ResultLineEndCol, DataType.IntValue));
|
||||
}
|
||||
|
||||
public override void DispMainWindow(HWindow window)
|
||||
public override void DispMainWindow(HWindowTool_Smart window)
|
||||
{
|
||||
// 显示矩形
|
||||
if (dispRec)
|
||||
{
|
||||
window.SetColor("blue");
|
||||
window.DispObj(contoursDisp);
|
||||
window.DispHWindow.SetColor("blue");
|
||||
window.DispHWindow.DispObj(contoursDisp);
|
||||
}
|
||||
// 显示交点
|
||||
if (dispCross)
|
||||
{
|
||||
window.SetColor("orange");
|
||||
window.DispObj(crossDisp);
|
||||
window.DispHWindow.SetColor("orange");
|
||||
window.DispHWindow.DispObj(crossDisp);
|
||||
}
|
||||
//显示找到的线
|
||||
window.SetColor("green");
|
||||
window.DispObj(LineDisp);
|
||||
window.DispHWindow.SetColor("green");
|
||||
window.DispHWindow.DispObj(LineDisp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace FindLineTool
|
||||
else
|
||||
{
|
||||
myJob.FormLogDisp($"{L_toolList[toolIndex].toolName} 运行成功,{myFindLine.runTime}", Color.Green, selectNode);
|
||||
myFindLine.DispMainWindow(FormImageWindow.Instance.myHWindow.DispHWindow);
|
||||
myFindLine.DispMainWindow(FormImageWindow.Instance.myHWindow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,6 +95,8 @@ namespace FindLineTool
|
||||
selected_drawing_object.OnResize(OnSelectDrawingObject);
|
||||
selected_drawing_object.OnDrag(OnSelectDrawingObject);
|
||||
myHwindow.DispHWindow.AttachDrawingObjectToWindow(selected_drawing_object);
|
||||
|
||||
tsbtRunTool_Click(null, null);
|
||||
isInit = false;
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
@@ -9,6 +9,7 @@ using CommonMethods;
|
||||
using HalconDotNet;
|
||||
using ToolBase;
|
||||
using System.Diagnostics;
|
||||
using ViewROI;
|
||||
|
||||
namespace HalconTool
|
||||
{
|
||||
@@ -159,7 +160,7 @@ namespace HalconTool
|
||||
}
|
||||
}
|
||||
|
||||
public override void DispMainWindow(HWindow window)
|
||||
public override void DispMainWindow(HWindowTool_Smart window)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace HalconTool
|
||||
else
|
||||
{
|
||||
myJob.FormLogDisp($"{L_toolList[toolIndex].toolName} 运行成功,{myHalconTool.runTime}", Color.Green, selectNode);
|
||||
FormImageWindow.Instance.myHWindow.DispHWindow.DispObj(myHalconTool.outputImage);
|
||||
FormImageWindow.Instance.myHWindow.DispImage(myHalconTool.outputImage);
|
||||
L_toolList[toolIndex].toolOutput[0] = new ToolIO("OutputImage", myHalconTool.outputImage, DataType.Image);
|
||||
}
|
||||
}
|
||||
|
||||
62
ImageWindow/HWindowTool_Smart.Designer.cs
generated
62
ImageWindow/HWindowTool_Smart.Designer.cs
generated
@@ -29,15 +29,17 @@ namespace ViewROI
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SmartWindow = new HalconDotNet.HSmartWindowControl();
|
||||
this.statusStrip = new System.Windows.Forms.StatusStrip();
|
||||
this.lb_Status = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.statusStrip.SuspendLayout();
|
||||
this.uiContextMenuStrip1 = new Sunny.UI.UIContextMenuStrip();
|
||||
this.tsmiDispCorr = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.grayValueLable = new Sunny.UI.UISymbolLabel();
|
||||
this.uiContextMenuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// SmartWindow
|
||||
//
|
||||
this.SmartWindow.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.SmartWindow.AutoValidate = System.Windows.Forms.AutoValidate.EnableAllowFocusChange;
|
||||
this.SmartWindow.ContextMenuStrip = this.uiContextMenuStrip1;
|
||||
this.SmartWindow.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.SmartWindow.HDoubleClickToFitContent = true;
|
||||
this.SmartWindow.HDrawingObjectsModifier = HalconDotNet.HSmartWindowControl.DrawingObjectsModifier.None;
|
||||
@@ -53,45 +55,57 @@ namespace ViewROI
|
||||
this.SmartWindow.WindowSize = new System.Drawing.Size(576, 457);
|
||||
this.SmartWindow.HMouseMove += new HalconDotNet.HMouseEventHandler(this.SmartWindow_HMouseMove);
|
||||
//
|
||||
// statusStrip
|
||||
// uiContextMenuStrip1
|
||||
//
|
||||
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_Status});
|
||||
this.statusStrip.Location = new System.Drawing.Point(0, 435);
|
||||
this.statusStrip.Name = "statusStrip";
|
||||
this.statusStrip.Size = new System.Drawing.Size(576, 22);
|
||||
this.statusStrip.TabIndex = 1;
|
||||
this.statusStrip.Text = "statusStrip1";
|
||||
this.statusStrip.Visible = false;
|
||||
this.uiContextMenuStrip1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.uiContextMenuStrip1.IsScaled = false;
|
||||
this.uiContextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.tsmiDispCorr});
|
||||
this.uiContextMenuStrip1.Name = "uiContextMenuStrip1";
|
||||
this.uiContextMenuStrip1.Size = new System.Drawing.Size(145, 30);
|
||||
//
|
||||
// lb_Status
|
||||
// tsmiDispCorr
|
||||
//
|
||||
this.lb_Status.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.lb_Status.Name = "lb_Status";
|
||||
this.lb_Status.Size = new System.Drawing.Size(0, 17);
|
||||
this.tsmiDispCorr.Name = "tsmiDispCorr";
|
||||
this.tsmiDispCorr.Size = new System.Drawing.Size(144, 26);
|
||||
this.tsmiDispCorr.Text = "显示坐标";
|
||||
this.tsmiDispCorr.Click += new System.EventHandler(this.tsmiDispCorr_Click);
|
||||
//
|
||||
// grayValueLable
|
||||
//
|
||||
this.grayValueLable.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.grayValueLable.BackColor = System.Drawing.Color.Transparent;
|
||||
this.grayValueLable.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.grayValueLable.IsScaled = false;
|
||||
this.grayValueLable.Location = new System.Drawing.Point(3, 430);
|
||||
this.grayValueLable.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.grayValueLable.Name = "grayValueLable";
|
||||
this.grayValueLable.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||
this.grayValueLable.Size = new System.Drawing.Size(260, 26);
|
||||
this.grayValueLable.Symbol = 61483;
|
||||
this.grayValueLable.TabIndex = 4;
|
||||
this.grayValueLable.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.grayValueLable.Visible = false;
|
||||
//
|
||||
// HWindowTool_Smart
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.statusStrip);
|
||||
this.Controls.Add(this.grayValueLable);
|
||||
this.Controls.Add(this.SmartWindow);
|
||||
this.Name = "HWindowTool_Smart";
|
||||
this.Size = new System.Drawing.Size(576, 457);
|
||||
this.Load += new System.EventHandler(this.HWindowTool_Smart_Load);
|
||||
this.SizeChanged += new System.EventHandler(this.HWindowTool_Smart_SizeChanged);
|
||||
this.statusStrip.ResumeLayout(false);
|
||||
this.statusStrip.PerformLayout();
|
||||
this.uiContextMenuStrip1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.StatusStrip statusStrip;
|
||||
private System.Windows.Forms.ToolStripStatusLabel lb_Status;
|
||||
public HalconDotNet.HSmartWindowControl SmartWindow;
|
||||
private Sunny.UI.UIContextMenuStrip uiContextMenuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiDispCorr;
|
||||
private Sunny.UI.UISymbolLabel grayValueLable;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ namespace ViewROI
|
||||
{
|
||||
public bool DispStatus { get; set; }
|
||||
public HImage hv_Image { get; set; }
|
||||
HTuple hv_Width = new HTuple();
|
||||
HTuple hv_Height = new HTuple();
|
||||
public HWindow DispHWindow
|
||||
{
|
||||
get
|
||||
@@ -27,22 +29,112 @@ namespace ViewROI
|
||||
}
|
||||
public void DispImage(HObject inputImage)
|
||||
{
|
||||
statusStrip.BackColor = Color.White;
|
||||
if (inputImage == null || !inputImage.IsInitialized())
|
||||
{
|
||||
this.lb_Status.Text = "输入图像为空,请检查!";
|
||||
statusStrip.BackColor = Color.Red;
|
||||
return;
|
||||
}
|
||||
this.SmartWindow.HalconWindow.DispImage(new HImage(inputImage));
|
||||
|
||||
|
||||
#region 缩放图像,适应窗口
|
||||
//获取图像大小及纵横比
|
||||
HOperatorSet.GetImageSize(inputImage, out hv_Width, out hv_Height);
|
||||
int im_width = int.Parse(hv_Width.ToString());
|
||||
int im_height = int.Parse(hv_Height.ToString());
|
||||
double im_AspectRatio = (double)(im_width) / (double)(im_height);
|
||||
//获取窗口大小及纵横比
|
||||
int w_width = SmartWindow.Size.Width;
|
||||
int w_height = SmartWindow.Size.Height;
|
||||
double w_AspectRatio = (double)(w_width) / (double)(w_height);
|
||||
|
||||
HOperatorSet.SetSystem("int_zooming", "false");//图像缩放之前最好将此参数设置为false.
|
||||
HTuple para = new HTuple("constant");
|
||||
HObject ho_zoomImage;
|
||||
HOperatorSet.GenEmptyObj(out ho_zoomImage);
|
||||
|
||||
ho_zoomImage.Dispose();
|
||||
if (w_width < im_width && im_AspectRatio > w_AspectRatio)
|
||||
{
|
||||
//超宽图像
|
||||
HOperatorSet.ZoomImageSize(inputImage, out ho_zoomImage, w_width, w_width / im_AspectRatio, para);
|
||||
}
|
||||
else if (w_height < im_height && im_AspectRatio < w_AspectRatio)
|
||||
{
|
||||
//超高图像
|
||||
HOperatorSet.ZoomImageSize(inputImage, out ho_zoomImage, w_height * im_AspectRatio, w_height, para);
|
||||
}
|
||||
#endregion
|
||||
SmartWindow.HalconWindow.SetPart(0, 0,-2, -2);
|
||||
hv_Image = new HImage(inputImage);
|
||||
SmartWindow.HalconWindow.DispImage(hv_Image);
|
||||
ho_zoomImage.Dispose();
|
||||
hv_Width.Dispose();
|
||||
hv_Height.Dispose();
|
||||
}
|
||||
|
||||
private void SmartWindow_HMouseMove(object sender, HalconDotNet.HMouseEventArgs e)
|
||||
{
|
||||
this.Cursor = e.Button == MouseButtons.Left ? Cursors.Hand : Cursors.Default;
|
||||
// this.Cursor = e.Button == MouseButtons.Left ? Cursors.Hand : Cursors.Default;
|
||||
if(DispStatus)
|
||||
{
|
||||
if (hv_Image != null && hv_Image.IsInitialized())
|
||||
{
|
||||
try
|
||||
{
|
||||
int button_state;
|
||||
double positionX, positionY;
|
||||
string str_value;
|
||||
string str_position;
|
||||
bool _isXOut = true, _isYOut = true;
|
||||
HTuple channel_count;
|
||||
|
||||
HOperatorSet.CountChannels(hv_Image, out channel_count);
|
||||
|
||||
SmartWindow.HalconWindow.GetMpositionSubPix(out positionY, out positionX, out button_state);
|
||||
str_position = String.Format("RC: {0:0},{1:0}", positionY, positionX);
|
||||
|
||||
_isXOut = (positionX < 0 || positionX >= hv_Width);
|
||||
_isYOut = (positionY < 0 || positionY >= hv_Height);
|
||||
|
||||
if (!_isXOut && !_isYOut)
|
||||
{
|
||||
if ((int)channel_count == 1)
|
||||
{
|
||||
double grayVal;
|
||||
grayVal = hv_Image.GetGrayval((int)positionY, (int)positionX);
|
||||
str_value = String.Format("Val: {0:000}", grayVal);
|
||||
}
|
||||
else if ((int)channel_count == 3)
|
||||
{
|
||||
double grayValRed, grayValGreen, grayValBlue;
|
||||
|
||||
HImage _RedChannel, _GreenChannel, _BlueChannel;
|
||||
|
||||
_RedChannel = hv_Image.AccessChannel(1);
|
||||
_GreenChannel = hv_Image.AccessChannel(2);
|
||||
_BlueChannel = hv_Image.AccessChannel(3);
|
||||
|
||||
grayValRed = _RedChannel.GetGrayval((int)positionY, (int)positionX);
|
||||
grayValGreen = _GreenChannel.GetGrayval((int)positionY, (int)positionX);
|
||||
grayValBlue = _BlueChannel.GetGrayval((int)positionY, (int)positionX);
|
||||
|
||||
_RedChannel.Dispose();
|
||||
_GreenChannel.Dispose();
|
||||
_BlueChannel.Dispose();
|
||||
|
||||
str_value = String.Format("Gray: ({0:000}, {1:000}, {2:000})", grayValRed, grayValGreen, grayValBlue);
|
||||
}
|
||||
else
|
||||
{
|
||||
str_value = "";
|
||||
}
|
||||
grayValueLable.Text = $"Ch{channel_count.D }, {str_position}: {str_value}";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//不处理
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,5 +156,21 @@ namespace ViewROI
|
||||
//Point pt2 = SmartWindow.PointToScreen(pt);
|
||||
//this.SmartWindow.HalconWindow.SendMouseDoubleClickEvent(pt2.X+20, pt2.Y+30,(int)MouseButtons.Left);
|
||||
}
|
||||
|
||||
private void tsmiDispCorr_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(tsmiDispCorr.Checked)
|
||||
{
|
||||
tsmiDispCorr.Checked = false;
|
||||
DispStatus = false;
|
||||
grayValueLable.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
tsmiDispCorr.Checked = true;
|
||||
DispStatus = true;
|
||||
grayValueLable.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,12 +112,12 @@
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<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=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
<metadata name="uiContextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>16, 14</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -112,20 +112,20 @@
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="m_CtrlImageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<metadata name="m_CtrlImageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<data name="m_CtrlImageList.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADk
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAARABAQEQAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAASABAQEgAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||
@@ -166,7 +166,7 @@
|
||||
Cw==
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="mCtrl_HWindow.LayoutBitmap" type="System.Resources.ResXNullRef, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="mCtrl_HWindow.LayoutBitmap" type="System.Resources.ResXNullRef, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value />
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -84,6 +84,9 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>C:\Program Files\MVTec\HALCON-19.05-Progress\bin\dotnet20\halcondotnet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SunnyUI">
|
||||
<HintPath>..\VisionEdit\bin\Debug\ThirdLib\SunnyUI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Runtime.Serialization.Formatters.Soap" />
|
||||
|
||||
272
PMAlignTool/FormPMAlignTool.Designer.cs
generated
272
PMAlignTool/FormPMAlignTool.Designer.cs
generated
@@ -29,6 +29,10 @@ namespace PMAlignTool
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormPMAlignTool));
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.statusStrip = new System.Windows.Forms.StatusStrip();
|
||||
this.lb_RunStatus = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
@@ -77,7 +81,7 @@ namespace PMAlignTool
|
||||
this.cbCErosion1 = new System.Windows.Forms.CheckBox();
|
||||
this.cbCErosion2 = new System.Windows.Forms.CheckBox();
|
||||
this.btnCreateModel = new System.Windows.Forms.Button();
|
||||
this.btnAcqNewModelImage = new System.Windows.Forms.Button();
|
||||
this.btnChangeModel = new System.Windows.Forms.Button();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.panel4 = new System.Windows.Forms.Panel();
|
||||
@@ -118,14 +122,13 @@ namespace PMAlignTool
|
||||
this.cbx_showTemplate = new System.Windows.Forms.CheckBox();
|
||||
this.ckb_showFeature = new System.Windows.Forms.CheckBox();
|
||||
this.ckb_showCross = new System.Windows.Forms.CheckBox();
|
||||
this.tabPage5 = new System.Windows.Forms.TabPage();
|
||||
this.panel7 = new System.Windows.Forms.Panel();
|
||||
this.dgv_matchResult = new System.Windows.Forms.DataGridView();
|
||||
this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column12 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||
this.dgv_matchResult = new Sunny.UI.UIDataGridView();
|
||||
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.statusStrip.SuspendLayout();
|
||||
this.toolStrip1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
@@ -152,8 +155,7 @@ namespace PMAlignTool
|
||||
this.panel5.SuspendLayout();
|
||||
this.tabPage4.SuspendLayout();
|
||||
this.panel6.SuspendLayout();
|
||||
this.tabPage5.SuspendLayout();
|
||||
this.panel7.SuspendLayout();
|
||||
this.tabPage3.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgv_matchResult)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -166,7 +168,7 @@ namespace PMAlignTool
|
||||
this.lb_RunTime});
|
||||
this.statusStrip.Location = new System.Drawing.Point(0, 633);
|
||||
this.statusStrip.Name = "statusStrip";
|
||||
this.statusStrip.Size = new System.Drawing.Size(999, 22);
|
||||
this.statusStrip.Size = new System.Drawing.Size(1007, 22);
|
||||
this.statusStrip.TabIndex = 0;
|
||||
//
|
||||
// lb_RunStatus
|
||||
@@ -192,7 +194,7 @@ namespace PMAlignTool
|
||||
this.tsbtRunTool});
|
||||
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStrip1.Name = "toolStrip1";
|
||||
this.toolStrip1.Size = new System.Drawing.Size(999, 32);
|
||||
this.toolStrip1.Size = new System.Drawing.Size(1007, 32);
|
||||
this.toolStrip1.TabIndex = 1;
|
||||
this.toolStrip1.Text = "toolStrip1";
|
||||
//
|
||||
@@ -218,8 +220,8 @@ namespace PMAlignTool
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.tabControl1);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(999, 601);
|
||||
this.splitContainer1.SplitterDistance = 599;
|
||||
this.splitContainer1.Size = new System.Drawing.Size(1007, 601);
|
||||
this.splitContainer1.SplitterDistance = 603;
|
||||
this.splitContainer1.TabIndex = 2;
|
||||
//
|
||||
// panel1
|
||||
@@ -228,7 +230,7 @@ namespace PMAlignTool
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(599, 601);
|
||||
this.panel1.Size = new System.Drawing.Size(603, 601);
|
||||
this.panel1.TabIndex = 0;
|
||||
//
|
||||
// tabControl1
|
||||
@@ -236,13 +238,13 @@ namespace PMAlignTool
|
||||
this.tabControl1.Controls.Add(this.tabPage1);
|
||||
this.tabControl1.Controls.Add(this.tabPage2);
|
||||
this.tabControl1.Controls.Add(this.tabPage4);
|
||||
this.tabControl1.Controls.Add(this.tabPage5);
|
||||
this.tabControl1.Controls.Add(this.tabPage3);
|
||||
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tabControl1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.tabControl1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tabControl1.Name = "tabControl1";
|
||||
this.tabControl1.SelectedIndex = 0;
|
||||
this.tabControl1.Size = new System.Drawing.Size(396, 601);
|
||||
this.tabControl1.Size = new System.Drawing.Size(400, 601);
|
||||
this.tabControl1.TabIndex = 0;
|
||||
//
|
||||
// tabPage1
|
||||
@@ -251,7 +253,7 @@ namespace PMAlignTool
|
||||
this.tabPage1.Location = new System.Drawing.Point(4, 29);
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage1.Size = new System.Drawing.Size(388, 568);
|
||||
this.tabPage1.Size = new System.Drawing.Size(392, 568);
|
||||
this.tabPage1.TabIndex = 0;
|
||||
this.tabPage1.Text = "模板";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
@@ -278,7 +280,7 @@ namespace PMAlignTool
|
||||
this.tableLayoutPanel1.Controls.Add(this.panel10, 0, 6);
|
||||
this.tableLayoutPanel1.Controls.Add(this.panel14, 0, 8);
|
||||
this.tableLayoutPanel1.Controls.Add(this.btnCreateModel, 1, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.btnAcqNewModelImage, 1, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.btnChangeModel, 1, 1);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
@@ -293,7 +295,7 @@ namespace PMAlignTool
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.405694F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.20996F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15.12456F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(382, 562);
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(386, 562);
|
||||
this.tableLayoutPanel1.TabIndex = 0;
|
||||
//
|
||||
// panel13
|
||||
@@ -304,7 +306,7 @@ namespace PMAlignTool
|
||||
this.panel13.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel13.Location = new System.Drawing.Point(3, 382);
|
||||
this.panel13.Name = "panel13";
|
||||
this.panel13.Size = new System.Drawing.Size(376, 29);
|
||||
this.panel13.Size = new System.Drawing.Size(380, 29);
|
||||
this.panel13.TabIndex = 126;
|
||||
//
|
||||
// label4
|
||||
@@ -326,7 +328,7 @@ namespace PMAlignTool
|
||||
this.panel9.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel9.Location = new System.Drawing.Point(3, 254);
|
||||
this.panel9.Name = "panel9";
|
||||
this.panel9.Size = new System.Drawing.Size(376, 23);
|
||||
this.panel9.Size = new System.Drawing.Size(380, 23);
|
||||
this.panel9.TabIndex = 124;
|
||||
//
|
||||
// label3
|
||||
@@ -349,7 +351,7 @@ namespace PMAlignTool
|
||||
this.hWindowTool_Smart1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.hWindowTool_Smart1.Name = "hWindowTool_Smart1";
|
||||
this.tableLayoutPanel1.SetRowSpan(this.hWindowTool_Smart1, 3);
|
||||
this.hWindowTool_Smart1.Size = new System.Drawing.Size(226, 169);
|
||||
this.hWindowTool_Smart1.Size = new System.Drawing.Size(228, 169);
|
||||
this.hWindowTool_Smart1.TabIndex = 0;
|
||||
//
|
||||
// panel3
|
||||
@@ -360,7 +362,7 @@ namespace PMAlignTool
|
||||
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel3.Location = new System.Drawing.Point(3, 182);
|
||||
this.panel3.Name = "panel3";
|
||||
this.panel3.Size = new System.Drawing.Size(376, 22);
|
||||
this.panel3.Size = new System.Drawing.Size(380, 22);
|
||||
this.panel3.TabIndex = 121;
|
||||
//
|
||||
// label1
|
||||
@@ -382,7 +384,7 @@ namespace PMAlignTool
|
||||
this.panel8.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel8.Location = new System.Drawing.Point(3, 210);
|
||||
this.panel8.Name = "panel8";
|
||||
this.panel8.Size = new System.Drawing.Size(376, 38);
|
||||
this.panel8.Size = new System.Drawing.Size(380, 38);
|
||||
this.panel8.TabIndex = 122;
|
||||
//
|
||||
// panel18
|
||||
@@ -392,7 +394,7 @@ namespace PMAlignTool
|
||||
this.panel18.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel18.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel18.Name = "panel18";
|
||||
this.panel18.Size = new System.Drawing.Size(376, 38);
|
||||
this.panel18.Size = new System.Drawing.Size(380, 38);
|
||||
this.panel18.TabIndex = 147;
|
||||
//
|
||||
// rabGray
|
||||
@@ -430,9 +432,9 @@ namespace PMAlignTool
|
||||
this.groupBox1.Controls.Add(this.rabFormLocal);
|
||||
this.groupBox1.Controls.Add(this.rabFormFlow);
|
||||
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.groupBox1.Location = new System.Drawing.Point(237, 3);
|
||||
this.groupBox1.Location = new System.Drawing.Point(239, 3);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(142, 79);
|
||||
this.groupBox1.Size = new System.Drawing.Size(144, 79);
|
||||
this.groupBox1.TabIndex = 123;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "模板图像来源";
|
||||
@@ -478,7 +480,7 @@ namespace PMAlignTool
|
||||
this.panel10.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel10.Location = new System.Drawing.Point(3, 283);
|
||||
this.panel10.Name = "panel10";
|
||||
this.panel10.Size = new System.Drawing.Size(376, 93);
|
||||
this.panel10.Size = new System.Drawing.Size(380, 93);
|
||||
this.panel10.TabIndex = 125;
|
||||
//
|
||||
// panel12
|
||||
@@ -633,7 +635,7 @@ namespace PMAlignTool
|
||||
this.panel14.Location = new System.Drawing.Point(3, 417);
|
||||
this.panel14.Name = "panel14";
|
||||
this.tableLayoutPanel1.SetRowSpan(this.panel14, 2);
|
||||
this.panel14.Size = new System.Drawing.Size(376, 142);
|
||||
this.panel14.Size = new System.Drawing.Size(380, 142);
|
||||
this.panel14.TabIndex = 127;
|
||||
//
|
||||
// label8
|
||||
@@ -854,34 +856,34 @@ namespace PMAlignTool
|
||||
this.btnCreateModel.FlatAppearance.MouseOverBackColor = System.Drawing.Color.LightGray;
|
||||
this.btnCreateModel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnCreateModel.ForeColor = System.Drawing.Color.White;
|
||||
this.btnCreateModel.Location = new System.Drawing.Point(237, 134);
|
||||
this.btnCreateModel.Location = new System.Drawing.Point(239, 134);
|
||||
this.btnCreateModel.Name = "btnCreateModel";
|
||||
this.btnCreateModel.Size = new System.Drawing.Size(142, 42);
|
||||
this.btnCreateModel.Size = new System.Drawing.Size(144, 42);
|
||||
this.btnCreateModel.TabIndex = 129;
|
||||
this.btnCreateModel.TabStop = false;
|
||||
this.btnCreateModel.Text = "创建模板";
|
||||
this.btnCreateModel.UseVisualStyleBackColor = false;
|
||||
this.btnCreateModel.Click += new System.EventHandler(this.btnCreateModel_Click);
|
||||
//
|
||||
// btnAcqNewModelImage
|
||||
// btnChangeModel
|
||||
//
|
||||
this.btnAcqNewModelImage.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(150)))), ((int)(((byte)(219)))));
|
||||
this.btnAcqNewModelImage.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.btnAcqNewModelImage.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnAcqNewModelImage.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.btnAcqNewModelImage.FlatAppearance.BorderSize = 0;
|
||||
this.btnAcqNewModelImage.FlatAppearance.MouseDownBackColor = System.Drawing.Color.DarkGray;
|
||||
this.btnAcqNewModelImage.FlatAppearance.MouseOverBackColor = System.Drawing.Color.LightGray;
|
||||
this.btnAcqNewModelImage.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnAcqNewModelImage.ForeColor = System.Drawing.Color.White;
|
||||
this.btnAcqNewModelImage.Location = new System.Drawing.Point(237, 88);
|
||||
this.btnAcqNewModelImage.Name = "btnAcqNewModelImage";
|
||||
this.btnAcqNewModelImage.Size = new System.Drawing.Size(142, 40);
|
||||
this.btnAcqNewModelImage.TabIndex = 129;
|
||||
this.btnAcqNewModelImage.TabStop = false;
|
||||
this.btnAcqNewModelImage.Text = "获取图像";
|
||||
this.btnAcqNewModelImage.UseVisualStyleBackColor = false;
|
||||
this.btnAcqNewModelImage.Click += new System.EventHandler(this.btnAcqNewModelImage_Click);
|
||||
this.btnChangeModel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(150)))), ((int)(((byte)(219)))));
|
||||
this.btnChangeModel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.btnChangeModel.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnChangeModel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.btnChangeModel.FlatAppearance.BorderSize = 0;
|
||||
this.btnChangeModel.FlatAppearance.MouseDownBackColor = System.Drawing.Color.DarkGray;
|
||||
this.btnChangeModel.FlatAppearance.MouseOverBackColor = System.Drawing.Color.LightGray;
|
||||
this.btnChangeModel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnChangeModel.ForeColor = System.Drawing.Color.White;
|
||||
this.btnChangeModel.Location = new System.Drawing.Point(239, 88);
|
||||
this.btnChangeModel.Name = "btnChangeModel";
|
||||
this.btnChangeModel.Size = new System.Drawing.Size(144, 40);
|
||||
this.btnChangeModel.TabIndex = 129;
|
||||
this.btnChangeModel.TabStop = false;
|
||||
this.btnChangeModel.Text = "修改模板";
|
||||
this.btnChangeModel.UseVisualStyleBackColor = false;
|
||||
this.btnChangeModel.Click += new System.EventHandler(this.btnChangeModel_Click);
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
@@ -889,7 +891,7 @@ namespace PMAlignTool
|
||||
this.tabPage2.Location = new System.Drawing.Point(4, 29);
|
||||
this.tabPage2.Name = "tabPage2";
|
||||
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage2.Size = new System.Drawing.Size(388, 568);
|
||||
this.tabPage2.Size = new System.Drawing.Size(392, 568);
|
||||
this.tabPage2.TabIndex = 1;
|
||||
this.tabPage2.Text = "参数";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
@@ -919,7 +921,7 @@ namespace PMAlignTool
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel2.Size = new System.Drawing.Size(382, 562);
|
||||
this.tableLayoutPanel2.Size = new System.Drawing.Size(386, 562);
|
||||
this.tableLayoutPanel2.TabIndex = 0;
|
||||
//
|
||||
// panel4
|
||||
@@ -929,7 +931,7 @@ namespace PMAlignTool
|
||||
this.panel4.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel4.Location = new System.Drawing.Point(3, 344);
|
||||
this.panel4.Name = "panel4";
|
||||
this.panel4.Size = new System.Drawing.Size(376, 28);
|
||||
this.panel4.Size = new System.Drawing.Size(380, 28);
|
||||
this.panel4.TabIndex = 150;
|
||||
//
|
||||
// label2
|
||||
@@ -953,7 +955,7 @@ namespace PMAlignTool
|
||||
this.panel11.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel11.Location = new System.Drawing.Point(3, 3);
|
||||
this.panel11.Name = "panel11";
|
||||
this.panel11.Size = new System.Drawing.Size(376, 28);
|
||||
this.panel11.Size = new System.Drawing.Size(380, 28);
|
||||
this.panel11.TabIndex = 148;
|
||||
//
|
||||
// label11
|
||||
@@ -999,7 +1001,7 @@ namespace PMAlignTool
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel2.Location = new System.Drawing.Point(3, 37);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(376, 301);
|
||||
this.panel2.Size = new System.Drawing.Size(380, 301);
|
||||
this.panel2.TabIndex = 149;
|
||||
//
|
||||
// nud_angleRange
|
||||
@@ -1419,7 +1421,7 @@ namespace PMAlignTool
|
||||
this.panel5.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel5.Location = new System.Drawing.Point(3, 378);
|
||||
this.panel5.Name = "panel5";
|
||||
this.panel5.Size = new System.Drawing.Size(376, 181);
|
||||
this.panel5.Size = new System.Drawing.Size(380, 181);
|
||||
this.panel5.TabIndex = 151;
|
||||
//
|
||||
// cbx_searchRegionType
|
||||
@@ -1440,6 +1442,7 @@ namespace PMAlignTool
|
||||
this.cbx_searchRegionType.Size = new System.Drawing.Size(172, 26);
|
||||
this.cbx_searchRegionType.TabIndex = 122;
|
||||
this.cbx_searchRegionType.TextStr = "整幅图像";
|
||||
this.cbx_searchRegionType.SelectedIndexChanged += new Controls.DSelectedIndexChanged(this.cbx_searchRegionType_SelectedIndexChanged);
|
||||
//
|
||||
// label5
|
||||
//
|
||||
@@ -1456,7 +1459,7 @@ namespace PMAlignTool
|
||||
this.tabPage4.Controls.Add(this.panel6);
|
||||
this.tabPage4.Location = new System.Drawing.Point(4, 29);
|
||||
this.tabPage4.Name = "tabPage4";
|
||||
this.tabPage4.Size = new System.Drawing.Size(388, 568);
|
||||
this.tabPage4.Size = new System.Drawing.Size(392, 568);
|
||||
this.tabPage4.TabIndex = 3;
|
||||
this.tabPage4.Text = "图形";
|
||||
this.tabPage4.UseVisualStyleBackColor = true;
|
||||
@@ -1471,7 +1474,7 @@ namespace PMAlignTool
|
||||
this.panel6.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel6.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel6.Name = "panel6";
|
||||
this.panel6.Size = new System.Drawing.Size(388, 568);
|
||||
this.panel6.Size = new System.Drawing.Size(392, 568);
|
||||
this.panel6.TabIndex = 0;
|
||||
//
|
||||
// checkBox2
|
||||
@@ -1535,89 +1538,102 @@ namespace PMAlignTool
|
||||
this.ckb_showCross.Text = "显示参考点";
|
||||
this.ckb_showCross.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// tabPage5
|
||||
// tabPage3
|
||||
//
|
||||
this.tabPage5.Controls.Add(this.panel7);
|
||||
this.tabPage5.Location = new System.Drawing.Point(4, 29);
|
||||
this.tabPage5.Name = "tabPage5";
|
||||
this.tabPage5.Size = new System.Drawing.Size(388, 568);
|
||||
this.tabPage5.TabIndex = 4;
|
||||
this.tabPage5.Text = "结果";
|
||||
this.tabPage5.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// panel7
|
||||
//
|
||||
this.panel7.Controls.Add(this.dgv_matchResult);
|
||||
this.panel7.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel7.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel7.Name = "panel7";
|
||||
this.panel7.Size = new System.Drawing.Size(388, 568);
|
||||
this.panel7.TabIndex = 0;
|
||||
this.tabPage3.Controls.Add(this.dgv_matchResult);
|
||||
this.tabPage3.Location = new System.Drawing.Point(4, 29);
|
||||
this.tabPage3.Name = "tabPage3";
|
||||
this.tabPage3.Size = new System.Drawing.Size(392, 568);
|
||||
this.tabPage3.TabIndex = 5;
|
||||
this.tabPage3.Text = "结果";
|
||||
this.tabPage3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// dgv_matchResult
|
||||
//
|
||||
this.dgv_matchResult.AllowDrop = true;
|
||||
this.dgv_matchResult.AllowUserToAddRows = false;
|
||||
this.dgv_matchResult.AllowUserToDeleteRows = false;
|
||||
this.dgv_matchResult.AllowUserToResizeRows = false;
|
||||
this.dgv_matchResult.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
||||
this.dgv_matchResult.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
|
||||
this.dgv_matchResult.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
|
||||
this.dgv_matchResult.BackgroundColor = System.Drawing.Color.White;
|
||||
this.dgv_matchResult.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
|
||||
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
|
||||
dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White;
|
||||
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.dgv_matchResult.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
|
||||
this.dgv_matchResult.ColumnHeadersHeight = 32;
|
||||
this.dgv_matchResult.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
|
||||
this.dgv_matchResult.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.Column7,
|
||||
this.Column8,
|
||||
this.Column9,
|
||||
this.Column10,
|
||||
this.Column12});
|
||||
this.Column1,
|
||||
this.Column2,
|
||||
this.Column3,
|
||||
this.Column4,
|
||||
this.Column5});
|
||||
this.dgv_matchResult.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.dgv_matchResult.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
|
||||
this.dgv_matchResult.EnableHeadersVisualStyles = false;
|
||||
this.dgv_matchResult.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.dgv_matchResult.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
|
||||
this.dgv_matchResult.Location = new System.Drawing.Point(0, 0);
|
||||
this.dgv_matchResult.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.dgv_matchResult.Name = "dgv_matchResult";
|
||||
this.dgv_matchResult.ReadOnly = true;
|
||||
this.dgv_matchResult.RowHeadersVisible = false;
|
||||
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
||||
dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
|
||||
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
|
||||
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.White;
|
||||
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.dgv_matchResult.RowHeadersDefaultCellStyle = dataGridViewCellStyle3;
|
||||
this.dgv_matchResult.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToFirstHeader;
|
||||
dataGridViewCellStyle4.BackColor = System.Drawing.Color.White;
|
||||
this.dgv_matchResult.RowsDefaultCellStyle = dataGridViewCellStyle4;
|
||||
this.dgv_matchResult.RowTemplate.Height = 23;
|
||||
this.dgv_matchResult.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||
this.dgv_matchResult.Size = new System.Drawing.Size(388, 568);
|
||||
this.dgv_matchResult.TabIndex = 13;
|
||||
this.dgv_matchResult.SelectedIndex = -1;
|
||||
this.dgv_matchResult.ShowGridLine = true;
|
||||
this.dgv_matchResult.Size = new System.Drawing.Size(392, 568);
|
||||
this.dgv_matchResult.TabIndex = 0;
|
||||
//
|
||||
// Column7
|
||||
// Column1
|
||||
//
|
||||
this.Column7.HeaderText = "编号";
|
||||
this.Column7.Name = "Column7";
|
||||
this.Column7.ReadOnly = true;
|
||||
this.Column7.Width = 70;
|
||||
this.Column1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
|
||||
this.Column1.HeaderText = "编号";
|
||||
this.Column1.Name = "Column1";
|
||||
this.Column1.Width = 66;
|
||||
//
|
||||
// Column8
|
||||
// Column2
|
||||
//
|
||||
this.Column8.HeaderText = "分数";
|
||||
this.Column8.Name = "Column8";
|
||||
this.Column8.ReadOnly = true;
|
||||
this.Column8.Width = 75;
|
||||
this.Column2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.Column2.HeaderText = "分值";
|
||||
this.Column2.Name = "Column2";
|
||||
//
|
||||
// Column9
|
||||
// Column3
|
||||
//
|
||||
this.Column9.HeaderText = "行";
|
||||
this.Column9.Name = "Column9";
|
||||
this.Column9.ReadOnly = true;
|
||||
this.Column9.Width = 70;
|
||||
this.Column3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
|
||||
this.Column3.HeaderText = "行";
|
||||
this.Column3.Name = "Column3";
|
||||
this.Column3.Width = 50;
|
||||
//
|
||||
// Column10
|
||||
// Column4
|
||||
//
|
||||
this.Column10.HeaderText = "列";
|
||||
this.Column10.Name = "Column10";
|
||||
this.Column10.ReadOnly = true;
|
||||
this.Column10.Width = 70;
|
||||
this.Column4.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
|
||||
this.Column4.HeaderText = "列";
|
||||
this.Column4.Name = "Column4";
|
||||
this.Column4.Width = 50;
|
||||
//
|
||||
// Column12
|
||||
// Column5
|
||||
//
|
||||
this.Column12.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.Column12.HeaderText = "角度(°)";
|
||||
this.Column12.Name = "Column12";
|
||||
this.Column12.ReadOnly = true;
|
||||
this.Column5.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
|
||||
this.Column5.HeaderText = "角度";
|
||||
this.Column5.Name = "Column5";
|
||||
this.Column5.Width = 66;
|
||||
//
|
||||
// FormPMAlignTool
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(999, 655);
|
||||
this.ClientSize = new System.Drawing.Size(1007, 655);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Controls.Add(this.toolStrip1);
|
||||
this.Controls.Add(this.statusStrip);
|
||||
@@ -1668,8 +1684,7 @@ namespace PMAlignTool
|
||||
this.tabPage4.ResumeLayout(false);
|
||||
this.panel6.ResumeLayout(false);
|
||||
this.panel6.PerformLayout();
|
||||
this.tabPage5.ResumeLayout(false);
|
||||
this.panel7.ResumeLayout(false);
|
||||
this.tabPage3.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgv_matchResult)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
@@ -1687,7 +1702,6 @@ namespace PMAlignTool
|
||||
private System.Windows.Forms.TabPage tabPage1;
|
||||
private System.Windows.Forms.TabPage tabPage2;
|
||||
private System.Windows.Forms.TabPage tabPage4;
|
||||
private System.Windows.Forms.TabPage tabPage5;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private ViewROI.HWindowTool_Smart hWindowTool_Smart1;
|
||||
private System.Windows.Forms.Panel panel3;
|
||||
@@ -1728,13 +1742,6 @@ namespace PMAlignTool
|
||||
public System.Windows.Forms.CheckBox cbx_showTemplate;
|
||||
public System.Windows.Forms.CheckBox ckb_showFeature;
|
||||
public System.Windows.Forms.CheckBox ckb_showCross;
|
||||
private System.Windows.Forms.Panel panel7;
|
||||
internal System.Windows.Forms.DataGridView dgv_matchResult;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column7;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column8;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column9;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column10;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column12;
|
||||
private System.Windows.Forms.Panel panel8;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.RadioButton rabFormLocal;
|
||||
@@ -1763,7 +1770,7 @@ namespace PMAlignTool
|
||||
private System.Windows.Forms.CheckBox cbCErosion1;
|
||||
private System.Windows.Forms.CheckBox cbCErosion2;
|
||||
internal System.Windows.Forms.Button btnCreateModel;
|
||||
internal System.Windows.Forms.Button btnAcqNewModelImage;
|
||||
internal System.Windows.Forms.Button btnChangeModel;
|
||||
public Controls.CNumericUpDown nud_angleRange;
|
||||
public Controls.CNumericUpDown nud_angleStart;
|
||||
public Controls.CComboBox cmbErsion1;
|
||||
@@ -1775,5 +1782,12 @@ namespace PMAlignTool
|
||||
private System.Windows.Forms.ToolStripStatusLabel lb_RunStatus;
|
||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
|
||||
private System.Windows.Forms.ToolStripStatusLabel lb_RunTime;
|
||||
private System.Windows.Forms.TabPage tabPage3;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column4;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column5;
|
||||
public Sunny.UI.UIDataGridView dgv_matchResult;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -20,10 +21,10 @@ namespace PMAlignTool
|
||||
private PMAlign myPMAlign = new PMAlign();
|
||||
public IToolInfo myToolInfo = new IToolInfo();
|
||||
public HWindowTool_Smart myHwindow = new HWindowTool_Smart();
|
||||
private HDrawingObject selected_drawing_object = new HDrawingObject();
|
||||
private HDrawingObject serachRegion_drawing_object = new HDrawingObject();
|
||||
public List<HDrawingObject> templateModelListAdd = new List<HDrawingObject>() { };
|
||||
public List<HDrawingObject> templateModelListSub = new List<HDrawingObject>() { };
|
||||
|
||||
public List<HDrawingObject> templateModelList = new List<HDrawingObject>() { };
|
||||
public FormPMAlignTool(ref object pmalign)
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -100,17 +101,14 @@ namespace PMAlignTool
|
||||
nud_ScaleStart.Value = myPMAlign.minScale;
|
||||
nud_ScaleRange.Value = myPMAlign.maxScale;
|
||||
tkb_contrast.Value = myPMAlign.contrast;
|
||||
|
||||
#endregion
|
||||
isInitTool = false;
|
||||
}
|
||||
|
||||
private void btnAcqNewModelImage_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (myPMAlign.inputImage != null)
|
||||
if(myPMAlign.modelPartImage != null)
|
||||
{
|
||||
myPMAlign.oldTrainImage = myPMAlign.inputImage;
|
||||
hWindowTool_Smart1.DispImage(myPMAlign.modelPartImage);
|
||||
}
|
||||
// myHwindow.DispHWindow.AttachDrawingObjectToWindow(serachRegion_drawing_object);
|
||||
tsbtRunTool_Click(null, null);
|
||||
isInitTool = false;
|
||||
}
|
||||
private ShapeMode selectType;
|
||||
private void btnOperateROI_Click(object sender, EventArgs e)
|
||||
@@ -182,6 +180,12 @@ namespace PMAlignTool
|
||||
selectObj.Dispose();
|
||||
}
|
||||
|
||||
private void OnSerchRegionDrawingObject(HDrawingObject dobj, HWindow hwin, string type)
|
||||
{
|
||||
HObject selectObj = dobj.GetDrawingObjectIconic();
|
||||
myPMAlign.SearchRegion = selectObj.Clone();
|
||||
}
|
||||
|
||||
public HObject contour;
|
||||
private void btnCreateModel_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -206,19 +210,11 @@ namespace PMAlignTool
|
||||
HTuple row1, col1, row2, col2;
|
||||
HOperatorSet.SmallestRectangle1(myPMAlign.templateRegion, out row1, out col1, out row2, out col2);
|
||||
HObject outRectangle1;
|
||||
HOperatorSet.GenRectangle1(out outRectangle1, row1 - 20, col1 - 20, row2 + 20, col2 + 20);
|
||||
HObject imageReduced, imagePart;
|
||||
HOperatorSet.GenRectangle1(out outRectangle1, row1, col1, row2, col2);
|
||||
HObject imageReduced;
|
||||
HOperatorSet.ReduceDomain(myPMAlign.inputImage, outRectangle1, out imageReduced);
|
||||
HObject outBoundary, inBoundary;
|
||||
HOperatorSet.Boundary(myPMAlign.templateRegion, out outBoundary, "inner_filled");
|
||||
HOperatorSet.Boundary(myPMAlign.templateRegion, out inBoundary, "outer");
|
||||
HOperatorSet.CropDomain(imageReduced, out imagePart);
|
||||
HOperatorSet.SetSystem("flush_graphic", "true");
|
||||
hWindowTool_Smart1.DispImage(imagePart);
|
||||
hWindowTool_Smart1.DispHWindow.SetColor("green");
|
||||
hWindowTool_Smart1.DispHWindow.SetDraw("margin");
|
||||
hWindowTool_Smart1.DispHWindow.DispObj(outBoundary);
|
||||
hWindowTool_Smart1.DispHWindow.DispObj(inBoundary);
|
||||
hWindowTool_Smart1.DispImage(myPMAlign.modelPartImage);
|
||||
if (myPMAlign.matchMode == MatchMode.BasedShape)
|
||||
{
|
||||
HOperatorSet.SetLineStyle(myHwindow.DispHWindow, new HTuple());
|
||||
@@ -322,5 +318,50 @@ namespace PMAlignTool
|
||||
}
|
||||
}
|
||||
|
||||
private void btnChangeModel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(!File.Exists(myPMAlign.pmaModelName + ".ShapeModel"))
|
||||
{
|
||||
MessageBox.Show("还未创建过模板,请先进行创建!");
|
||||
return;
|
||||
}
|
||||
myPMAlign.inputImage = myPMAlign.oldTrainImage;
|
||||
myPMAlign.Run(SoftwareRunState.Debug);
|
||||
|
||||
}
|
||||
|
||||
private void cbx_searchRegionType_SelectedIndexChanged()
|
||||
{
|
||||
serachRegion_drawing_object.ClearDrawingObject();
|
||||
string selectRegion = cbx_searchRegionType.TextStr;
|
||||
switch (selectRegion)
|
||||
{
|
||||
case "整幅图像":
|
||||
myPMAlign.searchRegionType = RegionType.AllImage;
|
||||
return;
|
||||
case "矩形":
|
||||
myPMAlign.searchRegionType = RegionType.Rectangle1;
|
||||
serachRegion_drawing_object = HDrawingObject.CreateDrawingObject(HDrawingObject.HDrawingObjectType.RECTANGLE1, new HTuple[] { 100, 100, 300, 400 });
|
||||
break;
|
||||
case "圆":
|
||||
myPMAlign.searchRegionType = RegionType.Circle;
|
||||
serachRegion_drawing_object = HDrawingObject.CreateDrawingObject(HDrawingObject.HDrawingObjectType.CIRCLE, new HTuple[] { 200, 200, 100 });
|
||||
break;
|
||||
case "多点":
|
||||
myPMAlign.searchRegionType = RegionType.MultPoint;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
GC.KeepAlive(serachRegion_drawing_object);
|
||||
serachRegion_drawing_object.OnSelect(OnSerchRegionDrawingObject);
|
||||
serachRegion_drawing_object.OnAttach(OnSerchRegionDrawingObject);
|
||||
serachRegion_drawing_object.OnResize(OnSerchRegionDrawingObject);
|
||||
serachRegion_drawing_object.OnDrag(OnSerchRegionDrawingObject);
|
||||
serachRegion_drawing_object.SetDrawingObjectParams("color", "yellow");
|
||||
myHwindow.DispHWindow.AttachDrawingObjectToWindow(serachRegion_drawing_object);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,19 +196,19 @@
|
||||
n4H40MZzWKY2esaEIAiCIAiCIKrhy5f/A2/46JDXUARZAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="Column7.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Column8.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Column9.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Column10.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Column12.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
|
||||
@@ -24,6 +24,7 @@ using System.Windows.Forms;
|
||||
using Logger;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using ViewROI;
|
||||
|
||||
namespace PMAlignTool
|
||||
{
|
||||
@@ -118,11 +119,15 @@ namespace PMAlignTool
|
||||
public bool isCreateModel { get; set; }
|
||||
internal string pmaModelName { get; set; } = Guid.NewGuid().ToString();
|
||||
/// <summary>
|
||||
/// 剪出的模板图像
|
||||
/// </summary>
|
||||
public HObject modelPartImage = new HObject();
|
||||
/// <summary>
|
||||
/// 模板位置和实际位置的姿态差异
|
||||
/// </summary>
|
||||
internal HTuple posHomMat2D = new HTuple();
|
||||
|
||||
public override void DispMainWindow(HWindow dispHWindow)
|
||||
public override void DispMainWindow(HWindowTool_Smart dispHWindow)
|
||||
{
|
||||
if (showFeature)
|
||||
{
|
||||
@@ -158,8 +163,7 @@ namespace PMAlignTool
|
||||
public bool isAutoConstants { get; set; }
|
||||
public string modelFilePath { get; set; }
|
||||
public RegionType searchRegionType { get; set; }
|
||||
public HObject SearchRegion { get; private set; }
|
||||
|
||||
public HObject SearchRegion { get; set; }
|
||||
public override void Run(SoftwareRunState softwareState)
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
@@ -167,7 +171,9 @@ namespace PMAlignTool
|
||||
softwareRunState = softwareState;
|
||||
if (inputImage == null)
|
||||
{
|
||||
FormPMAlignTool.Instance.SetToolStatus("工具输入图像为空", ToolRunStatu.Not_Input_Image);
|
||||
toolRunStatu = ToolRunStatu.Lack_Of_Input_Image;
|
||||
runMessage = "工具输入图像为空";
|
||||
FormPMAlignTool.Instance.SetToolStatus(runMessage, toolRunStatu);
|
||||
return;
|
||||
}
|
||||
try
|
||||
@@ -192,21 +198,36 @@ namespace PMAlignTool
|
||||
// UpdateParamsFromUI(); // 操作前先将UI中参数写入类
|
||||
HObject findModelImg = ProcessImage(inputImage);
|
||||
int ret = FindModelTemplate(findModelImg);
|
||||
UpdateResultDataGridview();
|
||||
ToolRunStatu myState = ret == 0 ? ToolRunStatu.Succeed : ToolRunStatu.Model_UnFound;
|
||||
string retMsg = ret == 0 ? "工具运行成功,已找到匹配项!" : "未找到匹配项";
|
||||
toolRunStatu = myState;
|
||||
string retMsg = ret == 0 ? $"{toolName}工具运行成功,已找到匹配项!" : $"{toolName}未找到匹配项";
|
||||
runMessage = retMsg;
|
||||
sw.Stop();
|
||||
runTime = $"运行时间: {sw.ElapsedMilliseconds} ms";
|
||||
FormPMAlignTool.Instance.SetToolStatus(retMsg, myState);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FormPMAlignTool.Instance.SetToolStatus($"工具运行异常,异常原因: {ex}", ToolRunStatu.Tool_Run_Error);
|
||||
FormPMAlignTool.Instance.SetToolStatus($"{toolName}工具运行异常,异常原因: {ex}", ToolRunStatu.Tool_Run_Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateResultDataGridview()
|
||||
{
|
||||
FormPMAlignTool.Instance.dgv_matchResult.Rows.Clear();
|
||||
int count = 0;
|
||||
foreach (var item in L_resultList)
|
||||
{
|
||||
FormPMAlignTool.Instance.dgv_matchResult.AddRow(++count, item.Socre, item.Row, item.Col, item.Angle);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void UpdateParamsFromUI()
|
||||
{
|
||||
minScore = FormPMAlignTool.Instance.nud_minScore.Value;
|
||||
@@ -261,7 +282,7 @@ namespace PMAlignTool
|
||||
oldTrainImage = inputImage;
|
||||
if (FormPMAlignTool.Instance.templateModelListAdd.Count == 0)
|
||||
{
|
||||
LoggerClass.WriteLog("未划定模板建立区域", MsgLevel.Exception);
|
||||
LoggerClass.WriteLog($"{toolName}未划定模板建立区域", MsgLevel.Exception);
|
||||
isCreateModel = false;
|
||||
return -1;
|
||||
}
|
||||
@@ -270,6 +291,7 @@ namespace PMAlignTool
|
||||
HOperatorSet.GenEmptyObj(out createModelImg);
|
||||
createModelImg = ProcessImage(inputImage);
|
||||
HOperatorSet.ReduceDomain(createModelImg, templateRegion, out template);
|
||||
HOperatorSet.CropDomain(template, out modelPartImage);
|
||||
//SetParamsFromUI();
|
||||
try
|
||||
{
|
||||
@@ -327,6 +349,7 @@ namespace PMAlignTool
|
||||
isCreateModel = true;
|
||||
HOperatorSet.WriteRegion(templateRegion, FormPMAlignTool.Instance.myToolInfo.FormToolName + ".hobj");
|
||||
HOperatorSet.WriteShapeModel(modelID, pmaModelName + ".ShapeModel");
|
||||
|
||||
if (scores != null && scores.Type != HTupleType.EMPTY)
|
||||
{
|
||||
templatePose = new PosXYU { X = rows[0].D, Y = cols[0].D , U = angles[0].D };
|
||||
@@ -335,28 +358,23 @@ namespace PMAlignTool
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LoggerClass.WriteLog("创建模板时出现异常", ex);
|
||||
Logger.LoggerClass.WriteLog($"{toolName}创建模板时出现异常", ex);
|
||||
isCreateModel = false;
|
||||
return -1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
FormPMAlignTool.Instance.templateModelListAdd.Clear();
|
||||
FormPMAlignTool.Instance.templateModelListSub.Clear();
|
||||
// FormPMAlignTool.Instance.templateModelListAdd.Clear();
|
||||
// FormPMAlignTool.Instance.templateModelListSub.Clear();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int FindModelTemplate(HObject findModelImage)
|
||||
{
|
||||
if (!isCreateModel)
|
||||
{
|
||||
LoggerClass.WriteLog("未创建或加载模板", MsgLevel.Exception);
|
||||
return -1;
|
||||
}
|
||||
if (!File.Exists(pmaModelName + ".ShapeModel"))
|
||||
{
|
||||
LoggerClass.WriteLog("未创建或加载模板", MsgLevel.Exception);
|
||||
LoggerClass.WriteLog($"{toolName}未创建或加载模板", MsgLevel.Exception);
|
||||
return -1;
|
||||
}
|
||||
HOperatorSet.ReadShapeModel(pmaModelName + ".ShapeModel", out modelID);
|
||||
@@ -466,14 +484,14 @@ namespace PMAlignTool
|
||||
toolRunStatu = ToolRunStatu.Succeed;
|
||||
if (softwareRunState == SoftwareRunState.Debug)
|
||||
{
|
||||
ShowTemplate(FormPMAlignTool.Instance.myHwindow.DispHWindow);
|
||||
ShowTemplate(FormPMAlignTool.Instance.myHwindow);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LoggerClass.WriteLog("寻找模板时出现异常!", ex);
|
||||
LoggerClass.WriteLog($"{toolName}寻找模板时出现异常!", ex);
|
||||
toolRunStatu = ToolRunStatu.Not_Succeed;
|
||||
}
|
||||
return -1;
|
||||
@@ -483,7 +501,7 @@ namespace PMAlignTool
|
||||
/// <summary>
|
||||
/// 显示模板
|
||||
/// </summary>
|
||||
internal void ShowTemplate(HWindow dispHWindow, bool clearImg = false)
|
||||
internal void ShowTemplate(HWindowTool_Smart dispHWindow, bool clearImg = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -493,8 +511,8 @@ namespace PMAlignTool
|
||||
}
|
||||
if(clearImg)
|
||||
{
|
||||
dispHWindow.ClearWindow();
|
||||
dispHWindow.DispObj(inputImage);
|
||||
dispHWindow.DispHWindow.ClearWindow();
|
||||
dispHWindow.DispImage(inputImage);
|
||||
}
|
||||
if(L_resultList.Count > 0)
|
||||
{
|
||||
@@ -504,15 +522,15 @@ namespace PMAlignTool
|
||||
HOperatorSet.GetShapeModelContours(out contour, modelID, new HTuple(1));
|
||||
HOperatorSet.VectorAngleToRigid(0, 0, 0, item.Row, item.Col, item.Angle,out homMat2D);
|
||||
HOperatorSet.AffineTransContourXld(contour, out contour, homMat2D);
|
||||
dispHWindow.SetColor("green");
|
||||
dispHWindow.DispObj(contour);
|
||||
dispHWindow.DispHWindow.SetColor("green");
|
||||
dispHWindow.DispHWindow.DispObj(contour);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LoggerClass.WriteLog("显示模板时出现错误", ex);
|
||||
Logger.LoggerClass.WriteLog($"{toolName}显示模板时出现错误", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,11 +37,17 @@
|
||||
<Reference Include="halcondotnet">
|
||||
<HintPath>C:\Program Files\MVTec\HALCON-19.05-Progress\bin\dotnet20\halcondotnet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SunnyUI, Version=3.0.9.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\VisionEdit\bin\Debug\ThirdLib\SunnyUI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SunnyUI.Common, Version=3.0.9.0, Culture=neutral, PublicKeyToken=5a271fb7ba597231" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Design" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Runtime.Serialization.Formatters.Soap" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
@@ -97,7 +103,7 @@
|
||||
<Name>ToolBase</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ToolLib.Log\Logger\Logger.csproj">
|
||||
<Project>{D4E052B9-E541-4B67-A1F9-273073EF1D4B}</Project>
|
||||
<Project>{d4e052b9-e541-4b67-a1f9-273073ef1d4b}</Project>
|
||||
<Name>Logger</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ToolLib.VisionJob\ToolLib.VisionJob.csproj">
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace PMAlignTool
|
||||
if (L_toolList[toolIndex].GetInput(L_toolList[toolIndex].toolInput[j].IOName).value == null)
|
||||
{
|
||||
selectNode.ForeColor = Color.Red;
|
||||
myPMAlign.inputImage = null;
|
||||
LoggerClass.WriteLog(L_toolList[toolIndex].toolName + " 无输入图像", MsgLevel.Exception);
|
||||
}
|
||||
else
|
||||
@@ -63,7 +64,7 @@ namespace PMAlignTool
|
||||
else
|
||||
{
|
||||
myJob.FormLogDisp($"{L_toolList[toolIndex].toolName} 运行成功,{myPMAlign.runTime}", Color.Green, selectNode);
|
||||
myPMAlign.DispMainWindow(FormImageWindow.Instance.myHWindow.DispHWindow);
|
||||
myPMAlign.DispMainWindow(FormImageWindow.Instance.myHWindow);
|
||||
// 将输出值赋值到界面输出中
|
||||
if (myPMAlign.L_resultList.Count > 0)
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CommonMethods;
|
||||
using HalconDotNet;
|
||||
using ViewROI;
|
||||
|
||||
namespace ToolBase
|
||||
{
|
||||
@@ -18,6 +19,6 @@ namespace ToolBase
|
||||
public abstract void Run(SoftwareRunState softwareRunState);
|
||||
public HObject inputImage { get; set; }
|
||||
public abstract void DispImage();
|
||||
public abstract void DispMainWindow(HWindow window);
|
||||
public abstract void DispMainWindow(HWindowTool_Smart window);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,10 @@
|
||||
<Project>{1C8D0DDC-2086-48A9-9586-F2B643E2FC54}</Project>
|
||||
<Name>CommonHelper</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ImageWindow\HWindow_Tool.csproj">
|
||||
<Project>{9baa53fd-89b5-43e2-ac59-a27b006debb6}</Project>
|
||||
<Name>HWindow_Tool</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.
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
<Name>HWindow_Tool</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ToolLib.Log\Logger\Logger.csproj">
|
||||
<Project>{D4E052B9-E541-4B67-A1F9-273073EF1D4B}</Project>
|
||||
<Project>{d4e052b9-e541-4b67-a1f9-273073ef1d4b}</Project>
|
||||
<Name>Logger</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace ToolLib.VisionJob
|
||||
{
|
||||
if (L_toolList[i].toolName == moveNode.Text)
|
||||
{
|
||||
SwapDataFun(L_toolList, i, targeNode.Index);
|
||||
SwapDataFun(L_toolList, i, targeNode.Index-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -327,6 +327,7 @@ namespace ToolLib.VisionJob
|
||||
{
|
||||
//判断是否在节点单击
|
||||
TreeViewHitTestInfo test = GetJobTree().HitTest(e.X, e.Y);
|
||||
// 右键 && 工具节点的输入输出项
|
||||
if (e.Button == MouseButtons.Right && test.Node.Level == 1)
|
||||
{
|
||||
GetJobTree().ContextMenuStrip = rightClickMenu;
|
||||
@@ -337,6 +338,14 @@ namespace ToolLib.VisionJob
|
||||
rightClickMenu.Items[0].Click += DeleteLine;
|
||||
}
|
||||
}
|
||||
// 右键 && 工具节点
|
||||
if (e.Button == MouseButtons.Right && test.Node.Level == 0)
|
||||
{
|
||||
GetJobTree().ContextMenuStrip = rightClickMenu;
|
||||
rightClickMenu.Items.Clear();
|
||||
rightClickMenu.Items.Add("删除工具");
|
||||
rightClickMenu.Items[0].Click += DeleteItem;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -654,47 +663,15 @@ namespace ToolLib.VisionJob
|
||||
int level = GetJobTree().SelectedNode.Level;
|
||||
string fatherNodeText = string.Empty;
|
||||
|
||||
List<string> KeyValueList = new List<string>() { };
|
||||
List<TreeNode> D_itemAndSourceKeysList = new List<TreeNode>() { };
|
||||
string keyItem = string.Empty;
|
||||
string valueItem = string.Empty;
|
||||
//如果是子节点
|
||||
if (level == 1)
|
||||
{
|
||||
fatherNodeText = GetJobTree().SelectedNode.Parent.Text;
|
||||
}
|
||||
foreach (TreeNode toolNode in GetJobTree().Nodes)
|
||||
{
|
||||
if (level == 1)
|
||||
{
|
||||
if (toolNode.Text == fatherNodeText)
|
||||
{
|
||||
foreach (var itemNode in toolNode.Nodes)
|
||||
{
|
||||
if (itemNode != null)
|
||||
{
|
||||
if (((TreeNode)itemNode).Text == nodeText)
|
||||
{
|
||||
//移除连线集合中的这条连线
|
||||
for (int i = 0; i < D_itemAndSource.Count; i++)
|
||||
{
|
||||
if (((TreeNode)itemNode) == D_itemAndSource.Keys.ToArray()[i] || ((TreeNode)itemNode) == D_itemAndSource[D_itemAndSource.Keys.ToArray()[i]])
|
||||
D_itemAndSource.Remove(D_itemAndSource.Keys.ToArray()[i]);
|
||||
}
|
||||
|
||||
((TreeNode)itemNode).Remove();
|
||||
GetJobTree().SelectedNode = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (((TreeNode)toolNode).Text == nodeText)
|
||||
{
|
||||
((TreeNode)toolNode).Remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//如果是父节点
|
||||
if (level == 0)
|
||||
{
|
||||
@@ -705,37 +682,73 @@ namespace ToolLib.VisionJob
|
||||
try
|
||||
{
|
||||
//移除连线集合中的这条连线
|
||||
for (int j = D_itemAndSource.Count - 1; j >= 0; j--)
|
||||
for (int j = 0; j < D_itemAndSource.Count; j++ )
|
||||
{
|
||||
if (nodeText == D_itemAndSource.Keys.ToArray()[j].Parent.Text || nodeText == D_itemAndSource[D_itemAndSource.Keys.ToArray()[j]].Parent.Text)
|
||||
D_itemAndSource.Remove(D_itemAndSource.Keys.ToArray()[j]);
|
||||
keyItem = D_itemAndSource.Keys.ToArray()[j].Parent.Text;
|
||||
valueItem = D_itemAndSource[D_itemAndSource.Keys.ToArray()[j]].Parent.Text;
|
||||
KeyValueList.Add(keyItem);
|
||||
if (nodeText == keyItem || nodeText == valueItem)
|
||||
{
|
||||
TreeNode selectNode = D_itemAndSource.Keys.ToArray()[j];
|
||||
D_itemAndSourceKeysList.Add(selectNode);
|
||||
}
|
||||
}
|
||||
foreach (var item in D_itemAndSourceKeysList)
|
||||
{
|
||||
D_itemAndSource.Remove(item);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
L_toolList.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < L_toolList.Count; i++)
|
||||
// 在非该节点中,将与该节点相关的输入值删除
|
||||
foreach (var item in KeyValueList)
|
||||
{
|
||||
if (L_toolList[i].toolName == fatherNodeText)
|
||||
for (int j = 0; j < L_toolList.Count; j++)
|
||||
{
|
||||
for (int j = 0; j < L_toolList[i].toolInput.Count; j++)
|
||||
for (int k = 0; k < L_toolList[j].toolInput.Count; k++)
|
||||
{
|
||||
if (L_toolList[i].toolInput[j].value.ToString() == Regex.Split(nodeText, "《")[0])
|
||||
L_toolList[i].RemoveInputIO(Regex.Split(nodeText, "《")[0]);
|
||||
}
|
||||
for (int j = 0; j < L_toolList[i].toolOutput.Count; j++)
|
||||
{
|
||||
if (L_toolList[i].toolOutput[j].IOName == nodeText.Substring(3))
|
||||
L_toolList[i].RemoveOutputIO(nodeText.Substring(3));
|
||||
if (L_toolList[j].toolName == item)
|
||||
{
|
||||
string sourceFrom = L_toolList[j].GetInput(L_toolList[j].toolInput[k].IOName).value.ToString();
|
||||
if (L_toolList[j].toolInput[k].value.ToString() == sourceFrom)
|
||||
{
|
||||
L_toolList[j].toolInput[k].value = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 将该节点在流程树中删除
|
||||
foreach (TreeNode toolNode in GetJobTree().Nodes)
|
||||
{
|
||||
if (toolNode.Text == nodeText)
|
||||
{
|
||||
GetJobTree().Nodes.Remove(toolNode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 与之相关的节点进行还原
|
||||
foreach (TreeNode toolNode in GetJobTree().Nodes)
|
||||
{
|
||||
foreach (TreeNode itemNode in toolNode.Nodes)
|
||||
{
|
||||
foreach (var item in D_itemAndSourceKeysList)
|
||||
{
|
||||
if (itemNode.Text == item.Text)
|
||||
{
|
||||
string text = Regex.Split(itemNode.Text, "《")[0];
|
||||
itemNode.Text = text;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
45
VisionEdit/FormMain.Designer.cs
generated
45
VisionEdit/FormMain.Designer.cs
generated
@@ -58,7 +58,7 @@ namespace VisionEdit
|
||||
this.关闭ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.打开ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.保存ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiSaveObject = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.退出ToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.试图ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.全局变量ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@@ -198,7 +198,7 @@ namespace VisionEdit
|
||||
this.关闭ToolStripMenuItem,
|
||||
this.打开ToolStripMenuItem,
|
||||
this.toolStripMenuItem1,
|
||||
this.保存ToolStripMenuItem,
|
||||
this.tsmiSaveObject,
|
||||
this.退出ToolStripMenuItem1});
|
||||
this.文件ToolStripMenuItem.Name = "文件ToolStripMenuItem";
|
||||
this.文件ToolStripMenuItem.Size = new System.Drawing.Size(60, 24);
|
||||
@@ -260,16 +260,17 @@ namespace VisionEdit
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(200, 21);
|
||||
this.toolStripMenuItem1.Text = "克隆工程";
|
||||
//
|
||||
// 保存ToolStripMenuItem
|
||||
// tsmiSaveObject
|
||||
//
|
||||
this.保存ToolStripMenuItem.BackColor = System.Drawing.Color.White;
|
||||
this.保存ToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("保存ToolStripMenuItem.Image")));
|
||||
this.保存ToolStripMenuItem.Name = "保存ToolStripMenuItem";
|
||||
this.保存ToolStripMenuItem.Padding = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
||||
this.保存ToolStripMenuItem.ShortcutKeyDisplayString = " Ctrl+S";
|
||||
this.保存ToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
|
||||
this.保存ToolStripMenuItem.Size = new System.Drawing.Size(200, 21);
|
||||
this.保存ToolStripMenuItem.Text = "保存";
|
||||
this.tsmiSaveObject.BackColor = System.Drawing.Color.White;
|
||||
this.tsmiSaveObject.Image = ((System.Drawing.Image)(resources.GetObject("tsmiSaveObject.Image")));
|
||||
this.tsmiSaveObject.Name = "tsmiSaveObject";
|
||||
this.tsmiSaveObject.Padding = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
||||
this.tsmiSaveObject.ShortcutKeyDisplayString = " Ctrl+S";
|
||||
this.tsmiSaveObject.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
|
||||
this.tsmiSaveObject.Size = new System.Drawing.Size(200, 21);
|
||||
this.tsmiSaveObject.Text = "保存";
|
||||
this.tsmiSaveObject.Click += new System.EventHandler(this.tsmiSaveObject_Click);
|
||||
//
|
||||
// 退出ToolStripMenuItem1
|
||||
//
|
||||
@@ -361,7 +362,7 @@ namespace VisionEdit
|
||||
this.布局管理ToolStripMenuItem1.BackColor = System.Drawing.Color.White;
|
||||
this.布局管理ToolStripMenuItem1.Name = "布局管理ToolStripMenuItem1";
|
||||
this.布局管理ToolStripMenuItem1.Padding = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
||||
this.布局管理ToolStripMenuItem1.Size = new System.Drawing.Size(152, 27);
|
||||
this.布局管理ToolStripMenuItem1.Size = new System.Drawing.Size(137, 27);
|
||||
this.布局管理ToolStripMenuItem1.Text = "布局管理";
|
||||
//
|
||||
// 切换到经典布局1ToolStripMenuItem
|
||||
@@ -370,7 +371,7 @@ namespace VisionEdit
|
||||
this.切换到经典布局1ToolStripMenuItem.CheckOnClick = true;
|
||||
this.切换到经典布局1ToolStripMenuItem.Name = "切换到经典布局1ToolStripMenuItem";
|
||||
this.切换到经典布局1ToolStripMenuItem.Padding = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
||||
this.切换到经典布局1ToolStripMenuItem.Size = new System.Drawing.Size(152, 27);
|
||||
this.切换到经典布局1ToolStripMenuItem.Size = new System.Drawing.Size(137, 27);
|
||||
this.切换到经典布局1ToolStripMenuItem.Text = "经典布局1";
|
||||
//
|
||||
// 切换到经典布局2ToolStripMenuItem
|
||||
@@ -379,7 +380,7 @@ namespace VisionEdit
|
||||
this.切换到经典布局2ToolStripMenuItem.CheckOnClick = true;
|
||||
this.切换到经典布局2ToolStripMenuItem.Name = "切换到经典布局2ToolStripMenuItem";
|
||||
this.切换到经典布局2ToolStripMenuItem.Padding = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
||||
this.切换到经典布局2ToolStripMenuItem.Size = new System.Drawing.Size(152, 27);
|
||||
this.切换到经典布局2ToolStripMenuItem.Size = new System.Drawing.Size(137, 27);
|
||||
this.切换到经典布局2ToolStripMenuItem.Text = "经典布局2";
|
||||
//
|
||||
// 解锁ToolStripMenuItem
|
||||
@@ -390,14 +391,14 @@ namespace VisionEdit
|
||||
this.解锁ToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.解锁ToolStripMenuItem.Name = "解锁ToolStripMenuItem";
|
||||
this.解锁ToolStripMenuItem.Padding = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
||||
this.解锁ToolStripMenuItem.Size = new System.Drawing.Size(152, 27);
|
||||
this.解锁ToolStripMenuItem.Size = new System.Drawing.Size(137, 27);
|
||||
this.解锁ToolStripMenuItem.Text = "锁定";
|
||||
//
|
||||
// tToolStripMenuItem6
|
||||
//
|
||||
this.tToolStripMenuItem6.Font = new System.Drawing.Font("幼圆", 18F);
|
||||
this.tToolStripMenuItem6.Name = "tToolStripMenuItem6";
|
||||
this.tToolStripMenuItem6.Size = new System.Drawing.Size(152, 28);
|
||||
this.tToolStripMenuItem6.Size = new System.Drawing.Size(137, 28);
|
||||
this.tToolStripMenuItem6.Text = "T";
|
||||
this.tToolStripMenuItem6.Visible = false;
|
||||
//
|
||||
@@ -622,35 +623,35 @@ namespace VisionEdit
|
||||
//
|
||||
this.登录ToolStripMenuItem.Name = "登录ToolStripMenuItem";
|
||||
this.登录ToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.L)));
|
||||
this.登录ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.登录ToolStripMenuItem.Size = new System.Drawing.Size(151, 22);
|
||||
this.登录ToolStripMenuItem.Text = "登录";
|
||||
//
|
||||
// 锁定ToolStripMenuItem
|
||||
//
|
||||
this.锁定ToolStripMenuItem.Name = "锁定ToolStripMenuItem";
|
||||
this.锁定ToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.K)));
|
||||
this.锁定ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.锁定ToolStripMenuItem.Size = new System.Drawing.Size(151, 22);
|
||||
this.锁定ToolStripMenuItem.Text = "锁定";
|
||||
//
|
||||
// 运行一次ToolStripMenuItem
|
||||
//
|
||||
this.运行一次ToolStripMenuItem.Name = "运行一次ToolStripMenuItem";
|
||||
this.运行一次ToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F5;
|
||||
this.运行一次ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.运行一次ToolStripMenuItem.Size = new System.Drawing.Size(151, 22);
|
||||
this.运行一次ToolStripMenuItem.Text = "运行一次";
|
||||
//
|
||||
// 连续运行ToolStripMenuItem
|
||||
//
|
||||
this.连续运行ToolStripMenuItem.Name = "连续运行ToolStripMenuItem";
|
||||
this.连续运行ToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F6;
|
||||
this.连续运行ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.连续运行ToolStripMenuItem.Size = new System.Drawing.Size(151, 22);
|
||||
this.连续运行ToolStripMenuItem.Text = "连续运行";
|
||||
//
|
||||
// 停止连续ToolStripMenuItem
|
||||
//
|
||||
this.停止连续ToolStripMenuItem.Name = "停止连续ToolStripMenuItem";
|
||||
this.停止连续ToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F7;
|
||||
this.停止连续ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.停止连续ToolStripMenuItem.Size = new System.Drawing.Size(151, 22);
|
||||
this.停止连续ToolStripMenuItem.Text = "停止连续";
|
||||
//
|
||||
// panel2
|
||||
@@ -800,7 +801,7 @@ namespace VisionEdit
|
||||
private System.Windows.Forms.ToolStripMenuItem 关闭ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem 打开ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripMenuItem 保存ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiSaveObject;
|
||||
private System.Windows.Forms.ToolStripMenuItem 退出ToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripMenuItem 试图ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem 全局变量ToolStripMenuItem;
|
||||
|
||||
@@ -122,5 +122,14 @@ namespace VisionEdit
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void tsmiSaveObject_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult dr = MessageBox.Show("是否要进行保存?", "提示", MessageBoxButtons.YesNoCancel);
|
||||
if (dr == DialogResult.Yes)
|
||||
{
|
||||
VisionJobParams.pVisionProject.SaveObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@
|
||||
AAAAAAAAAAAAAAAAAAAAAAqlVPoXX1pkbzaNyOcAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="保存ToolStripMenuItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<data name="tsmiSaveObject.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAABGdBTUEAALGPC/xhBQAAB85JREFUeF7t
|
||||
nT+oJWcdhq82CWb37sxBJZ0WgnW0sAv2VlorWliIjX/QSpQFCwloc7kzl8WEhXSSWIkYFCFJoRYidtGZ
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
<Name>DataStruct</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\FormLib\FormLib.csproj">
|
||||
<Project>{8C6FC8C6-8874-494B-8260-071F291AA33D}</Project>
|
||||
<Project>{8c6fc8c6-8874-494b-8260-071f291aa33d}</Project>
|
||||
<Name>FormLib</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ImageWindow\HWindow_Tool.csproj">
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user