private async void myMap_Loaded(object sender, RoutedEventArgs e) { if (myMap.Layers.Count == 0) { // Specify a known location. var cityPosition = new windows.Devices.Geolocation.BasicGeoposition() { Latitude = 47.604, Longitude = -122.329 }; var cityCenter = new windows.Devices.Geolocation.Geopoint(cityPosition); var icon = new windows.UI.Xaml.Controls.Maps.MapIcon() { Location = cityCenter, }; var elements = new System.Collections.Generic.List <windows.UI.Xaml.Controls.Maps.MapElement>() { icon, }; var layer = new windows.UI.Xaml.Controls.Maps.MapElementsLayer() { ZIndex = 1, MapElements = elements, }; myMap.Layers.Add(layer); // Set the map location. await myMap.TrySetViewAsync(cityCenter, 12).ConfigureAwait(false); } }
/// <summary> /// Create a geographic point object for the given position. /// </summary> /// <param name="position">Create a geographic point object for the given position.</param> public Geopoint(BasicGeoposition position) { #if WINDOWS_UWP || WINDOWS_APP || WINDOWS_PHONE_APP || WINDOWS_PHONE_81 _point = new Windows.Devices.Geolocation.Geopoint(position); #else Position = position; #endif }
/// <summary> /// /// </summary> /// <param name="position"></param> public Geopoint(BasicGeoposition position) { #if WINDOWS_UWP || WINDOWS_APP || WINDOWS_PHONE_APP || WINDOWS_PHONE_81 _point = new Windows.Devices.Geolocation.Geopoint(position); #else Position = position; #endif }
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously public async Task LoadAsync(Record record) #pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously { CenterPoint = new Windows.Devices.Geolocation.Geopoint( new Windows.Devices.Geolocation.BasicGeoposition { Latitude = record.geometry.coordinates[1], Longitude = record.geometry.coordinates[0] }); Record = record; }
public Geopoint(BasicGeoposition basicGeoposition) { this.basicGeoposition = new Windows.Devices.Geolocation.BasicGeoposition() { Latitude = basicGeoposition.Latitude, Longitude = basicGeoposition.Longitude, Altitude = basicGeoposition.Altitude }; UwpInstance = new Windows.Devices.Geolocation.Geopoint(this.basicGeoposition); }
private async void Location_Click(object sender, RoutedEventArgs e) { Windows.Devices.Geolocation.Geopoint position = await library.Position(); DependencyObject marker = library.Marker(); Display.Children.Add(marker); Windows.UI.Xaml.Controls.Maps.MapControl.SetLocation(marker, position); Windows.UI.Xaml.Controls.Maps.MapControl.SetNormalizedAnchorPoint(marker, new Point(0.5, 0.5)); Display.ZoomLevel = 12; Display.Center = position; }
private async void Location_Click(object sender, RoutedEventArgs e) { Windows.Devices.Geolocation.Geopoint position = await Shared.Position(); Bing.Maps.Location location = new Bing.Maps.Location(position.Position.Latitude, position.Position.Longitude); UIElement marker = Shared.Marker(); Display.Children.Add(marker); Bing.Maps.MapLayer.SetPosition(marker, location); Bing.Maps.MapLayer.SetPositionAnchor(marker, new Point(0.5, 0.5)); Display.ZoomLevel = 12; Display.Center = location; }
void timer_Tick(object sender, object e) { #if WINDOWS_PHONE_APP Windows.Devices.Geolocation.Geopoint topLeft = null; try { this.MapControl.GetLocationFromOffset(new Windows.Foundation.Point(0, 0), out topLeft); } catch { var topOfMap = new Windows.Devices.Geolocation.Geopoint(new Windows.Devices.Geolocation.BasicGeoposition() { Latitude = 85, Longitude = 0 }); Windows.Foundation.Point topPoint; this.MapControl.GetOffsetFromLocation(topOfMap, out topPoint); this.MapControl.GetLocationFromOffset(new Windows.Foundation.Point(0, topPoint.Y), out topLeft); } Windows.Devices.Geolocation.Geopoint bottomRight = null; try { this.MapControl.GetLocationFromOffset(new Windows.Foundation.Point(this.MapControl.ActualWidth, this.MapControl.ActualHeight), out bottomRight); } catch { var bottomOfMap = new Windows.Devices.Geolocation.Geopoint(new Windows.Devices.Geolocation.BasicGeoposition() { Latitude = -85, Longitude = 0 }); Windows.Foundation.Point bottomPoint; this.MapControl.GetOffsetFromLocation(bottomOfMap, out bottomPoint); this.MapControl.GetLocationFromOffset(new Windows.Foundation.Point(0, bottomPoint.Y), out bottomRight); } if (topLeft != null && bottomRight != null) { var bounds = new Windows.Devices.Geolocation.GeoboundingBox(topLeft.Position, bottomRight.Position); _mapBounds = new Envelope(bounds.SoutheastCorner.Latitude, bounds.NorthwestCorner.Longitude, bounds.NorthwestCorner.Latitude, bounds.SoutheastCorner.Longitude); } #else var bounds = this.MapControl.Bounds; _mapBounds = new Envelope(bounds.South, bounds.West, bounds.North, bounds.East); #endif }
/// <summary> /// Initializes a new instance of the <see cref="Geopoint"/> class, a /// Wpf-enabled wrapper for <see cref="Windows.Devices.Geolocation.Geopoint"/> /// </summary> internal Geopoint(Windows.Devices.Geolocation.Geopoint instance) { this.UwpInstance = instance; }
/// <summary> /// <see cref="windows.UI.Xaml.Controls.Maps.MapControl"/> /// </summary> public void GetLocationFromOffset(Win32.UI.Controls.Interop.WinRT.Point offset, out windows.Devices.Geolocation.Geopoint location) => UwpControl.GetLocationFromOffset(offset.UwpInstance, out location);
/// <summary> /// <see cref="windows.UI.Xaml.Controls.Maps.MapControl"/> /// </summary> /// <returns>bool</returns> public bool TryGetLocationFromOffset(Win32.UI.Controls.Interop.WinRT.Point offset, AltitudeReferenceSystem desiredReferenceSystem, out windows.Devices.Geolocation.Geopoint location) => UwpControl.TryGetLocationFromOffset(offset.UwpInstance, (windows.Devices.Geolocation.AltitudeReferenceSystem)(int) desiredReferenceSystem, out location);
/// <summary> /// <see cref="windows.UI.Xaml.Controls.Maps.MapControl"/> /// </summary> public void GetLocationFromOffset(Point offset, out windows.Devices.Geolocation.Geopoint location) => UwpControl.GetLocationFromOffset(offset.UwpInstance, out location);
/// <summary> /// <see cref="Windows.UI.Xaml.Controls.Maps.MapControl"/> /// </summary> /// <returns>bool</returns> public bool TryGetLocationFromOffset(Point offset, out Windows.Devices.Geolocation.Geopoint location) => UwpControl.TryGetLocationFromOffset(offset.UwpInstance, out location);
private Geopoint(Windows.Devices.Geolocation.Geopoint point) { _point = point; }
private Geopoint(Windows.Devices.Geolocation.Geopoint point) { _point = point; }
public object Convert(object value, Type targetType, object parameter, string language) { Windows.Devices.Geolocation.Geopoint position = (Windows.Devices.Geolocation.Geopoint)value; return($"{System.Convert.ToDouble(position.Position.Altitude):N0} ft"); }
/// <summary> /// <see cref="windows.UI.Xaml.Controls.Maps.MapControl"/> /// </summary> public void GetLocationFromOffset(Point offset, AltitudeReferenceSystem desiredReferenceSystem, out windows.Devices.Geolocation.Geopoint location) => UwpControl.GetLocationFromOffset(offset.UwpInstance, (windows.Devices.Geolocation.AltitudeReferenceSystem)desiredReferenceSystem, out location);