namespace HKW.HKWUtils; /// /// 可观察地点 /// /// 类型 public class ObservablePoint : ObservableClass>, IEquatable> { private T _x; public T X { get => _x; set => SetProperty(ref _x, value); } private T _y; public T Y { get => _y; set => SetProperty(ref _y, value); } public ObservablePoint() { } public ObservablePoint(T x, T y) { X = x; Y = y; } /// /// 复制一个新的对象 /// /// 新对象 public ObservablePoint Copy() { return new(X, Y); } #region Other /// public override int GetHashCode() { return HashCode.Combine(X, Y); } /// public override bool Equals(object? obj) { return obj is ObservablePoint temp && EqualityComparer.Default.Equals(X, temp.X) && EqualityComparer.Default.Equals(Y, temp.Y); } /// public bool Equals(ObservablePoint? other) { return Equals(obj: other); } /// public static bool operator ==(ObservablePoint a, ObservablePoint b) { return Equals(a, b); } /// public static bool operator !=(ObservablePoint a, ObservablePoint b) { return Equals(a, b) is not true; } #endregion }