2024-03-07 14:03:22 +08:00
|
|
|
|
using LeatherApp.UIExtend;
|
|
|
|
|
using Models;
|
2024-08-05 09:39:58 +08:00
|
|
|
|
using OpenCvSharp;
|
|
|
|
|
using OpenCvSharp.Extensions;
|
2024-03-07 14:03:22 +08:00
|
|
|
|
using Sunny.UI;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
2024-11-08 09:10:43 +08:00
|
|
|
|
using System.IO;
|
2024-03-07 14:03:22 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace LeatherApp.Page
|
|
|
|
|
{
|
|
|
|
|
public partial class FHome_Defect : UIForm
|
|
|
|
|
{
|
|
|
|
|
private List<DefectInfo> list;
|
|
|
|
|
public List<DefectInfo> lstDel = new List<DefectInfo>();
|
2024-08-05 09:39:58 +08:00
|
|
|
|
private Mat Image;
|
|
|
|
|
public FHome_Defect(List<DefectInfo> lst, Mat img)
|
2024-03-07 14:03:22 +08:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
list = lst;
|
2024-08-05 09:39:58 +08:00
|
|
|
|
Image = img;
|
|
|
|
|
pictureBox1.Image = Image.ToBitmap();
|
2024-03-07 14:03:22 +08:00
|
|
|
|
init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void init()
|
|
|
|
|
{
|
|
|
|
|
this.Text += $" 原图索引({list[0].PhotoIndex})";
|
|
|
|
|
list.ForEach(item => {
|
2024-11-08 09:10:43 +08:00
|
|
|
|
string filename = Path.Combine(Config.appBasePath + "\\TempPic\\", $"{item.imageID}.jpg");
|
|
|
|
|
OpenCvSharp.Mat img = new OpenCvSharp.Mat(filename);
|
2024-03-07 14:03:22 +08:00
|
|
|
|
UIDefectImage userCon = new UIDefectImage()
|
|
|
|
|
{
|
|
|
|
|
Code = item.Code,
|
|
|
|
|
Tag = item,
|
|
|
|
|
DefecLocation=$"[{item.CentreX}cm,{Math.Round(item.CentreY/ 100.0f,2)}米]",
|
2024-11-08 09:10:43 +08:00
|
|
|
|
Image = img.ToBitmap()
|
2024-03-07 14:03:22 +08:00
|
|
|
|
};
|
|
|
|
|
//userCon.CodeChangeEvent = (code, name) =>
|
|
|
|
|
//{
|
|
|
|
|
// item.Code = code;
|
|
|
|
|
// item.Name = name;
|
|
|
|
|
// API.OutputDebugString("BBBBBBBBBBB-" + item.Code+" "+ item.Name);
|
|
|
|
|
//};
|
|
|
|
|
this.flowLayoutPanel1.Controls.Add(userCon);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
private void FHome_Defect_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnOK_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
for(int i = 0; i < this.flowLayoutPanel1.Controls.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
UIDefectImage userCon= this.flowLayoutPanel1.Controls[i] as UIDefectImage;
|
|
|
|
|
if (userCon.Checked)
|
|
|
|
|
{
|
|
|
|
|
var item=(DefectInfo)userCon.Tag;
|
|
|
|
|
lstDel.Add(item);
|
|
|
|
|
list.Remove(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnCancel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < this.flowLayoutPanel1.Controls.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
UIDefectImage userCon = this.flowLayoutPanel1.Controls[i] as UIDefectImage;
|
|
|
|
|
var item = (DefectInfo)userCon.Tag;
|
|
|
|
|
lstDel.Add(item);
|
|
|
|
|
list.Remove(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|