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 A032.Process.Calibration { [Device("CalibrationCollection", "多步标定配置", EnumHelper.DeviceAttributeType.OperationConfig)] public class CalibrationConfigCollection : OperationConfigBase, IComplexDisplay,IHalconToolPath { [Category("关联配置")] [Description("位置序号")] [TypeConverter(typeof(PositionCodeConverter))] public string PositionCode { get; set; } [Category("关联配置")] [Description("适用相机编号")] [TypeConverter(typeof(CameraDeviceConverter))] public string CameraId { get; set; } [Category("标定配置")] [Description("标定配置集合")] [TypeConverter(typeof(CollectionCountConvert))] [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] public List Configs { get; set; } = new List(); [Category("显示配置")] [Description("是否显示UI,从UI启动标定")] public bool IsStartedFromUI { get; set; } = false; public string GetDisplayText() { return $"PositionNo:{PositionCode}; Configs:{Configs.Count}"; } public List GetHalconToolPathList() { return Configs.SelectMany(c => c.GetHalconToolPathList()).ToList(); } } //[Device("Calibration", "单步标定配置", EnumHelper.DeviceAttributeType.OperationConfig)] public class CalibrationConfig : OperationConfigBase, IComplexDisplay, INotifyPropertyChanged, IHalconToolPath { private Bitmap image = null; [JsonIgnore] [Browsable(false)] public Bitmap Image { get => image; set { image = value; if (value != null) { //PropertyChanged?.BeginInvoke(this, new PropertyChangedEventArgs("Image"), null, null); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Image")); } } } [Category("视觉信息")] [Description("离线图片路径")] [Editor(typeof(FileDialogEditor), typeof(UITypeEditor))] public string OfflineImagePath { get; set; } [Category("视觉信息")] [Description("图像标准点坐标")] [TypeConverter(typeof(ComplexObjectConvert))] [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] public CustomizedPointWithAngle ImageMarkPoint { get; set; } = new CustomizedPointWithAngle(); [Category("相机配置")] [Description("相机操作配置")] [TypeConverter(typeof(ComplexObjectConvert))] [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] public HalconRelatedCameraOprerationConfigBase CameraOpConfig { get; set; } = new HalconRelatedCameraOprerationConfigBase(); //[Category("运动平台设置")] //[Description("平台当前坐标")] //[TypeConverter(typeof(ComplexObjectConvert))] //[Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] //public CustomizedPoint CurrentPlatPoint { get; set; } = new CustomizedPoint(); [Category("运动平台设置")] [Description("机器人运动坐标")] [TypeConverter(typeof(ComplexObjectConvert))] [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] public RobotPoint PlatPoint { get; set; } = new RobotPoint(); public event PropertyChangedEventHandler PropertyChanged; public string GetDisplayText() { return JsonConvert.SerializeObject(this); } public List GetHalconToolPathList() { return CameraOpConfig.GetHalconToolPathList(); } } }