Пример #1
0
		public bool Equals(Location coor)
		{
			if (coor == null)
				return false;

			return (this.Latitude == coor.Latitude && this.Longitude == coor.Longitude);
		}
Пример #2
0
		public Address(string formattedAddress, Location coordinates, string provider)
		{
			formattedAddress = (formattedAddress ?? "").Trim();

			if (String.IsNullOrEmpty(formattedAddress))
				throw new ArgumentNullException("formattedAddress");

			if (coordinates == null)
				throw new ArgumentNullException("coordinates");

			if (provider == null)
				throw new ArgumentNullException("provider");

			this.formattedAddress = formattedAddress;
			this.coordinates = coordinates;
			this.provider = provider;
		}
Пример #3
0
		public Distance DistanceBetween(Location location, DistanceUnits units)
		{
			double earthRadius = (units == DistanceUnits.Miles) ? Distance.EarthRadiusInMiles : Distance.EarthRadiusInKilometers;

			double latRadian = ToRadian(location.Latitude - this.Latitude);
			double longRadian = ToRadian(location.Longitude - this.Longitude);

			double a = Math.Pow(Math.Sin(latRadian / 2.0), 2) +
				Math.Cos(ToRadian(this.Latitude)) *
				Math.Cos(ToRadian(location.Latitude)) *
				Math.Pow(Math.Sin(longRadian / 2.0), 2);

			double c = 2.0 * Math.Asin(Math.Min(1, Math.Sqrt(a)));

			double distance = earthRadius * c;
			return new Distance(distance, units);
		}
Пример #4
0
		public Distance DistanceBetween(Location location)
		{
			return DistanceBetween(location, DistanceUnits.Miles);
		}
Пример #5
0
		public YahooAddress(string formattedAddress, Location coordinates, string name, string house, string street,
			string unit, string unitType, string neighborhood, string city, string county, string countyCode, string state,
			string stateCode, string postalCode, string country, string countryCode, int quality)
			: base(formattedAddress, coordinates, "Yahoo")
		{
			this.name = name;
			this.house = house;
			this.street = street;
			this.unit = unit;
			this.unitType = unitType;
			this.neighborhood = neighborhood;
			this.city = city;
			this.county = county;
			this.countyCode = countyCode;
			this.state = state;
			this.stateCode = stateCode;
			this.postalCode = postalCode;
			this.country = country;
			this.countryCode = countryCode;
			this.quality = quality;
		}