Shuxia Ning
2024-12-19 b0c978129ba55cf81e8470b6c9326745a5dbc7d1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System.Runtime.Serialization;
using System.Text;
 
namespace Eventech.Model
{
    //比ThroughCurve多一个参数
    [Serializable]
    public class ThroughParaCurve : Yw.Pump.CurveEqualE, ICloneable
    {
        public ThroughParaCurve() { }
         
        public ThroughParaCurve(ThroughParaCurve rhs) {
            this.DispTension = rhs.DispTension;
            this.IsClosed = rhs.IsClosed;
            this.CurvePara = rhs.CurvePara;
            this.PointInfo = rhs.PointInfo.Clone();
        }
 
        public ThroughParaCurve(double para, List<Eventech.Model.FeatPoint> curveInfo, bool isClosed=false, float tension=0.5f)
        {
            CurvePara = para;
            PointInfo = new Eventech.Model.FeatPointList(curveInfo);
            IsClosed = isClosed;
            DispTension = tension;
        }
 
 
        [DataMember]
        public double CurvePara { get; set; }
 
        [DataMember]
        public bool IsClosed { get; set; }
 
 
 
        //比较相同:主要用与LIST的Contains方法和Distinct
        public class EqualComparer : IEqualityComparer<ThroughParaCurve>
        {
            private double ignoreDis = 0.001;
            public EqualComparer()
            {
                ignoreDis = 0.001;
            }
            public EqualComparer(double dis)
            {
                ignoreDis = dis;
            }
 
            public bool Equals(ThroughParaCurve lhs, ThroughParaCurve rhs)
            {
 
                if (Math.Abs(lhs.CurvePara - rhs.CurvePara) < ignoreDis)
                    return true;
                else
                    return false;
            }
 
            public int GetHashCode(ThroughParaCurve obj)
            {
                //return obj.X.GetHashCode() + obj.Y.GetHashCode(); 
                return 0;
            }
        }
 
    }
 
 
 
}