using Bro.Common.Base;
|
using Bro.Common.Helper;
|
using Bro.Common.Interface;
|
using Bro.Common.Model;
|
using Newtonsoft.Json;
|
using System;
|
using System.Collections.Generic;
|
using System.Collections.ObjectModel;
|
using System.ComponentModel;
|
using System.Drawing;
|
using System.Drawing.Design;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace Bro.Process
|
{
|
//[Device("CalibrationConfigCollection", "多步标定配置", EnumHelper.DeviceAttributeType.OperationConfig)]
|
//public class CalibrationConfigCollection : OperationConfigBase, IHalconToolPath
|
//{
|
// [Category("交互设置")]
|
// [Description("电气触发标定动作地址,设置为1时触发标定动作")]
|
// public int TriggerAddress { get; set; }
|
|
// [Category("标定配置")]
|
// [Description("标定配置集合")]
|
// [TypeConverter(typeof(CollectionCountConvert))]
|
// [Editor(typeof(ComplexCollectionEditor<CalibrationConfig>), typeof(UITypeEditor))]
|
// public List<CalibrationConfig> Configs { get; set; } = new List<CalibrationConfig>();
|
|
// public List<string> GetHalconToolPathList()
|
// {
|
// return Configs.SelectMany(u => u.GetHalconToolPathList()).ToList();
|
// }
|
//}
|
|
|
[Device("Calibration", "标定配置", EnumHelper.DeviceAttributeType.OperationConfig)]
|
public class CalibrationConfig : OperationConfigBase, IComplexDisplay, INotifyPropertyChanged, IHalconToolPath
|
{
|
[Category("标定配置")]
|
[Description("相机操作配置")]
|
[TypeConverter(typeof(ComplexObjectConvert))]
|
[Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))]
|
public CameraOprerationConfigBase CameraOpConfig { get; set; } = new CameraOprerationConfigBase();
|
|
//[Category("标定配置")]
|
//[Description("运动平台坐标开始索引,和监听地址配合使用")]
|
//public int PlatLocationStartIndex { get; set; } = 0;
|
|
[Category("标定过程输出")]
|
[Description("标定过程输出")]
|
[TypeConverter(typeof(CollectionCountConvert))]
|
[Editor(typeof(ComplexCollectionEditor<CalibrationResult>),typeof(UITypeEditor))]
|
public List<CalibrationResult> Results { get; set; } = new List<CalibrationResult>();
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
public string GetDisplayText()
|
{
|
return JsonConvert.SerializeObject(this);
|
}
|
|
public List<string> GetHalconToolPathList()
|
{
|
return CameraOpConfig.GetHalconToolPathList();
|
}
|
}
|
|
public class CalibrationResult : IComplexDisplay, INotifyPropertyChanged
|
{
|
//private Bitmap image = null;
|
|
[JsonIgnore]
|
[Browsable(false)]
|
public Bitmap Image { get; set; }
|
//{
|
// get => image;
|
// set
|
// {
|
// image = value;
|
|
// if (value != null)
|
// {
|
// PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Image"));
|
// }
|
// }
|
//}
|
|
[Category("视觉信息")]
|
[Description("离线图片路径")]
|
[Editor(typeof(FileDialogEditor), typeof(UITypeEditor))]
|
public string OfflineImagePath { get; set; }
|
|
private CustomizedPoint imageMarkPoint = new CustomizedPoint();
|
[Category("视觉信息")]
|
[Description("图像标准点坐标")]
|
[TypeConverter(typeof(ComplexObjectConvert))]
|
[Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))]
|
public CustomizedPoint ImageMarkPoint
|
{
|
get => imageMarkPoint;
|
set
|
{
|
if (imageMarkPoint != value)
|
{
|
imageMarkPoint = value;
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ImageMarkPoint"));
|
}
|
}
|
}
|
|
[Category("运动平台设置")]
|
[Description("平台当前坐标")]
|
[TypeConverter(typeof(ComplexObjectConvert))]
|
[Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))]
|
public CustomizedPoint CurrentPlatPoint { get; set; } = new CustomizedPoint();
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
public string GetDisplayText()
|
{
|
return $"U:{ImageMarkPoint.X} V:{ImageMarkPoint.Y} X:{CurrentPlatPoint.X} Y:{CurrentPlatPoint.Y}";
|
}
|
}
|
}
|