using Autofac;
|
using Bro.Common.Base;
|
using Bro.Common.Helper;
|
using Bro.Common.Interface;
|
using Bro.Common.Model;
|
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.M071.Process
|
{
|
public class KeyAlgorithem : IComplexDisplay
|
{
|
[Browsable(false)]
|
public string Id { get; set; } = Guid.NewGuid().ToString();
|
|
[Category("单键算法配置")]
|
[Description("算法名称")]
|
public string Name { get; set; }
|
|
[Category("单键算法配置")]
|
[Description("算法路径")]
|
[Editor(typeof(FileDialogEditor), typeof(UITypeEditor))]
|
public string AlgorithemPath { get; set; }
|
|
public string GetDisplayText()
|
{
|
return $"{Name} -- {AlgorithemPath}";
|
}
|
}
|
|
public class KeyResult : IComplexDisplay
|
{
|
[Browsable(false)]
|
public string Id { get; set; } = Guid.NewGuid().ToString();
|
|
[Category("单键结果配置")]
|
[Description("结果配置名称")]
|
public string Name { get; set; }
|
|
[Category("单键结果配置")]
|
[Description("结果配置集合")]
|
[TypeConverter(typeof(SimpleCollectionConvert<string>))]
|
[Editor(typeof(SimpleCollectionEditor<string>), typeof(UITypeEditor))]
|
public List<string> Results { get; set; } = new List<string>();
|
|
public string GetDisplayText()
|
{
|
return $"{Name} -- {(string.Join(" ", Results))}";
|
}
|
}
|
|
public class SnapshotPoint : IComplexDisplay, IHalconToolPath
|
{
|
public string GetDisplayText()
|
{
|
return Name + " " + string.Join(" ", Destination.Select(u => u.GetDisplayText())) + " " + CameraOp.GetDisplayText();
|
}
|
|
public List<string> GetHalconToolPathList()
|
{
|
if (CameraOp.OpConfig is IHalconToolPath path)
|
{
|
return path.GetHalconToolPathList();
|
}
|
else
|
{
|
return new List<string>();
|
}
|
}
|
|
[Browsable(false)]
|
public string Id { get; set; } = Guid.NewGuid().ToString();
|
|
[Category("拍照点名称")]
|
[Description("拍照点名称")]
|
public string Name { get; set; }
|
|
[Category("设备配置")]
|
[Description("运动设备")]
|
[TypeConverter(typeof(DeviceSelectorConverter<IMotion>))]
|
public string MotionDevice { get; set; }
|
|
[Category("运动点位")]
|
[Description("运动点位")]
|
[TypeConverter(typeof(ComplexObjectConvert))]
|
[Editor(typeof(ComplexCollectionEditor<AxisInfo>), typeof(UITypeEditor))]
|
public List<AxisInfo> Destination { get; set; } = new List<AxisInfo>();
|
|
[Category("相机和操作配置")]
|
[Description("相机和操作配置")]
|
[TypeConverter(typeof(ComplexObjectConvert))]
|
[Editor(typeof(IOperationConfigByDeviceEditor), typeof(UITypeEditor))]
|
public DeviceOpBind CameraOp { get; set; } = new DeviceOpBind();
|
}
|
|
public class KeyUnit : IComplexDisplay, IHalconToolPath
|
{
|
private string key = "";
|
[Category("键名配置")]
|
[Description("单键检测键名")]
|
[TypeConverter(typeof(KeyNameDictConverter))]
|
public string Key
|
{
|
get => key;
|
set
|
{
|
AlignName = key = value;
|
}
|
}
|
|
[Category("键名配置")]
|
[Description("别名")]
|
public string AlignName { get; set; }
|
|
[Category("图像来源")]
|
[Description("拍照点位")]
|
[TypeConverter(typeof(SnapshotPointConverter))]
|
public string SnapshotPoint { get; set; }
|
|
[Category("图像来源")]
|
[Description("拍照点位获取的图片索引")]
|
public int ImageIndex { get; set; } = 0;
|
|
[Category("算法配置")]
|
[Description("单键检测配置算法类型")]
|
[TypeConverter(typeof(KeyAlgorithemConverter))]
|
public string KeyAlgorithem { get; set; }
|
|
[Category("算法配置")]
|
[Description("单键检测配置结果类型")]
|
[TypeConverter(typeof(KeyResultConverter))]
|
public string KeyResult { get; set; }
|
|
public string GetDisplayText()
|
{
|
return $"{AlignName}";
|
}
|
|
public List<string> GetHalconToolPathList()
|
{
|
return null;
|
}
|
}
|
|
public class MeasurementUint : IComplexDisplay
|
{
|
[Category("名称")]
|
[Description("名称")]
|
public string Name { get; set; } = "";
|
|
[Category("算法配置")]
|
[Description("检测和标准类型")]
|
[TypeConverter(typeof(MeasureTypeConverter))]
|
public string MeasureType { get; set; }
|
|
[Category("算法配置")]
|
[Description("涉及单键集合")]
|
[TypeConverter(typeof(ComplexObjectConvert))]
|
[Editor(typeof(ComplexCollectionEditor<KeyUnitBind>), typeof(UITypeEditor))]
|
public List<KeyUnitBind> KeyUnitCollection { get; set; } = new List<KeyUnitBind>();
|
|
[Browsable(false)]
|
public RectangleF DisplayLocation { get; set; } = new RectangleF();
|
|
public string GetDisplayText()
|
{
|
if (string.IsNullOrWhiteSpace(Name))
|
{
|
return string.Join("-", KeyUnitCollection.Select(u => u.GetDisplayText())) + "-" + MeasureType.ToString();
|
}
|
else
|
{
|
return Name;
|
}
|
}
|
}
|
|
public class KeyUnitBind : IComplexDisplay
|
{
|
[Category("单键配置")]
|
[Description("单键配置")]
|
[TypeConverter(typeof(KeyNameDictConverter))]
|
public string Key { get; set; }
|
|
[Category("单键配置")]
|
[Description("单键结果配置")]
|
[TypeConverter(typeof(KeyUnitResultConverter))]
|
public string KeyResult { get; set; } = "";
|
|
public string GetDisplayText()
|
{
|
string msg = Key;
|
|
msg += string.IsNullOrWhiteSpace(KeyResult) ? "" : $"-{KeyResult}";
|
|
return msg;
|
}
|
}
|
}
|