duheng
2024-10-09 f4bf35513c50f86556d5e3c75a037052f53c971d
WinFrmUI/Yw.WinFrmUI.Phart.Core/01-perform/99-models/02-group_point/PumpGroupPt.cs
ÎļþÃû´Ó WinFrmUI/Yw.WinFrmUI.Phart.Core/01-perform/99-models/02-group_point/PumpPerformGroupPoint.cs ÐÞ¸Ä
@@ -1,6 +1,6 @@
namespace Yw.WinFrmUI.Phart
{
    public class PumpPerformGroupPoint : ICloneable
    public class PumpGroupPt : ICloneable
    {
        private int id = 0;
        public int ID { get { return id; } set { id = value; } }
@@ -10,8 +10,8 @@
        public double P { get; set; }
        public double NPSH { get { return _npsh; } set { _npsh = value; } }
        private double _npsh = -1;
        public PumpPerformGroupPoint() { }
        public PumpPerformGroupPoint(PumpPerformGroupPoint rhs)
        public PumpGroupPt() { }
        public PumpGroupPt(PumpGroupPt rhs)
        {
            this.ID = rhs.ID;
            this.Q = rhs.Q;
@@ -20,7 +20,7 @@
            this.P = rhs.P;
            this.NPSH = rhs.NPSH;
        }
        public PumpPerformGroupPoint(string dsString)
        public PumpGroupPt(string dsString)
        {
            ResetParas(dsString);
        }
@@ -49,7 +49,7 @@
            NPSH = Convert.ToDouble(paras[5]);
            return true;
        }
        public static PumpPerformGroupPoint ToParameter(string dsString)
        public static PumpGroupPt ToParameter(string dsString)
        {
            if (string.IsNullOrEmpty(dsString)) return null;
            if (dsString.Contains("|"))
@@ -60,13 +60,13 @@
                if (iCount < 2)
                    return null;
                return PumpPerformGroupPoint.ToParameter(strParas[1]);//取默认第一个成员即可
                return PumpGroupPt.ToParameter(strParas[1]);//取默认第一个成员即可
            }
            var paras = dsString.Split(',');
            if (paras.Count() < 5)
                return null;
            PumpPerformGroupPoint pt = new PumpPerformGroupPoint();
            PumpGroupPt pt = new  ();
            pt.ID = Convert.ToInt32(paras[0]);
            pt.Q = Convert.ToDouble(paras[1]);
            pt.H = Convert.ToDouble(paras[2]);
@@ -78,7 +78,7 @@
        }
        public PumpPerformGroupPoint(int id, double q, double h, double e, double p)
        public PumpGroupPt(int id, double q, double h, double e, double p)
        {
            ID = id;
            Q = q;
@@ -86,7 +86,7 @@
            E = e;
            P = p;
        }
        public PumpPerformGroupPoint(int id, double q, double h, double e, double p, double npsh)
        public PumpGroupPt(int id, double q, double h, double e, double p, double npsh)
        {
            ID = id;
            Q = q;
@@ -105,7 +105,7 @@
            return string.Format("{0},{1},{2},{3},{4},{5}", ID, Q, H, E, P, NPSH);
        }
        public PumpPerformGroupPoint RoundAll(int decimals)
        public PumpGroupPt RoundAll(int decimals)
        {
            this.Q = Math.Round(this.Q, decimals);
            this.H = Math.Round(this.H, decimals);
@@ -114,7 +114,7 @@
            this.NPSH = Math.Round(this.NPSH, decimals);
            return this;
        }
        public  PumpPerformGroupPoint RoundAll_Small(int decimals, double small = 2)
        public  PumpGroupPt RoundAll_Small(int decimals, double small = 2)
        {
            if (this.Q < small)
                this.Q = Math.Round(this.Q, 3);
@@ -137,9 +137,9 @@
        }
        #region Clone
        public PumpPerformGroupPoint Clone()  //对外提供一个创建自身的浅表副本的能力
        public PumpGroupPt Clone()  //对外提供一个创建自身的浅表副本的能力
        {
            return (PumpPerformGroupPoint)this.MemberwiseClone();
            return (PumpGroupPt)this.MemberwiseClone();
        }
        object ICloneable.Clone()
        {
@@ -157,7 +157,7 @@
        }
        //排序方法
        public class Comparer : IComparer<PumpPerformGroupPoint>
        public class Comparer : IComparer<PumpGroupPt>
        {
            private eSortType sortType;
            public Comparer(eSortType type = eSortType.Q)
@@ -166,7 +166,7 @@
            }
            #region IComparer<GroupPoint> æˆå‘˜
            int IComparer<PumpPerformGroupPoint>.Compare(PumpPerformGroupPoint obj1, PumpPerformGroupPoint obj2)
            int IComparer<PumpGroupPt>.Compare(PumpGroupPt obj1, PumpGroupPt obj2)
            {
                if (sortType == eSortType.ID)
                {
@@ -249,7 +249,7 @@
        }
        //比较相同:主要用与LIST的Contains方法
        public class EqualComparer : IEqualityComparer<PumpPerformGroupPoint>
        public class EqualComparer : IEqualityComparer<PumpGroupPt>
        {
            private double ignoreDis = 0.001;
            public EqualComparer()
@@ -260,7 +260,7 @@
            {
                ignoreDis = dis;
            }
            public bool Equals(PumpPerformGroupPoint lhs, PumpPerformGroupPoint rhs)
            public bool Equals(PumpGroupPt lhs, PumpGroupPt rhs)
            {
                if (Math.Abs(lhs.Q - rhs.Q) < ignoreDis && Math.Abs(lhs.H - rhs.H) < ignoreDis)
                    return true;
@@ -268,7 +268,7 @@
                return false;
            }
            public int GetHashCode(PumpPerformGroupPoint obj)
            public int GetHashCode(PumpGroupPt obj)
            {
                return 0;
                // return obj.H.GetHashCode() + obj.Q.GetHashCode();