예제 #1
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <param name="other">An object to compare with this object.</param>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
 /// </returns>
 public bool Equals(GenericRect <THorizontal, TVertical> other)
 {
     return
         (this.xMin.Equals(other.xMin) &&
          this.xMax.Equals(other.xMax) &&
          this.yMin.Equals(other.yMin) &&
          this.yMax.Equals(other.yMax));
 }
예제 #2
0
        private DataRect CreateRect(GenericRect <THorizontal, TVertical> value)
        {
            double xMin = HorizontalToDoubleConverter(value.XMin);
            double xMax = HorizontalToDoubleConverter(value.XMax);
            double yMin = VerticalToDoubleConverter(value.YMin);
            double yMax = VerticalToDoubleConverter(value.YMax);

            return(new DataRect(new Point(xMin, yMin), new Point(xMax, yMax)));
        }
예제 #3
0
        private GenericRect <THorizontal, TVertical> CreateGenericRect(DataRect rect)
        {
            double xMin = rect.XMin;
            double xMax = rect.XMax;
            double yMin = rect.YMin;
            double yMax = rect.YMax;

            GenericRect <THorizontal, TVertical> res = new GenericRect <THorizontal, TVertical>(
                DoubleToHorizontalConverter(xMin),
                DoubleToVerticalConverter(yMin),
                DoubleToHorizontalConverter(xMax),
                DoubleToVerticalConverter(yMax));

            return(res);
        }
예제 #4
0
        /// <summary>
        /// Indicates whether this instance and a specified object are equal.
        /// </summary>
        /// <param name="obj">Another object to compare to.</param>
        /// <returns>
        /// true if <paramref name="obj"/> and this instance are the same type and represent the same value; otherwise, false.
        /// </returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (!(obj is GenericRect <THorizontal, TVertical>))
            {
                return(false);
            }

            GenericRect <THorizontal, TVertical> other = (GenericRect <THorizontal, TVertical>)obj;

            return(Equals(other));
        }