using System;
namespace TeamAAS.FlowEditor.Plugins
{
///
/// 插件分类(工具箱分组用)
///
public enum PluginCategory
{
视觉模块 = 0,
硬件模块 = 1,
通讯模块 = 2,
Mes模块 = 3,
逻辑判断 = 4,
深度学习 = 5,
文件操作 = 6,
Vpp模块 = 7,
Vm模块 = 8,
Halocn模块 = 9,
OpenCv模块 = 10,
三维视觉 = 11,
其他 = 100
}
public enum VisionPlugin
{
图像处理 = 1,
检测识别 = 2,
几何测量 = 3,
坐标标定 = 5,
深度学习 = 6,
三维视觉 = 7,
其他 = 100
}
///
/// 插件特性 - 声明插件的名称、分类、模型、视图、图标
/// 参照 VisionKit 的 ViewsBindName 特性
///
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
public class PluginAttribute : Attribute
{
/// 插件显示名称(工具箱和节点标题)
public string DisplayName { get; }
/// 插件分类(工具箱分组)
public PluginCategory Category { get; }
/// 插件模型类型
public Type ModelType { get; }
/// 自定义视图类型(null=使用PropertyGrid编辑器)
public Type ViewType { get; }
/// 图标Geometry路径字符串
public string IconGeometry { get; }
/// 节点形状(决定编辑器中的外观)
public Models.NodeCategory NodeShape { get; set; } = Models.NodeCategory.Normal;
/// 插件描述
public string Description { get; set; } = "";
///
/// 是否为「子流程专用节点」。true=该节点只在对应子流程编辑器(如 Halcon 流程)的工具箱中出现,
/// 不会进入主流程工具箱;默认 false=普通主流程节点(保持既有行为不变)。
/// 仅影响工具箱过滤,不影响插件注册/创建/执行。
///
public bool IsSubFlowNode { get; set; } = false;
///
/// 子流程工具箱的分组类别( 枚举)。仅当 =true 时用于分组,
/// 例如 Halcon 流程编辑器按 图像处理/检测识别/几何测量… 归类节点。默认 其他。
///
public VisionPlugin VisionCategory { get; set; } = VisionPlugin.其他;
///
/// 构造函数(无自定义视图,使用PropertyGrid编辑器)
///
public PluginAttribute(string displayName, PluginCategory category, Type modelType, string iconGeometry = "M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z")
{
DisplayName = displayName;
Category = category;
ModelType = modelType;
IconGeometry = iconGeometry;
ViewType = null;
}
///
/// 构造函数(有自定义视图,双击弹插件自己的窗体)
///
public PluginAttribute(string displayName, PluginCategory category, Type modelType, Type viewType, string iconGeometry = "M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z")
{
DisplayName = displayName;
Category = category;
ModelType = modelType;
ViewType = viewType;
IconGeometry = iconGeometry;
}
}
}