Exemple #1
0
 private static void Set(this LocationReference locationReference, CountrySubdivision countrySubdivision)
 {
     locationReference.Set(
         null,
         countrySubdivision.Clone(),
         countrySubdivision.Clone(),
         null);
 }
Exemple #2
0
        public override int GetHashCode()
        {
            var hashCode = (UnstructuredLocation ?? string.Empty).GetHashCode()
                           ^ (NamedLocation == null ? 0 : NamedLocation.GetHashCode())
                           ^ (CountrySubdivision == null ? 0 : CountrySubdivision.GetHashCode())
                           ^ (Locality == null ? 0 : Locality.GetHashCode());

            return(hashCode);
        }
Exemple #3
0
 public void Add(CountrySubdivision subdivision, IDictionary <int, Locality> localities)
 {
     _namedLocationsById[subdivision.Id] = subdivision;
     if (subdivision.CircleCentreId != null)
     {
         Locality locality;
         localities.TryGetValue(subdivision.CircleCentreId.Value, out locality);
         if (locality != null)
         {
             _subdivisionsByCoordinates[locality.Centroid] = subdivision;
         }
     }
 }
Exemple #4
0
        public static CountrySubdivision Clone(this CountrySubdivision countrySubdivision)
        {
            if (countrySubdivision == null)
            {
                return(null);
            }

            return(new CountrySubdivision
            {
                Id = countrySubdivision.Id,
                Name = countrySubdivision.Name,
                ShortName = countrySubdivision.ShortName,
                UrlName = countrySubdivision.UrlName,
                CircleCentreId = countrySubdivision.CircleCentreId,
                CircleRadiusKm = countrySubdivision.CircleRadiusKm,
                Aliases = countrySubdivision.Aliases != null ? (from a in countrySubdivision.Aliases select a.Clone()).ToList() : null,
                Country = countrySubdivision.Country.Clone(),
            });
        }
Exemple #5
0
 internal LocationReference(string unstructuredLocation, NamedLocation namedLocation, CountrySubdivision countrySubdivision, Locality locality)
 {
     Set(unstructuredLocation, namedLocation, countrySubdivision, locality);
 }
Exemple #6
0
 public static void Set(this LocationReference locationReference, string unstructuredLocation, CountrySubdivision countrySubdivision, PostalCode postalCode)
 {
     locationReference.Set(
         unstructuredLocation,
         postalCode.Clone(),
         countrySubdivision.Clone(),
         postalCode.Locality.Clone());
 }
Exemple #7
0
 public static void Set(this LocationReference locationReference, string unstructuredLocation, CountrySubdivision countrySubdivision)
 {
     locationReference.Set(
         unstructuredLocation == string.Empty ? null : unstructuredLocation,
         countrySubdivision.Clone(),
         countrySubdivision.Clone(),
         null);
 }