using MaiMuAOI.SysCtrl; using MaiMuAOI.SysUI.StepUI.PropExtend; using Newtonsoft.Json; using OpenCvSharp; using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MaiMuAOI.SysUI.ProcessStep.Prop { public class MarkProp { [PropertyOrder(1), Browsable(true), Category("1 算法"), DisplayName("1.1 引擎文件名"), Description("图像处理算法引擎文件名")] public string EngineName { get; set; } [PropertyOrder(11), Browsable(true), Category("2 Mark"), DisplayName("2.1 Mark类型"), Description("流程找Mark的类型位置")] public MarkCam MarkType { get; set; } [PropertyOrder(12), Browsable(true), Category("2 Mark"), DisplayName("2.2 Mark数量"), Description("流程找Mark的数量")] public int MarkCnt { get; set; } [PropertyOrder(13), Browsable(true), Category("2 Mark"), DisplayName("2.3 自动寻找Mark"), Description("根据产品设置和图纸自动寻找Mark(True-是;False-否)")] public bool AutoMark { get; set; } [PropertyOrder(14), Browsable(true), Category("2 Mark"), DisplayName("2.4 手动Mark位置列表"), Description("当自动寻找Mark False时,需要手动输入Mark点位")] public List Points { get; set; } [PropertyOrder(21), Browsable(true), Category("3 相机"), DisplayName("3.1 曝光"), Description("曝光时长(us)")] public float ExposureTime { get; set; } [PropertyOrder(22), Browsable(true), Category("3 相机"), DisplayName("3.2 增益"), Description("增益")] public float Gain { get; set; } [PropertyOrder(31), Browsable(true), Category("4 动作"), DisplayName("4.1 起始速度(mm/s)"), Description("起始速度")] public double VelLow { get; set; } [PropertyOrder(32), Browsable(true), Category("4 动作"), DisplayName("4.2 运行速度(mm/s)"), Description("运行速度")] public double VelHigh { get; set; } [PropertyOrder(33), Browsable(true), Category("4 动作"), DisplayName("4.3 加速度(mm/s)"), Description("加速度")] public double Acc { get; set; } [PropertyOrder(34), Browsable(true), Category("4 动作"), DisplayName("4.4 减速度(mm/s)"), Description("减速度")] public double Dec { get; set; } [PropertyOrder(35), Browsable(true), Category("4 动作"), DisplayName("4.5 等待稳定时间(ms)"), Description("到位等待稳定时间")] public int WaitTime { get; set; } [PropertyOrder(41), Browsable(true), Category("5 控制"), DisplayName("5.1 禁用工序"), Description("禁用本工序(True-是;False-否)")] public bool Disable { get; set; } public MarkProp() { EngineName = "My_PI_PT_General"; MarkType = MarkCam.尺寸检测Mark; MarkCnt = 4; AutoMark = true; Points = new List(); ExposureTime = 30000; Gain = 0; VelLow = 0; VelHigh = 100; Acc = 200; Dec = 200; WaitTime = 50; Disable = false; } /// /// 序列化 /// /// /// public string serialize() { return JsonConvert.SerializeObject(this); } /// /// 反序列化 /// /// /// public void deserialize(string json) { var o = JsonConvert.DeserializeObject(json); Type type = o.GetType(); System.Reflection.PropertyInfo[] properties = type.GetProperties(); foreach (System.Reflection.PropertyInfo property in properties) { string name = property.Name; if (!type.GetProperty(name).IsDefined(typeof(JsonIgnoreAttribute), true)) { var value = property.GetValue(o); this.GetType().GetProperty(name).SetValue(this, value); } } } } }