using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace FLY.Simulation.HeaderAndTailer
{
    public class CurveCell : Misc.ISaveToXml, INotifyPropertyChanged
    {
        static CurveCell()
        {
            Misc.SaveToXmlHepler.Regist(typeof(CurveCell));
        }
        public override string ToString()
        {
            return "value=" + Value.ToString() + " ad=" + AD.ToString() + " revisedad=" + RevisedAD.ToString();
        }
        private int _value;
        /// <summary>
        /// 面密度
        /// </summary>
        public int Value
        {
            get { return _value; }
            set
            {
                _value = value;
                NotifyPropertyChanged("Value");
            }
        }
        private int _ad;

        public int AD
        {
            get { return _ad; }
            set
            {
                _ad = value;
                NotifyPropertyChanged("AD");
            }
        }

        private int _revisedAD;
        /// <summary>
        /// 校正后的AD值
        /// </summary>
        public int RevisedAD
        {
            get { return _revisedAD; }
            set
            {
                _revisedAD = value;
                NotifyPropertyChanged("RevisedAD");
            }
        }

        #region ISaveToXml 成员

        public string[] GetSavePropertyNames()
        {
            return new string[]{
                    "Value",
                    "AD"};
        }

        #endregion

        #region INotifyPropertyChanged 成员
        protected void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        public event PropertyChangedEventHandler PropertyChanged;

        #endregion
    }
    public enum AD2ValueFlag
    {
        /// <summary>
        /// 修正后的曲线
        /// </summary>
        Revised,
        /// <summary>
        /// 原始曲线
        /// </summary>
        NoRevised
    }
    /// <summary>
    /// 曲线类型
    /// </summary>
    public enum CurveType
    {
        /// <summary>
        /// 自然对数
        /// </summary>
        E,
        /// <summary>
        /// 直线拟合
        /// </summary>
        Line,
        /// <summary>
        /// 二次拟合
        /// </summary>
        X2
    }
    public enum CurveCorrectWay
    {
        /// <summary>
        /// 单点校正时，比例放大
        /// </summary>
        OnePointIsScale,
        /// <summary>
        /// 单点校正时，平移
        /// </summary>
        OnePointIsOffset
    }
}
