using MwFramework.Controls.UIControl;
using MwFramework.ManagerService;
using Stylet;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MainShell.DeviceMaintance.Model
{
    [Export(typeof(IParameter))]
    public class NeedleCalibrationSetting : ParameterBase
    {
        public NeedleZCalibrationItem NeedleZCalibrationItem { get; set; } = new NeedleZCalibrationItem();

        public NeedleXYCalibrationItem NeedleXYCalibrationItem { get; set; } = new NeedleXYCalibrationItem();

        public NeedleXYCalibrationItemNew NeedleXYCalibrationItemNew { get; set; } = new NeedleXYCalibrationItemNew();

        public override void Copy(IParameter source)
        {
            NeedleCalibrationSetting setting = source as NeedleCalibrationSetting;
            if (setting != null)
            {
                ReflectionExtension.Copy<NeedleZCalibrationItem>(NeedleZCalibrationItem, setting.NeedleZCalibrationItem);
                ReflectionExtension.Copy<NeedleXYCalibrationItem>(NeedleXYCalibrationItem, setting.NeedleXYCalibrationItem);
                ReflectionExtension.Copy<NeedleXYCalibrationItemNew>(NeedleXYCalibrationItemNew, setting.NeedleXYCalibrationItemNew);
            }
        }
    }

    public class NeedleZCalibrationItem : PropertyChangedBase, IParameterItem
    {

        private double _supportPinPositionX;
        [WatchValue("针尖对准对刀仪X1位置")]
        public double SupportPinPositionX
        {
            get { return _supportPinPositionX; }
            set { if (_supportPinPositionX != value) { _supportPinPositionX = value; OnPropertyChanged(nameof(SupportPinPositionX)); } }
        }

        private double _supportPinPositionY;
        [WatchValue("针尖对准对刀仪Y1位置")]
        public double SupportPinPositionY
        {
            get { return _supportPinPositionY; }
            set { if (_supportPinPositionY != value) { _supportPinPositionY = value; OnPropertyChanged(nameof(SupportPinPositionY)); } }
        }

        private double _knifeOffset;
        [WatchValue("对刀仪偏差")]
        /// <summary>
        /// 对刀仪偏差
        /// </summary>
        public double KnifeOffset
        {
            get { return _knifeOffset; }
            set { if (_knifeOffset != value) { _knifeOffset = value; OnPropertyChanged(nameof(KnifeOffset)); } }
        }

        private double _cZHeight = -0.725;
        [WatchValue("SZ高度")]
        public double CZHeight
        {
            get { return _cZHeight; }
            set { if (_cZHeight != value) { _cZHeight = value; OnPropertyChanged(nameof(CZHeight)); } }
        }

        private double _stageHeight;
        [WatchValue("载台高度")]
        public double StageHeight
        {
            get { return _stageHeight; }
            set { if (_stageHeight != value) { _stageHeight = value; OnPropertyChanged(nameof(StageHeight)); } }
        }

        private double _gantry2AvoidPositionX = 10;
        [WatchValue("对刀时龙门X2的避让位置")]
        public double Gantry2AvoidPositionX
        {
            get { return _gantry2AvoidPositionX; }
            set { if (_gantry2AvoidPositionX != value) { _gantry2AvoidPositionX = value; OnPropertyChanged(nameof(Gantry2AvoidPositionX)); } }
        }
        private double _gantry2AvoidPositionY = 200;
        [WatchValue("对刀时龙门Y2的避让位置")]
        public double Gantry2AvoidPositionY
        {
            get { return _gantry2AvoidPositionY; }
            set { if (_gantry2AvoidPositionY != value) { _gantry2AvoidPositionY = value; OnPropertyChanged(nameof(Gantry2AvoidPositionY)); } }
        }
        private double _z1StartPosition;
        [WatchValue("Z1开始位置")]
        public double Z1StartPosition
        {
            get { return _z1StartPosition; }
            set { if (_z1StartPosition != value) { _z1StartPosition = value; OnPropertyChanged(nameof(Z1StartPosition)); } }
        }

        private double _z1Speed;
        [WatchValue("Z1速度")]
        public double Z1Speed
        {
            get { return _z1Speed; }
            set { if (_z1Speed != value) { _z1Speed = value; OnPropertyChanged(nameof(Z1Speed)); } }
        }

        private double _z1DropMaxPosition;
        [WatchValue("Z1下降距离")]
        public double Z1DropMaxPosition
        {
            get { return _z1DropMaxPosition; }
            set { if (_z1DropMaxPosition != value) { _z1DropMaxPosition = value; OnPropertyChanged(nameof(Z1DropMaxPosition)); } }
        }

        private int _needleTouchCount = 1;
        [WatchValue("对刀次数")]
        public int NeedleTouchCount
        {
            get { return _needleTouchCount; }
            set { if (_needleTouchCount != value) { _needleTouchCount = value; OnPropertyChanged(nameof(NeedleTouchCount)); } }
        }

        private double _needleTouchHeight = 14;

        /// <summary>
        /// Z1接触对刀仪高度
        /// </summary>
        [WatchValue("Z1接触对刀仪高度")]
        public double NeedleTouchHeight
        {
            get { return _needleTouchHeight; }
            set { if (_needleTouchHeight != value) { _needleTouchHeight = value; OnPropertyChanged(nameof(NeedleTouchHeight)); } }
        }

        private double _needleTouchHeightBase;

        /// <summary>
        /// 基准值
        /// </summary>
        [WatchValue("基准值")]
        public double NeedleTouchHeightBase
        {
            get { return _needleTouchHeightBase; }
            set { if (_needleTouchHeightBase != value) { _needleTouchHeightBase = value; OnPropertyChanged(nameof(NeedleTouchHeightBase)); } }
        }

        private double _currentNeedleTouchHeight;
        [WatchValue("当前使用对刀高度")]
        /// <summary>
        /// 当前使用对刀高度
        /// </summary>
        public double CurrentNeedleTouchHeight
        {
            get { return _currentNeedleTouchHeight; }
            set { if (_currentNeedleTouchHeight != value) { _currentNeedleTouchHeight = value; OnPropertyChanged(nameof(CurrentNeedleTouchHeight)); } }
        }

        private double _needleTouchOffset;
        [WatchValue("对刀与基准偏差")]
        /// <summary>
        /// 对刀与基准偏差
        /// </summary>
        public double NeedleTouchOffset
        {
            get { return _needleTouchOffset; }
            set { if (_needleTouchOffset != value) { _needleTouchOffset = value; OnPropertyChanged(nameof(NeedleTouchOffset)); } }
        }

        private double _needleTouchHeightAve;
        [WatchValue("Z1对刀平均高度")]
        /// <summary>
        /// Z1对刀平均高度
        /// </summary>
        public double NeedleTouchHeightAve
        {
            get { return _needleTouchHeightAve; }
            set { if (_needleTouchHeightAve != value) { _needleTouchHeightAve = value; OnPropertyChanged(nameof(NeedleTouchHeightAve)); } }
        }

        private ObservableCollection<NeedleTouchRecord> _needleTouchRecords = new ObservableCollection<NeedleTouchRecord>();

        public ObservableCollection<NeedleTouchRecord> NeedleTouchRecords
        {
            get { return _needleTouchRecords; }
            set
            {
                _needleTouchRecords = value;
                OnPropertyChanged(nameof(NeedleTouchRecords));
            }
        }

        private double _laserToNeedleOffset = 0;
        public double LaserToNeedleOffset
        {
            get { return _laserToNeedleOffset; }
            set { if (_laserToNeedleOffset != value) { _laserToNeedleOffset = value; OnPropertyChanged(nameof(LaserToNeedleOffset)); } }
        }

        private double _needleCameraHeightOffset;
        public double NeedleCameraHeightOffset
        {
            get { return _needleCameraHeightOffset; }
            set { if (_needleCameraHeightOffset != value) { _needleCameraHeightOffset = value; OnPropertyChanged(nameof(NeedleCameraHeightOffset)); } }
        }

        public IParameterItem Clone()
        {
            NeedleZCalibrationItem clone = new NeedleZCalibrationItem();
            clone.CurrentNeedleTouchHeight = _needleCameraHeightOffset;
            clone.CZHeight = CZHeight;
            clone.Gantry2AvoidPositionX = Gantry2AvoidPositionX;
            clone.Gantry2AvoidPositionY = Gantry2AvoidPositionY;
            clone.LaserToNeedleOffset = LaserToNeedleOffset;
            clone.NeedleCameraHeightOffset = NeedleCameraHeightOffset;
            clone.NeedleTouchCount = NeedleTouchCount;
            clone.NeedleTouchHeight = NeedleTouchHeight;
            clone.NeedleTouchHeightAve = NeedleTouchHeightAve;
            clone.NeedleTouchHeightBase = NeedleTouchHeightBase;
            clone.NeedleTouchOffset = NeedleTouchOffset;
            clone.StageHeight = StageHeight;
            clone.SupportPinPositionX = SupportPinPositionX;
            clone.SupportPinPositionY = SupportPinPositionY;
            clone.Z1DropMaxPosition = Z1DropMaxPosition;
            clone.Z1Speed = Z1Speed;
            clone.Z1StartPosition = Z1StartPosition;
            if (this.NeedleTouchRecords != null)
            {
                foreach (var item in this.NeedleTouchRecords)
                {
                    clone.NeedleTouchRecords.Add(item.Clone() as NeedleTouchRecord);
                }
            }
            return clone;
        }

    }

    public class NeedleXYCalibrationItem : PropertyChangedBase, IParameterItem
    {
        private double _needleX;
        [WatchValue("设置—刺晶头X")]
        public double NeedleX
        {
            get { return _needleX; }
            set { if (_needleX != value) { _needleX = value; OnPropertyChanged(nameof(NeedleX)); } }
        }

        private double _needleY;
        [WatchValue("设置—刺晶头Y")]
        public double NeedleY
        {
            get { return _needleY; }
            set { if (_needleY != value) { _needleY = value; OnPropertyChanged(nameof(NeedleY)); } }
        }

        private double _cameraX;
        [WatchValue("设置—相机X")]
        public double CameraX
        {
            get { return _cameraX; }
            set { if (_cameraX != value) { _cameraX = value; OnPropertyChanged(nameof(CameraX)); } }
        }

        private double _cameraY;
        [WatchValue("设置—相机Y")]
        public double CameraY
        {
            get { return _cameraY; }
            set { if (_cameraY != value) { _cameraY = value; OnPropertyChanged(nameof(CameraY)); } }
        }
        private double _needleZ1 = 0.0;
        [WatchValue("设置—刺晶头Z1")]
        public double NeedleZ1
        {
            get { return _needleZ1; }
            set { if (_needleZ1 != value) { _needleZ1 = value; OnPropertyChanged(nameof(NeedleZ1)); } }
        }

        private double _offsetX;
        [WatchValue("X方向偏差")]
        public double OffsetX
        {
            get { return _offsetX; }
            set { if (_offsetX != value) { _offsetX = value; OnPropertyChanged(nameof(OffsetX)); } }
        }

        private double _offsetY;
        [WatchValue("Y方向偏差")]
        public double OffsetY
        {
            get { return _offsetY; }
            set { if (_offsetY != value) { _offsetY = value; OnPropertyChanged(nameof(OffsetY)); } }
        }

        private double _initialOffsetX;
        /// <summary>
        /// 针和相机之间的X初始偏差，不加补偿
        /// </summary>
        [WatchValue("X方向初始偏差")]
        public double InitialOffsetX
        {
            get { return _initialOffsetX; }
            set { if (_initialOffsetX != value) { _initialOffsetX = value; OnPropertyChanged(nameof(InitialOffsetX)); } }
        }

        private double _initialOffsetY;
        /// <summary>
        /// 针和相机之间的Y初始偏差，不加补偿
        /// </summary>
        [WatchValue("Y方向初始偏差")]
        public double InitialOffsetY
        {
            get { return _initialOffsetY; }
            set { if (_initialOffsetY != value) { _initialOffsetY = value; OnPropertyChanged(nameof(InitialOffsetY)); } }
        }

        private double _compensateX;
        /// <summary>
        /// 针和相机之间的X方向偏差补偿
        /// </summary>
        [WatchValue("X方向补偿")]
        public double CompensateX
        {
            get { return _compensateX; }
            set { if (_compensateX != value) { _compensateX = value; OnPropertyChanged(nameof(CompensateX)); } }
        }

        private double _compensateY;
        /// <summary>
        /// 针和相机之间的Y方向偏差补偿
        /// </summary>
        [WatchValue("Y方向补偿")]
        public double CompensateY
        {
            get { return _compensateY; }
            set { if (_compensateY != value) { _compensateY = value; OnPropertyChanged(nameof(CompensateY)); } }
        }

        private double _offsetXMax;
        [WatchValue("偏差限制—X偏差最大值")]
        public double OffsetXMax
        {
            get { return _offsetXMax; }
            set { if (_offsetXMax != value) { _offsetXMax = value; OnPropertyChanged(nameof(OffsetXMax)); } }
        }

        private double _offsetXMin;
        [WatchValue("偏差限制—X偏差最小值")]
        public double OffsetXMin
        {
            get { return _offsetXMin; }
            set { if (_offsetXMin != value) { _offsetXMin = value; OnPropertyChanged(nameof(OffsetXMin)); } }
        }

        private double _offsetYMax;
        [WatchValue("偏差限制—Y偏差最大值")]
        public double OffsetYMax
        {
            get { return _offsetYMax; }
            set { if (_offsetYMax != value) { _offsetYMax = value; OnPropertyChanged(nameof(OffsetYMax)); } }
        }

        private double _offsetYMin;
        [WatchValue("偏差限制—Y偏差最小值")]
        public double OffsetYMin
        {
            get { return _offsetYMin; }
            set { if (_offsetYMin != value) { _offsetYMin = value; OnPropertyChanged(nameof(OffsetYMin)); } }
        }

        /// <summary>
        /// 扎铜箔时龙门X2避让位置
        /// </summary>
        private double _x2AvoidPosition;
        [WatchValue("扎铜箔时龙门X2避让位置")]
        public double X2AvoidPosition
        {
            get { return _x2AvoidPosition; }
            set { if (_x2AvoidPosition != value) { _x2AvoidPosition = value; OnPropertyChanged(nameof(X2AvoidPosition)); } }
        }

        /// <summary>
        /// 扎铜箔时龙门Y2避让位置
        /// </summary>
        private double _y2AvoidPosition;
        [WatchValue("扎铜箔时龙门Y2避让位置")]
        public double Y2AvoidPosition
        {
            get { return _y2AvoidPosition; }
            set { if (_y2AvoidPosition != value) { _y2AvoidPosition = value; OnPropertyChanged(nameof(Y2AvoidPosition)); } }
        }

        /// <summary>
        /// 扎铜箔时Stage的位置
        /// </summary>
        private double _stagePosition;
        [WatchValue("扎铜箔时Stage的位置")]
        public double StagePosition
        {
            get { return _stagePosition; }
            set { if (_stagePosition != value) { _stagePosition = value; OnPropertyChanged(nameof(StagePosition)); } }
        }

        public IParameterItem Clone()
        {
            NeedleXYCalibrationItem clone = new NeedleXYCalibrationItem();
            clone.NeedleX = this.NeedleX;
            clone.NeedleY = this.NeedleY;
            clone.CameraX = this.CameraY;
            clone.CameraY = this.CameraY;
            clone.OffsetX = this.OffsetX;
            clone.OffsetY = this.OffsetY;
            clone.OffsetXMax = this.OffsetXMax;
            clone.OffsetXMin = this.OffsetXMin;
            clone.OffsetYMax = this.OffsetYMax;
            clone.OffsetYMin = this.OffsetYMin;
            return this.MemberwiseClone() as IParameterItem;
        }
    }

    public class NeedleXYCalibrationItemNew : PropertyChangedBase, IParameterItem
    {
        //private VisionParData _needleVisionParData;

        //public VisionParData NeedleVisionParData
        //{
        //    get { return _needleVisionParData ?? new VisionParData() { Exposure = 2000 }; }
        //    set { SetAndNotify(ref _needleVisionParData, value); }
        //}

        private double _x1Calib;
        /// <summary>
        /// 相机标定位X1
        /// </summary>
        [WatchValue("相机标定位X1")]
        public double X1Calib
        {
            get { return _x1Calib; }
            set { if (_x1Calib != value) { _x1Calib = value; OnPropertyChanged(nameof(X1Calib)); } }
        }

        private double _x1MechanicalOffset = 0.0;
        /// <summary>
        /// 机械X1Offset
        /// </summary>
        [WatchValue("机械X1Offset")]
        public double X1MechanicalOffset
        {
            get { return _x1MechanicalOffset; }
            set { if (_x1MechanicalOffset != value) { _x1MechanicalOffset = value; OnPropertyChanged(nameof(X1MechanicalOffset)); } }
        }

        private double _wSCalibX2;
        /// <summary>
        /// 方片标定位X2
        /// </summary>
        [WatchValue("方片标定位X2")]
        public double WSCalibX2
        {
            get { return _wSCalibX2; }
            set { if (_wSCalibX2 != value) { _wSCalibX2 = value; OnPropertyChanged(nameof(WSCalibX2)); } }
        }

        private double _wSCalibY2;
        /// <summary>
        /// 方片标定位Y2
        /// </summary>
        [WatchValue("方片标定位Y2")]
        public double WSCalibY2
        {
            get { return _wSCalibY2; }
            set { if (_wSCalibY2 != value) { _wSCalibY2 = value; OnPropertyChanged(nameof(WSCalibY2)); } }
        }

        private double _needleX1;
        [WatchValue("刺晶头X1")]
        public double NeedleX1
        {
            get { return _needleX1; }
            set { if (_needleX1 != value) { _needleX1 = value; OnPropertyChanged(nameof(NeedleX1)); } }
        }

        private double _needleZ1 = 0.0;
        [WatchValue("刺晶头Z1")]
        public double NeedleZ1
        {
            get { return _needleZ1; }
            set { if (_needleZ1 != value) { _needleZ1 = value; OnPropertyChanged(nameof(NeedleZ1)); } }
        }

        private int _z1WorkTime = 0;
        /// <summary>
        /// Z1保持下扎时长
        /// </summary>
        [WatchValue("Z1保持下扎时长")]
        public int Z1WorkTime
        {
            get { return _z1WorkTime; }
            set { if (_z1WorkTime != value) { _z1WorkTime = value; OnPropertyChanged(nameof(Z1WorkTime)); } }
        }

        private double _offsetX;
        /// <summary>
        /// 针和相机之间的X初始偏差，不加补偿
        /// </summary>
        [WatchValue("X方向偏差")]
        public double OffsetX
        {
            get { return _offsetX; }
            set { if (_offsetX != value) { _offsetX = value; OnPropertyChanged(nameof(OffsetX)); } }
        }

        private double _offsetY;
        /// <summary>
        /// 针和相机之间的Y初始偏差，不加补偿
        /// </summary>
        [WatchValue("Y方向偏差")]
        public double OffsetY
        {
            get { return _offsetY; }
            set { if (_offsetY != value) { _offsetY = value; OnPropertyChanged(nameof(OffsetY)); } }
        }

        private double _compensateX;
        /// <summary>
        /// 针和相机之间的X方向偏差补偿
        /// </summary>
        [WatchValue("X方向补偿")]
        public double CompensateX
        {
            get { return _compensateX; }
            set { if (_compensateX != value) { _compensateX = value; OnPropertyChanged(nameof(CompensateX)); } }
        }

        private double _compensateY;
        /// <summary>
        /// 针和相机之间的Y方向偏差补偿
        /// </summary>
        [WatchValue("Y方向补偿")]
        public double CompensateY
        {
            get { return _compensateY; }
            set { if (_compensateY != value) { _compensateY = value; OnPropertyChanged(nameof(CompensateY)); } }
        }

        private double _offsetXMax;
        [WatchValue("偏差限制—X偏差最大值")]
        public double OffsetXMax
        {
            get { return _offsetXMax; }
            set { if (_offsetXMax != value) { _offsetXMax = value; OnPropertyChanged(nameof(OffsetXMax)); } }
        }

        private double _offsetXMin;
        [WatchValue("偏差限制—X偏差最小值")]
        public double OffsetXMin
        {
            get { return _offsetXMin; }
            set { if (_offsetXMin != value) { _offsetXMin = value; OnPropertyChanged(nameof(OffsetXMin)); } }
        }

        private double _offsetYMax;
        [WatchValue("偏差限制—Y偏差最大值")]
        public double OffsetYMax
        {
            get { return _offsetYMax; }
            set { if (_offsetYMax != value) { _offsetYMax = value; OnPropertyChanged(nameof(OffsetYMax)); } }
        }

        private double _offsetYMin;
        [WatchValue("偏差限制—Y偏差最小值")]
        public double OffsetYMin
        {
            get { return _offsetYMin; }
            set { if (_offsetYMin != value) { _offsetYMin = value; OnPropertyChanged(nameof(OffsetYMin)); } }
        }

        private double _wSApproachX2;
        /// <summary>
        /// 方片逼近位X2
        /// </summary>
        [WatchValue("方片逼近位X2")]
        public double WSApproachX2
        {
            get { return _wSApproachX2; }
            set { if (_wSApproachX2 != value) { _wSApproachX2 = value; OnPropertyChanged(nameof(WSApproachX2)); } }
        }

        private double _wSApproachY2;
        /// <summary>
        /// 方片逼近位Y2
        /// </summary>
        [WatchValue("方片逼近位Y2")]
        public double WSApproachY2
        {
            get { return _wSApproachY2; }
            set { if (_wSApproachY2 != value) { _wSApproachY2 = value; OnPropertyChanged(nameof(WSApproachY2)); } }
        }

        private double _stampThreRadius;
        /// <summary>
        /// 针印理论半径
        /// </summary>
        [WatchValue("针印理论半径")]
        public double StampThreRadius
        {
            get { return _stampThreRadius; }
            set { if (_stampThreRadius != value) { _stampThreRadius = value; OnPropertyChanged(nameof(StampThreRadius)); } }
        }

        private double _stampThreErrorRange;
        /// <summary>
        /// 针印误差范围
        /// </summary>
        [WatchValue("针印误差范围")]
        public double StampThreErrorRange
        {
            get { return _stampThreErrorRange; }
            set { if (_stampThreErrorRange != value) { _stampThreErrorRange = value; OnPropertyChanged(nameof(StampThreErrorRange)); } }
        }

        private double _stampMinCircularity;
        /// <summary>
        /// 针印最小圆度
        /// </summary>
        [WatchValue("针印最小圆度")]
        public double StampMinCircularity
        {
            get { return _stampMinCircularity; }
            set { if (_stampMinCircularity != value) { _stampMinCircularity = value; OnPropertyChanged(nameof(StampMinCircularity)); } }
        }

        private double _stampPolarity;
        /// <summary>
        /// 针印颜色,0黑1白
        /// </summary>
        [WatchValue("针印理论半径")]
        public double StampPolarity
        {
            get { return _stampPolarity; }
            set { if (_stampPolarity != value) { _stampPolarity = value; OnPropertyChanged(nameof(StampPolarity)); } }
        }

        private bool _isBlack = false;
        public bool IsBlack
        {
            get
            {
                return _isBlack;
            }
            set
            {
                _isBlack = value;
                StampPolarityUpdate();
                OnPropertyChanged(nameof(IsBlack));
            }
        }

        public void StampPolarityUpdate()
        {
            if (IsBlack)
            {
                StampPolarity = 0;
            }
            else
            {
                StampPolarity = 1;
            }
        }

        public IParameterItem Clone()
        {
            NeedleXYCalibrationItemNew clone = new NeedleXYCalibrationItemNew();
            clone.NeedleX1 = this.NeedleX1;
            clone.NeedleZ1 = this.NeedleZ1;
            clone.WSApproachX2 = this.WSApproachX2;
            clone.WSApproachY2 = this.WSApproachY2;
            clone.Z1WorkTime = Z1WorkTime;
            clone.X1MechanicalOffset = X1MechanicalOffset;
            clone.X1Calib = X1Calib;
            clone.WSCalibX2 = WSCalibX2;
            clone.WSCalibY2 = WSCalibY2;
            clone.CompensateX = CompensateX;
            clone.CompensateY = CompensateY;
            clone.OffsetX = this.OffsetX;
            clone.OffsetY = this.OffsetY;
            clone.OffsetXMax = this.OffsetXMax;
            clone.OffsetXMin = this.OffsetXMin;
            clone.OffsetYMax = this.OffsetYMax;
            clone.OffsetYMin = this.OffsetYMin;
            clone.IsBlack = this.IsBlack;
            clone.StampMinCircularity = this.StampMinCircularity;
            clone.StampPolarity = this.StampPolarity;
            clone.StampThreErrorRange = this.StampThreErrorRange;
            clone.StampThreRadius = this.StampThreRadius;


            //clone.NeedleVisionParData.Exposure = this.NeedleVisionParData.Exposure;
            //clone.NeedleVisionParData.Gain = this.NeedleVisionParData.Gain;
            //clone.NeedleVisionParData.LightSourceBack = this.NeedleVisionParData.LightSourceBack;
            //clone.NeedleVisionParData.LightSourcePointBlue = this.NeedleVisionParData.LightSourcePointBlue;
            //clone.NeedleVisionParData.LightSourcePointRed = this.NeedleVisionParData.LightSourcePointRed;
            //clone.NeedleVisionParData.LightSourceRingBlue = this.NeedleVisionParData.LightSourceRingBlue;
            //clone.NeedleVisionParData.LightSourceRingRed = this.NeedleVisionParData.LightSourceRingRed;
            //clone.NeedleVisionParData.Z2 = this.NeedleVisionParData.Z2;

            return this.MemberwiseClone() as IParameterItem;
        }
    }

    public class NeedleTouchRecord : PropertyChangedBase, IParameterItem
    {

        private int _CurrentCount;
        /// <summary>
        /// 当前次数
        /// </summary>
        public int CurrentCount
        {
            get { return _CurrentCount; }
            set
            { SetAndNotify(ref _CurrentCount, value); }
        }

        private double _Height;
        /// <summary>
        /// 高度
        /// </summary>
        public double Height
        {
            get { return _Height; }
            set
            { SetAndNotify(ref _Height, value); }
        }



        public NeedleTouchRecord()
        {

        }
        public NeedleTouchRecord(int count, double height)
        {
            CurrentCount = count;
            Height = height;
        }

        public IParameterItem Clone()
        {
            return this.MemberwiseClone() as IParameterItem;
        }
    }
}
