コード例 #1
0
        /// <summary>
        /// Returns true if ResponseBox instances are equal
        /// </summary>
        /// <param name="other">Instance of ResponseBox to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ResponseBox other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     MinLat == other.MinLat ||

                     MinLat.Equals(other.MinLat)
                     ) &&
                 (
                     MaxLat == other.MaxLat ||

                     MaxLat.Equals(other.MaxLat)
                 ) &&
                 (
                     MinLng == other.MinLng ||

                     MinLng.Equals(other.MinLng)
                 ) &&
                 (
                     MaxLng == other.MaxLng ||

                     MaxLng.Equals(other.MaxLng)
                 ));
        }
コード例 #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = MinLat.GetHashCode();
         hashCode = (hashCode * 397) ^ MinLon.GetHashCode();
         hashCode = (hashCode * 397) ^ MaxLat.GetHashCode();
         hashCode = (hashCode * 397) ^ MaxLon.GetHashCode();
         return(hashCode);
     }
 }
コード例 #3
0
        /// <summary>
        /// Возвращает строку запроса типа ?min_lat=55.30077916694387&min_lng=36.974153699712836&max_lat=56.200586833056136&max_lng=38.26083830028717
        /// </summary>
        /// <returns></returns>
        public string ToUrlQuery()
        {
            var list = new List <string>(15);

            if (!string.IsNullOrWhiteSpace(Id))
            {
                list.Add($"id={Id}");
            }
            if (WeightGramms > 0)
            {
                list.Add($"weight={WeightGramms.ToString()}");
            }
            if (OrderPrice > 0)
            {
                list.Add($"order_price={OrderPrice.ToString()}");
            }
            if (!string.IsNullOrWhiteSpace(City))
            {
                list.Add($"city={City}");
            }
            if (!string.IsNullOrWhiteSpace(Region))
            {
                list.Add($"region={Region}");
            }
            if (!string.IsNullOrWhiteSpace(CountryCode))
            {
                list.Add($"country={CountryCode}");
            }
            if (!string.IsNullOrWhiteSpace(Type))
            {
                list.Add($"type={Type}");
            }
            if (!string.IsNullOrWhiteSpace(Partner))
            {
                list.Add($"partner={Partner}");
            }
            if (MinLng.HasValue && MaxLng.HasValue && MinLat.HasValue && MaxLat.HasValue)
            {
                list.Add($"min_lng={MinLng.ToString().Replace(",", ".")}");
                list.Add($"max_lng={MaxLng.ToString().Replace(",", ".")}");
                list.Add($"min_lat={MinLat.ToString().Replace(",", ".")}");
                list.Add($"max_lat={MaxLat.ToString().Replace(",", ".")}");
            }
            if (RegionCities.HasValue)
            {
                list.Add($"region_cities={(RegionCities.Value ? "Y" : "N")}");
            }
            if (!string.IsNullOrWhiteSpace(InSales))
            {
                list.Add($"insales={InSales}");
            }
            return("?" + string.Join("&", list));
        }
コード例 #4
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)

                hashCode = hashCode * 59 + MinLat.GetHashCode();

                hashCode = hashCode * 59 + MaxLat.GetHashCode();

                hashCode = hashCode * 59 + MinLng.GetHashCode();

                hashCode = hashCode * 59 + MaxLng.GetHashCode();
                return(hashCode);
            }
        }
コード例 #5
0
ファイル: MBR.cs プロジェクト: embarassed/TrjTools
 public override int GetHashCode()
 {
     return(MinLat.GetHashCode() ^ MinLng.GetHashCode() ^ MaxLat.GetHashCode() ^ MaxLng.GetHashCode());
 }
コード例 #6
0
 public bool Equals(Envelope other)
 {
     return(!ReferenceEquals(null, other) && MinLat.Equals(other.MinLat) && MinLon.Equals(other.MinLon) && MaxLat.Equals(other.MaxLat) && MaxLon.Equals(other.MaxLon));
 }
コード例 #7
0
 public string ToString(char separator)
 {
     return(MinLon.ToString() + separator + MinLat.ToString() + separator + MaxLon.ToString() + separator + MaxLat.ToString());
 }
コード例 #8
0
 public override string ToString()
 {
     return(MinLon.ToString() + separator + MinLat.ToString() + separator + MaxLon.ToString() + separator + MaxLat.ToString());
 }