using Bro.Common.Base;
|
using Bro.Common.Helper;
|
using Bro.Common.Model;
|
using Bro.Common.Model.Interface;
|
using Newtonsoft.Json;
|
using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Drawing;
|
using System.Drawing.Design;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace Bro.Common.Calibration
|
{
|
[Device("CalibrationDynamic9Point", "动态9点标定配置", EnumHelper.DeviceAttributeType.OperationConfig)]
|
public class CalibrationDynamic9PointConfig : OperationConfigBase, IHalconToolPath
|
{
|
[Category("交互设置")]
|
[Description("电气触发标定动作地址,设置为1时触发标定动作。实际地址。")]
|
public int TriggerAddress { get; set; }
|
|
[Category("交互设置")]
|
[Description("平台位置数据在监视数据中起始地址索引,XY坐标,连续4位。从0开始。")]
|
public int LocationStartAddressIndex { get; set; }
|
|
[Category("标定结果")]
|
[Description("标定结果集合")]
|
[TypeConverter(typeof(CollectionCountConvert))]
|
[Editor(typeof(ComplexCollectionEditor<CalibrationResult>), typeof(UITypeEditor))]
|
public NoticedList<CalibrationResult> Results { get; set; } = new NoticedList<CalibrationResult>();
|
|
[Category("标定配置")]
|
[Description("标定步骤总数,一般9次")]
|
public int TotalSteps { get; set; } = 9;
|
|
[Category("标定配置")]
|
[Description("相机操作配置")]
|
[TypeConverter(typeof(ComplexObjectConvert))]
|
[Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))]
|
public CameraOprerationConfigBase CameraOpConfig { get; set; } = new CameraOprerationConfigBase();
|
|
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("图像点位|平台点位")]
|
[TypeConverter(typeof(ComplexObjectConvert))]
|
[Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))]
|
public CalibrationPoint PointResult { get; set; } = new CalibrationPoint();
|
|
[Category("标定结果")]
|
[Description("步骤序号,从1开始")]
|
public int StepNum { get; set; } = 1;
|
|
private bool isDone = false;
|
[JsonIgnore]
|
[Browsable(false)]
|
public bool IsDone
|
{
|
get => isDone;
|
set
|
{
|
isDone = value;
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("IsDone"));
|
}
|
}
|
|
[JsonIgnore]
|
[Browsable(false)]
|
public CustomizedPoint ImagePoint
|
{
|
set
|
{
|
PointResult.U = value.X;
|
PointResult.V = value.Y;
|
}
|
}
|
|
[JsonIgnore]
|
[Browsable(false)]
|
public CustomizedPoint PlatPoint
|
{
|
set
|
{
|
PointResult.X = value.X;
|
PointResult.Y = value.Y;
|
}
|
}
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
public string GetDisplayText()
|
{
|
return $"{StepNum}:{(IsDone == false ? "未完成" : ($"{PointResult.GetDisplayText()}"))}";
|
//return $"{StepNum}:{PointResult.GetDisplayText()}";
|
}
|
}
|
}
|