lixiaojun
2024-12-10 31a8e93cf1cc708b68456b88aa5b0031a41eb47a
WinFrmUI/Yw.WinFrmUI.Hydro.Q3d.Core/MapView/Core/Geometry_2d/Point2d.cs
@@ -1,28 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Security.Permissions;
using System.Text;
namespace Hydro.Model
{
    [DataContract]
    public class Point2d :  ICloneable
    public class Point2d : ICloneable
    {
        [DataMember]
        public double X { get { return x; } set { x = value; } }
        [DataMember]
        public double Y { get { return y; } set { y = value; } }
        protected double x;
        protected double y;
        protected double y;
        #region 构造函数
        public Point2d() { }
        public Point2d(double x, double y)
        {
@@ -39,7 +39,7 @@
            this.x = Convert.ToDouble(x);
            this.y = Convert.ToDouble(y);
        }
        public Point2d(Point  rhs)
        public Point2d(Point rhs)
        {
            this.X = rhs.X;
            this.Y = rhs.Y;
@@ -47,7 +47,7 @@
        public Point2d(Point2d rhs)
        {
            this.X = rhs.X;
            this.Y = rhs.Y;
            this.Y = rhs.Y;
        }
        public Point2d(string strPara)
        {
@@ -57,7 +57,7 @@
            if (strPara_split_array.Count() < 2)
                return;
            X = Convert.ToDouble(strPara_split_array[0]);
            Y = Convert.ToDouble(strPara_split_array[1]);
            Y = Convert.ToDouble(strPara_split_array[1]);
        }
        public static Point2d ToParameter(string strPara)
        {
@@ -68,7 +68,7 @@
                return null;
            Point2d pt = new Point2d();
            pt.X = Convert.ToDouble(strPara_split_array[0]);
            pt.Y = Convert.ToDouble(strPara_split_array[1]);
            pt.Y = Convert.ToDouble(strPara_split_array[1]);
            return pt;
        }
@@ -77,9 +77,9 @@
        #region ToString
        public override string ToString()
        {
            return string.Format("X:{0},Y:{1}", X, Y );
            return string.Format("X:{0},Y:{1}", X, Y);
        }
        #endregion
        #region Clone
@@ -125,7 +125,7 @@
            return new Point2d(this.x + x, this.y + y);
        }
        /// <summary>
        /// Return the HashCode from the base class.
@@ -153,7 +153,7 @@
        protected Point2d(SerializationInfo info, StreamingContext context)
        {
            X = info.GetDouble("X");
            Y = info.GetDouble("Y");
        }
@@ -163,7 +163,7 @@
        {
            info.AddValue("schema", schema);
            info.AddValue("X", X);
            info.AddValue("Y", Y);
            info.AddValue("Y", Y);
        }
        public string ToDsString()
        {
@@ -172,7 +172,7 @@
        public static string ToDsString(Point2d point)
        {
            return string.Format("{0},{1}", point.X, point.Y );
            return string.Format("{0},{1}", point.X, point.Y);
        }
@@ -187,7 +187,7 @@
        /// <returns>true if either value is missing</returns>
        public bool IsMissing()
        {
             return this.X == Point2d.Missing || this.Y == Point2d.Missing  ;
            return this.X == Point2d.Missing || this.Y == Point2d.Missing;
        }
        /// <summary>
@@ -200,16 +200,16 @@
        public bool IsInvalid()
        {
            return this.X == Point2d.Missing ||
                    this.Y == Point2d.Missing ||
                    this.Y == Point2d.Missing ||
                    Double.IsInfinity(this.X) ||
                    Double.IsInfinity(this.Y) ||
                    Double.IsInfinity(this.Y) ||
                    Double.IsNaN(this.X) ||
                    Double.IsNaN(this.Y)  ;
                    Double.IsNaN(this.Y);
        }
        public bool IsZeroPt()
        {
            if ((Math.Abs(x) < 0.00001) && (Math.Abs(y) < 0.00001)  )
            if ((Math.Abs(x) < 0.00001) && (Math.Abs(y) < 0.00001))
                return true;
            else
                return false;
@@ -235,12 +235,12 @@
        public enum eSortType
        {
            X,
            Y
            Y
        }
        public enum eCompareType
        {
            X,
            Y,
            Y,
            ALL
        }
@@ -271,7 +271,7 @@
                        return -1;
                    }
                }
                else
                {
                    if (Math.Abs(obj1.Y - obj2.Y) < 0.00001)
@@ -318,9 +318,9 @@
                    case eCompareType.Y:
                        if (Math.Abs(lhs.Y - rhs.Y) < ignoreDis)
                            return true;
                        break;
                        break;
                    case eCompareType.ALL:
                        if (Math.Abs(lhs.X - rhs.X) < ignoreDis && Math.Abs(lhs.Y - rhs.Y) < ignoreDis )
                        if (Math.Abs(lhs.X - rhs.X) < ignoreDis && Math.Abs(lhs.Y - rhs.Y) < ignoreDis)
                            return true;
                        break;
                }
@@ -338,9 +338,9 @@
        //距离
        public double Distance(Point2d pt)
        {
            return Math.Sqrt((pt.X - this.X) * (pt.X - this.X)
            return Math.Sqrt((pt.X - this.X) * (pt.X - this.X)
                + (pt.Y - this.Y) * (pt.Y - this.Y)
                );
        }
    }