using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;

namespace wijmoSample1.Models.Maps
{
    [DataContract]
    public struct PointD
    {
        public static PointD Empty = new PointD();
        private double _x;
        private double _y;

        public PointD(double x, double y)
        {
            _x = x;
            _y = y;
        }

        [DataMember(Name = "x")]
        public double X
        {
            get { return _x; }
            set { _x = value; }
        }

        [DataMember(Name = "y")]
        public double Y
        {
            get { return _y; }
            set { _y = value; }
        }

        public static bool operator ==(PointD left, PointD right)
        {
            return left.Equals(right);
        }

        public static bool operator !=(PointD left, PointD right)
        {
            return !(left.Equals(right));
        }

        public override bool Equals(object obj)
        {
            if (!(obj is PointD)) return false;

            var that = (PointD)obj;
            return this._x == that._x
                   && this._y == that._y;
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}