public void TestFormatNegativeLatLong() { // set up double latLong = -47.6764385; // run string text1 = DataFormatter.FormatLatLong(latLong, CoordinateDisplayFormat.Format_dd_dddddd); string text2 = DataFormatter.FormatLatLong(latLong, CoordinateDisplayFormat.Format_dd_mm_mmm); string text3 = DataFormatter.FormatLatLong(latLong, CoordinateDisplayFormat.Format_dd_mm_sss); // check Assert.AreEqual("-47.676439", text1, "formatted text must match"); Assert.AreEqual("-47° 40.586'", text2, "formatted text must match"); Assert.AreEqual("-47° 40' 35\"", text3, "formatted text must match"); }
/// <summary> /// Called when the user performed a long-tap on the map /// </summary> /// <param name="point">map point where long-tap occured</param> /// <returns>task to wait on</returns> private async Task OnMapView_LongTap(MapPoint point) { string latitudeText = DataFormatter.FormatLatLong(point.Latitude, this.appSettings.CoordinateDisplayFormat); string longitudeText = DataFormatter.FormatLatLong(point.Longitude, this.appSettings.CoordinateDisplayFormat); var longTapActions = new List <string> { "Add new waypoint", "Navigate here", "Show flying range" }; string result = await App.Current.MainPage.DisplayActionSheet( $"Selected point at Latitude: {latitudeText}, Longitude: {longitudeText}, Altitude {point.Altitude.GetValueOrDefault(0.0)} m", "Cancel", null, longTapActions.ToArray()); if (!string.IsNullOrEmpty(result)) { int selectedIndex = longTapActions.IndexOf(result); switch (selectedIndex) { case 0: await this.AddNewWaypoint(point); break; case 1: await NavigateToPointAsync(string.Empty, point); break; case 2: await this.ShowFlyingRange(point); break; default: // ignore break; } } }