public void should_calculate_the_distance_correctly_between_two_points() { var london = new LocationCoordinate(51.500288, -0.126269); var paris = new LocationCoordinate(48.856495, 2.350907); var result = Resolve<IDistanceCalculatorService>().DistanceBetween(london, paris) / 1000; Assert.That(result, Is.AtLeast(342)); Assert.That(result, Is.AtMost(343)); }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { object result = null; string stringValue = value as string; if (!string.IsNullOrEmpty(stringValue)) { result = new LocationCoordinate(stringValue); } return result ?? base.ConvertFrom(context, culture, value); }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { object result = null; string stringValue = value as string; if (!string.IsNullOrEmpty(stringValue)) { result = new LocationCoordinate(stringValue); } return(result ?? base.ConvertFrom(context, culture, value)); }
private void BuildMapView(LocationCoordinate currentLocation) { var visibleRegion = this.BuildVisibleRegion(currentLocation); this.mapView = new MKMapView() { ShowsUserLocation = true, ZoomEnabled = true }; this.mapView.SizeToFit(); this.mapView.Frame = new RectangleF(0, this.toolbar.Bounds.Height, this.View.Frame.Width, this.View.Frame.Height - this.toolbar.Bounds.Height); this.mapView.SetRegion(visibleRegion, true); this.mapView.Delegate = this.GeofenceMapDelegate; this.View.AddSubview(this.toolbar); this.View.AddSubview(this.mapView); this.SetupGestureInteraction(); }
public double DistanceBetween(LocationCoordinate locationA, LocationCoordinate locationB) { return new CLLocation(locationA != null ? locationA.Latitude : 0, locationA != null ? locationA.Longitude : 0) .DistanceFrom(new CLLocation(locationB != null ? locationB.Latitude : 0, locationB != null ? locationB.Longitude : 0)); }
public bool Equals(LocationCoordinate other) { return(this.Longitude.Equals(other.Longitude) && this.Latitude.Equals(other.Latitude)); }
public bool Equals(LocationCoordinate other) { return this.Longitude.Equals(other.Longitude) && this.Latitude.Equals(other.Latitude); }
private MKCoordinateRegion BuildVisibleRegion(LocationCoordinate currentLocation) { var span = new MKCoordinateSpan(0.003125, 0.003125); var region = new MKCoordinateRegion(new CLLocationCoordinate2D(currentLocation.Latitude, currentLocation.Longitude), span); return region; }