using System;
using System.Collections.Generic;
using System.ComponentModel;
using PropertyGridLib.Attributes;
using PropertyGridLib.Controls;
using TeamAAS.FlowEditor.Plugins;
using TeamAAS.FlowEngine.FormulaData;
namespace Plugins.Halcon.Models
{
///
/// HALCON 图像显示节点模型:把上游 HALCON 节点的图像/区域显示到主页指定画面框(视觉窗体),
/// 每个显示项可独立链接 OK/NG 结果驱动画面框状态圆点。镜像 VppDisplayModel,但对象为 HALCON HObject。
///
[Serializable]
public class HalconDisplayModel : BasePluginModel
{
[Category("属性")]
[DisplayName("1.显示项列表")]
[Description("配置图像到画面框的显示映射,可添加多条;每项可独立链接叠加区域与 OK/NG(可不链接)")]
[CollectionEditor(CanAdd = true, CanRemove = true, CanSort = true)]
public List DisplayItems { get; set; } = new List();
}
[Serializable]
public class HalconDisplayItem
{
/// 目标画面序号(实际存储值,运行按 halconWindow[FrameNo-1] 取窗体)。
[Browsable(false)]
public int FrameNo { get; set; } = 1;
/// 目标画面名称(属性网格显示/选择):来自当前产品「画面列表」,选择时映射为序号存入 FrameNo。
[DisplayName("1.目标画面")]
[Category("属性")]
[Description("从当前产品的画面列表中选择目标画面,按名称选择、内部存储对应序号")]
[TypeConverter(typeof(Plugins.Halcon.Core.HalconFrameNameConverter))]
[Newtonsoft.Json.JsonIgnore]
public string FrameName
{
get => Plugins.Halcon.Core.HalconFrameNameConverter.GetFrameName(
Plugins.Halcon.Core.HalconFrameNameConverter.GetFrames(), FrameNo);
set
{
int no = Plugins.Halcon.Core.HalconFrameNameConverter.ResolveFrameNo(value);
if (no >= 1) FrameNo = no;
}
}
[DisplayName("2.链接图像")]
[Category("属性")]
[Description("链接上游图像输出(HALCON HObject 图像,或主流程 &{输入.图像} 的 GenImage)")]
[FormulaEditor(typeof(PluginDataProvider))]
public FormulaBound