using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;

namespace Project
{

	public class ModelInfoV
	{
		[Browsable(false)]
		public string SPN { get; set; }
		//[Browsable(false)]
		//public Boolean SplitSPN { get; set; }
		[Browsable(false)]
		public string Title { get; set; }
		[Browsable(false)]
		public string Code { get; set; }
		[Browsable(false)]
		public int idx { get; set; }


		public string Motion { get; set; }
		public Boolean BCD_1D { get; set; }
		public Boolean BCD_QR { get; set; }
		public Boolean BCD_DM { get; set; }

		public UInt16 vOption { get; set; }
        public UInt16 vWMSInfo { get; set; }
		public UInt16 vSIDInfo { get; set; }
		public UInt16 vJobInfo { get; set; }
		public UInt16 vSIDConv1 { get; set; }

		public string Def_Vname { get; set; }
		public string Def_MFG { get; set; }

		public Boolean IgnoreOtherBarcode { get; set; }
        public bool DisableCamera { get; set; }
        public bool DisablePrinter { get; set; }
        public bool CheckSIDExsit { get; set; }
        public bool bOwnZPL { get; set; }
		public int BSave { get; set; }
        public bool IgnorePartNo { get; set; }
        public bool IgnoreBatch { get; set; }
        public int AutoOutConveyor { get; set; }


        public ModelInfoV()
		{
			vOption =  vWMSInfo = vSIDInfo = vJobInfo = vSIDConv1 = 0;
			bOwnZPL = false;
		}

		public void ReadValue(DataSet1.OPModelRow dr)
		{
            this.AutoOutConveyor= dr.AutoOutConveyor;
			this.bOwnZPL = dr.bOwnZPL;
			this.Title = dr.Title;
			this.Code = dr.Code;
			this.idx = dr.idx;
			this.Motion = dr.Motion;
			this.BCD_1D = dr.BCD_1D;
			this.BCD_QR = dr.BCD_QR;
			this.BCD_DM = dr.BCD_DM;
			this.vOption = dr.vOption;
			this.vJobInfo = dr.vJobInfo;
            this.vWMSInfo = dr.vWMSInfo;
			this.vSIDInfo = dr.vSIDInfo;
			this.vSIDConv1 = dr.vSIDConv;
			this.Def_MFG = dr.Def_MFG;
			this.Def_Vname = dr.Def_VName;
			this.IgnoreOtherBarcode = dr.IgnoreOtherBarcode;
            this.DisableCamera = dr.DisableCamera;
            this.DisablePrinter = dr.DisablePrinter;
            this.CheckSIDExsit = dr.CheckSIDExsit;
			this.BSave = dr.BSave;
            this.IgnoreBatch = dr.IgnoreBatch;
            this.IgnorePartNo = dr.IgnorePartNo;
        }
	}

	[TypeConverterAttribute(typeof(ExpandableObjectConverter))]
	public class RoiOffset
	{
		[DisplayName("Horizon"), Description("Vertical (Y-axis) change value (+ is downward, - is upward)")]
		public double Y { get; set; }
		[DisplayName("Vertical"), Description("Horizontal (X-axis) change value (+ is right, - is left)")]
		public double X { get; set; }
		[Browsable(false)]
		public bool IsEmpty { get { if (Y == 0 && X == 0) return true; else return false; } }

		public RoiOffset(double start = 0.0, double end = 0.0)
		{
			this.Y = start;
			this.X = end;
		}
		public override string ToString()
		{
			return string.Format("{0},{1}", Y, X);
		}
		public string toPointStr()
		{
			return string.Format("{0};{1}", Y, X);
		}
	}


	[TypeConverterAttribute(typeof(ExpandableObjectConverter))]
	public class Range
	{
		[DisplayName("Start Value")]
		public uint Start { get; set; }
		[DisplayName("End Value")]
		public uint End { get; set; }
		[Browsable(false)]
		public bool IsEmpty { get { if (Start == 0 && End == 0) return true; else return false; } }

		public Range(UInt16 start, UInt16 end) : this((uint)start, (uint)end) { }
		public Range(uint start = 0, uint end = 0)
		{
			this.Start = start;
			this.End = end;
		}
		public static implicit operator RangeF(Range p)
		{
			return new RangeF((float)p.Start, (float)p.End);
		}
		public override string ToString()
		{
			return string.Format("{0}~{1}", Start, End);
		}
	}
	[TypeConverterAttribute(typeof(ExpandableObjectConverter))]
	public class RangeF
	{
		[DisplayName("Start Value")]
		public float Start { get; set; }
		[DisplayName("End Value")]
		public float End { get; set; }
		[Browsable(false)]
		public bool IsEmpty { get { if (Start == 0f && End == 0f) return true; else return false; } }
		public RangeF(float start = 0f, float end = 0f)
		{
			this.Start = start;
			this.End = end;
		}
		public static implicit operator Range(RangeF p)
		{
			return new Range((uint)p.Start, (uint)p.End);
		}
		public override string ToString()
		{
			return string.Format("{0}~{1}", Start, End);
		}
	}

	[TypeConverterAttribute(typeof(ExpandableObjectConverter))]
	public class CVisionProcess
	{

		[Category("Special Settings (Developer)"), Description("Unused (was used for DOT recognition)")]
		public UInt16 halfKernel { get; set; }
		[Category("Special Settings (Developer)"), Description("Unused (was used for DOT recognition)")]
		public UInt16 Constant { get; set; }
		[Category("Special Settings (Developer)"), DisplayName("MP_Dilate"), Description("Unused (was used for DOT recognition)")]
		public UInt16 dilate { get; set; }
		[Category("Special Settings (Developer)"), DisplayName("MP_Erode"), Description("Unused (was used for DOT recognition)")]
		public UInt16 erode { get; set; }
		[Category("Special Settings (Developer)"), DisplayName("MP_Open"), Description("Unused (was used for DOT recognition)")]
		public UInt16 open { get; set; }
		[Category("Special Settings (Developer)"), DisplayName("MP_Open"), Description("Unused (was used for DOT recognition)")]
		public UInt32 segment_threshold { get; set; }
		[Category("Special Settings (Developer)"), DisplayName("MP_Open"), Description("Unused (was used for DOT recognition)")]
		public Boolean isBlack { get; set; }
		[Category("Special Settings (Developer)"), DisplayName("MP_Open"), Description("Unused (was used for DOT recognition)")]
		public UInt32 judg_runcount { get; set; }


		[Category("Unit Detection"), DisplayName("Brightness Threshold"), Description("Collects data above the entered value. The lower this value, the higher the detection value. Detection is determined by the value detected with this threshold. Since units are determined by looking at bright data, data above this threshold is detected")]
		public byte detect_threhosld { get; set; }
		[Category("Unit Detection"), DisplayName("Detection Threshold"), Description("This is the threshold value for detection. If the value detected due to the brightness threshold is 5000, and the value entered in this detection threshold is greater than 5000, it is determined that a unit exists. When it is lower, it is detected as an 'Empty' unit with no unit")]
		public UInt16 detect_count { get; set; }
		[Category("Unit Detection"), DisplayName("*Exception Area Detection Threshold"), Description("When an empty unit (=Empty), if light reflection from the shuttle frame is severe, the unit is detected by the reflection value. This value is used to remove such data, and in addition to the white area values used for unit detection, black blob detection is performed. If a black blob within the set value range is detected, it is detected as an 'Empty' unit")]
		public Point detect_blobrange { get; set; }

		[Category("2D Detection"), DisplayName("Brightness Threshold"), Description("Collects data below the entered value. The lower this value, the lower the detection value. Detection is determined by the value detected with this threshold. Since 2D codes are determined by looking at dark data, data below this threshold is detected")]
		public byte detectDM_threhosld { get; set; }
		[Category("2D Detection"), DisplayName("Detection Threshold"), Description("This is the threshold value for detection. If the value detected due to the brightness threshold is 5000, and the value entered in this detection threshold is greater than 5000, it is determined that an ID exists. When it is lower, it is detected as a 'New' unit with no ID")]
		public UInt16 detectDM_count { get; set; }

		public CVisionProcess()
		{

		}
		public override string ToString()
		{
			return "Vision Settings";
		}
	}

}
