Common.cs 1.2 KB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Asa.Camera
{
    public class Common
    {
        public static VisionLib visionLib;
    }

    public class CameraRegion
    {
        public string CameraName { set; get; } = "";
        public string RegionName { set; get; } = "";
        public int X { set; get; } = 0;
        public int Y { set; get; } = 0;
        public int Width { set; get; } = 0;
        public int Height { set; get; } = 0;
        public float Ratio { set; get; } = 0;

        public override string ToString()
        {
            string s = string.Format("{0} X:{1} Y:{2} W:{3} H:{4} R:{5}", RegionName, X, Y, Width, Height, Ratio);
            return s;
        }

        public CameraRegion Clone()
        {
            CameraRegion node = new();
            System.Reflection.PropertyInfo[] info1 = node.GetType().GetProperties();
            System.Reflection.PropertyInfo[] info2 = GetType().GetProperties();
            for (int i = 0; i < info1.Length; i++)
                info1[i].SetValue(node, info2[i].GetValue(this));
            return node;
        }
    }
}