private async void MyMap_Loaded(object sender, RoutedEventArgs e) { if (MyMap.Is3DSupported) { MyMap.Style = MapStyle.Aerial3DWithRoads; MyMap.MapServiceToken = "iXNUzZxjjglXbxTQI3u2~5bxFRFZESkZUVlrEuPtCxg~AmcMVqUdyZW960FDSNF28-MUt_Thri564P4V3oHEyVEATyV-dHL9DdkBBRuxsdmI"; geoPosition.Latitude = this.latitude; //geoPosition.Latitude = 20.0791441598; geoPosition.Longitude = this.longitude; //geoPosition.Longitude = -98.3714238064418; Geopoint myPoint = new Geopoint(geoPosition); MapIcon myPOI = new MapIcon { Location = myPoint, Title = "Position", NormalizedAnchorPoint = new Point(0.5, 1.0), ZIndex = 0 }; myPOI.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/pin.png")); MyMap.MapElements.Add(myPOI); MyMap.Center = myPoint; MyMap.ZoomLevel = 3; Debug.WriteLine("Coordenadas: " + latitude + " y " + longitude); MapScene mapScene = MapScene.CreateFromLocationAndRadius(new Geopoint(geoPosition), 500, 150, 70); await MyMap.TrySetSceneAsync(mapScene, MapAnimationKind.Bow); } else { // If 3D views are not supported, display dialog. ContentDialog viewNotSupportedDialog = new ContentDialog() { Title = "3D is not supported", Content = "\n3D views are not supported on this device.", PrimaryButtonText = "OK" }; await viewNotSupportedDialog.ShowAsync(); } }
private async void showSpaceNeedleButton_Click(object sender, RoutedEventArgs e) { if (myMap.Is3DSupported) { this.myMap.Style = MapStyle.Aerial3DWithRoads; BasicGeoposition spaceNeedlePosition = new BasicGeoposition(); spaceNeedlePosition.Latitude = 47.6204; spaceNeedlePosition.Longitude = -122.3491; Geopoint spaceNeedlePoint = new Geopoint(spaceNeedlePosition); MapScene spaceNeedleScene = MapScene.CreateFromLocationAndRadius(spaceNeedlePoint, 400, /* show this many meters around */ 135, /* looking at it to the south east*/ 60 /* degrees pitch */); await myMap.TrySetSceneAsync(spaceNeedleScene); } else { string status = "3D views are not supported on this device."; rootPage.NotifyUser(status, NotifyType.ErrorMessage); } }
//Función que establece el mapa con mapas 3D según el valor de su combo private async void map_tresD(object sender, RoutedEventArgs e) { if (MapControl.Is3DSupported) { // Se establece el mapa mediante el valor actual del combo3D MapControl.Style = estilos3DMapa[combo3d.SelectedIndex]; // Se crea la escena del Mapa 3D MapScene hwScene = MapScene.CreateFromLocationAndRadius(miPosiciónActual, 80, // cuantos metros se ve alrededor 0, //grados con respecto al Norte 60); //inclinación del mapa // Se establece la animación con la que aparecerá el mapa 3D await MapControl.TrySetSceneAsync(hwScene, MapAnimationKind.Linear); } else { // Si no se soporta el modo 3D, se muestra un dialogo ContentDialog viewNotSupportedDialog = new ContentDialog() { Title = "3D no soportado", Content = "La vista 3D del Mapa no es soportada en tu dispositvo.", PrimaryButtonText = "OK" }; await viewNotSupportedDialog.ShowAsync(); } }
private async void button1_Click(object sender, RoutedEventArgs e) { if (MapControl1.Is3DSupported) { MapControl1.Style = MapStyle.Aerial3D; BasicGeoposition hwGeoposition = new BasicGeoposition() { Latitude = 48.858, Longitude = 2.295 }; Geopoint hwPoint = new Geopoint(hwGeoposition); MapScene hwScene = MapScene.CreateFromLocationAndRadius(hwPoint, 80, 0, 60); await MapControl1.TrySetSceneAsync(hwScene, MapAnimationKind.Bow); } else { ContentDialog viewNotSupportedDialog = new ContentDialog() { Title = "3D is not supported", Content = "\n3D views are not supported on this device.", PrimaryButtonText = "OK" }; await viewNotSupportedDialog.ShowAsync(); } }
private async void movieMap_MapElementClick(MapControl sender, MapElementClickEventArgs args) { MapIcon topMost = args.MapElements[0] as MapIcon; if (topMost.Title == "Lots of Movie Spots") { if (movieMap.ZoomLevel < 16) { //await movieMap.TrySetViewAsync(args.Location, 16); await movieMap.TrySetSceneAsync( MapScene.CreateFromLocationAndRadius(args.Location, 500, 45, 50)); } else { await movieMap.TrySetViewAsync(args.Location, movieMap.ZoomLevel + 2); } } else { MovieInfoPanel infoPanel = new MovieInfoPanel { ClickedLocation = topMost.Location }; infoPanel.Closed += infoPanel_Closed; movieMap.Children.Add(infoPanel); MapControl.SetLocation(infoPanel, topMost.Location); } }
//private async void Button_Click(object sender, RoutedEventArgs e) //{ // var pos = await LocationManager.GetLocation(); // var lat = pos.Coordinate.Latitude; // var lon = pos.Coordinate.Latitude; // var weather = await WeatherProxyMap.GetWeather(lat, lon); // WeatherCondition.Text = ((int)weather.main.temp).ToString() + " " + weather.name; //} private async void Button_Click_1(object sender, RoutedEventArgs e) { //Show Weather var citySearch = CitySearch.Text; var weather = await WeatherProxyMapByCity.GetWeather(citySearch); CityNameTxtBlock.Text = ((int)weather.main.temp).ToString() + " " + weather.name; //Show on map var address = citySearch; var results = await MapLocationFinder.FindLocationsAsync(address, null); if (results.Status == MapLocationFinderStatus.Success) { var lat = results.Locations[0].Point.Position.Latitude; var lon = results.Locations[0].Point.Position.Longitude; var center = new Geopoint(new BasicGeoposition() { Latitude = lat, Longitude = lon }); await MyMap.TrySetSceneAsync(MapScene.CreateFromLocationAndRadius(center, 3000)); } }
private async void MapControlLoaded(object sender, RoutedEventArgs e) { myMapControl.Center = new Geopoint(seattleLocation); myMapControl.ZoomLevel = 12; if (myMapControl.Is3DSupported) { this.myMapControl.Style = MapStyle.Aerial3DWithRoads; Geopoint spaceNeedlePoint = new Geopoint(seattleLocation); MapScene spaceNeedleScene = MapScene.CreateFromLocationAndRadius(spaceNeedlePoint, 400, /* show this many meters around */ 135, /* looking at it to the south east*/ 60 /* degrees pitch */); await myMapControl.TrySetSceneAsync(spaceNeedleScene); } else { //string status = "3D views are not supported on this device."; this.myMapControl.Style = MapStyle.Aerial; } MapIcon seattleMapIcon = new MapIcon(); seattleMapIcon.Location = new Geopoint(seattleLocation); seattleMapIcon.NormalizedAnchorPoint = new Point(0.5, 1.0); seattleMapIcon.Title = "Parking here"; seattleMapIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/mappin.png")); myMapControl.MapElements.Add(seattleMapIcon); }
private async void MyMap_Loaded(object sender, RoutedEventArgs e) { if (MyMap.Is3DSupported) { MyMap.Style = MapStyle.Aerial3DWithRoads; //MyMap.Style = MapStyle.Terrain; MyMap.MapServiceToken = "Your Service Token"; BasicGeoposition geoPosition = new BasicGeoposition(); geoPosition.Latitude = 27.175015; geoPosition.Longitude = 78.042155; // get position Geopoint myPoint = new Geopoint(geoPosition); //create POI MapIcon myPOI = new MapIcon { Location = myPoint, Title = "My Position", NormalizedAnchorPoint = new Point(0.5, 1.0), ZIndex = 0 }; // Display an image of a MapIcon myPOI.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/pin.png")); // add to map and center it MyMap.MapElements.Add(myPOI); MyMap.Center = myPoint; MyMap.ZoomLevel = 10; MapScene mapScene = MapScene.CreateFromLocationAndRadius(new Geopoint(geoPosition), 500, 150, 70); await MyMap.TrySetSceneAsync(mapScene); } }
private async void Map3D_Click(object sender, RoutedEventArgs e) { MapControl.CustomExperience = null; if (MapControl.Is3DSupported) { // Set the aerial 3D view. MapControl.Style = MapStyle.Aerial3DWithRoads; // Specify the location. BasicGeoposition hwGeoposition = new BasicGeoposition() { Latitude = 34.134, Longitude = -118.3216 }; Geopoint hwPoint = new Geopoint(hwGeoposition); // Create the map scene. MapScene hwScene = MapScene.CreateFromLocationAndRadius(hwPoint, 60 /* degrees pitch */); // Set the 3D view with animation. await MapControl.TrySetSceneAsync(hwScene, MapAnimationKind.Bow); } else { // If 3D views are not supported, display dialog. ContentDialog viewNotSupportedDialog = new ContentDialog() { Title = "3D is not supported", Content = "\n3D views are not supported on this device.", PrimaryButtonText = "OK" }; await viewNotSupportedDialog.ShowAsync(); Point t = MapControl.RenderTransformOrigin; } }
public async void Mapping(double lat, double lon) { if (MyMap.Is3DSupported) { // Estilo del mapa MyMap.Style = MapStyle.Road; // llave de bing MyMap.MapServiceToken = "iXNUzZxjjglXbxTQI3u2~5bxFRFZESkZUVlrEuPtCxg~AmcMVqUdyZW960FDSNF28-MUt_Thri564P4V3oHEyVEATyV-dHL9DdkBBRuxsdmI"; BasicGeoposition geoPosition = new BasicGeoposition(); geoPosition.Latitude = lat; //geoPosition.Latitude = 20.0791441598; geoPosition.Longitude = lon; //geoPosition.Longitude = -98.3714238064418; // obtiene posición Geopoint myPoint = new Geopoint(geoPosition); // crea POI MapIcon myPOI = new MapIcon { Location = myPoint, Title = "Position", NormalizedAnchorPoint = new Point(0.5, 1.0), ZIndex = 0 }; // Despliega una imagen de un MapIcon myPOI.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/pin.png")); // Agrega el mapa y lo centra MyMap.MapElements.Add(myPOI); MyMap.Center = myPoint; MyMap.ZoomLevel = 10; Debug.WriteLine("Coordenadas: " + latitude + " y " + longitude); MapScene mapScene = MapScene.CreateFromLocationAndRadius(new Geopoint(geoPosition), 200, 150, 70); await MyMap.TrySetSceneAsync(mapScene); } }
/// <summary> /// This method sets the location on the Map. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void SculptureMap_OnLoaded(object sender, RoutedEventArgs e) { var center = new Geopoint(new BasicGeoposition() { Latitude = Latitude, Longitude = Longitude }); await sculptureMap.TrySetSceneAsync(MapScene.CreateFromLocationAndRadius(center, 3500), MapAnimationKind.Bow); }
/// <summary> /// este método nos muestra el mapa de Sevilla /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void Mapsample_Loaded(object sender, RoutedEventArgs e) { var center = new Geopoint(new BasicGeoposition() { //latitud y longitud de la capital de armenia y los que estan en comentario son de sevilla Latitude = 40.1811104 /*37.3828300*/, Longitude = 44.5136108 //-5.9731700 }); await Map.TrySetSceneAsync(MapScene.CreateFromLocationAndRadius(center, 3000)); }
private async void MyMap_loadedAsync(object sender, RoutedEventArgs e) { var center = new Geopoint(new BasicGeoposition() { Latitude = 52.707, Longitude = -2.645 }); // retrieve map await myMap.TrySetSceneAsync(MapScene.CreateFromLocationAndRadius(center, 200)); }
private async void LoadMap(DojoLocation location) { Geopoint eventLocation = GenerateGeoPoint(location); MapIcon myPOI = new MapIcon { Location = eventLocation, NormalizedAnchorPoint = new Point(0.5, 1.0), Title = "Coder Dojo!", ZIndex = 0 }; EventMap.MapElements.Add(myPOI); await EventMap.TrySetSceneAsync(MapScene.CreateFromLocationAndRadius(eventLocation, 150)); }
public async Task <int> posUmi(Geopoint p) { // userMapIcon has not been added. if (map.Children.IndexOf(userMapIcon) == -1) { map.Children.Add(userMapIcon); } MapControl.SetLocation(userMapIcon, p); MapControl.SetNormalizedAnchorPoint(userMapIcon, new Point(0.5, 0.5)); await map.TrySetSceneAsync(MapScene.CreateFromLocationAndRadius(p, 1000)); return(0); }
private async void MyMap_Loaded(object sender, RoutedEventArgs e) { // center on Notre Dame Cathedral var center = new Geopoint(new BasicGeoposition() { Latitude = 48.8530, Longitude = 2.3498 }); // retrieve map await myMap.TrySetSceneAsync(MapScene.CreateFromLocationAndRadius(center, 3000)); }
private async void MainMap_Loaded(object sender, RoutedEventArgs e) { var centre = new Geopoint(new BasicGeoposition() { Latitude = 41.874442, Longitude = -87.656971 }); await mainMap.TrySetSceneAsync(MapScene.CreateFromLocationAndRadius(centre, 1500)); SetupPages.KidsNamesCD Kids = new SetupPages.KidsNamesCD(); await Kids.ShowAsync(); SetMapElements(); }
private async void Button_Click(object sender, RoutedEventArgs e) { var position = await LocationManager.GetLocation(); var lon = position.Coordinate.Longitude; var lat = position.Coordinate.Latitude; var center = new Geopoint(new BasicGeoposition() { Latitude = lat, Longitude = lon }); await MyMap.TrySetSceneAsync(MapScene.CreateFromLocationAndRadius(center, 3000)); }
private async void MyListView_sm_ItemClick(object sender, ItemClickEventArgs e) { station = e.ClickedItem as Station; MyMap.Center = new Geopoint(new BasicGeoposition() { Latitude = station.Lat, Longitude = station.Long }); MapScene mp = MapScene.CreateFromLocationAndRadius(new Geopoint(new BasicGeoposition() { Latitude = station.Lat, Longitude = station.Long }), 800); await MyMap.TrySetSceneAsync(mp); }
private async Task <int> asb_QuerySubmit() { var siteNames = app.vm.m.sitesStrDict.Keys; var findSite = siteNames.Where(sn => sn == asb.Text); if (findSite.Count() != 0) { var findSiteName = findSite.First(); var p = new Geopoint(new BasicGeoposition { Latitude = double.Parse(app.vm.m.sitesStrDict[findSiteName]["TWD97Lat"]), Longitude = double.Parse(app.vm.m.sitesStrDict[findSiteName]["TWD97Lon"]) }); await map.TrySetSceneAsync(MapScene.CreateFromLocationAndRadius(p, 1000)); } return(0); }
private async Task GetCurrentLocation() { MyProgressRing.IsActive = true; MyMap.Opacity = 0.5; try { if (MyMap.MapElements.Count > Stations.Count) { MyMap.MapElements.RemoveAt(MyMap.MapElements.Count - 1); } var geoLocator = new Geolocator(); var position = await geoLocator.GetGeopositionAsync(); var mapLocation = await MapLocationFinder.FindLocationsAtAsync(position.Coordinate.Point); if (mapLocation.Status == MapLocationFinderStatus.Success) { BasicGeoposition basicGeoposition = new BasicGeoposition(); basicGeoposition.Latitude = position.Coordinate.Point.Position.Latitude; basicGeoposition.Longitude = position.Coordinate.Point.Position.Longitude; Geopoint point = new Geopoint(basicGeoposition); CurrentPosition = point; MapIcon mapIcon = new MapIcon() { Location = point, Title = "Me" }; MyMap.MapElements.Add(mapIcon); MyMap.Center = point; MapScene mp = MapScene.CreateFromLocationAndRadius(new Geopoint(new BasicGeoposition() { Latitude = point.Position.Latitude, Longitude = point.Position.Longitude }), 800); await MyMap.TrySetSceneAsync(mp); } } catch { MessageDialog m = new MessageDialog("failed to get your location.\nTurn on your location and try again."); await m.ShowAsync(); } MyMap.Opacity = 1; MyProgressRing.IsActive = false; }
private async void MapWorld_Loaded(object sender, RoutedEventArgs e) { var accessStatus = await Geolocator.RequestAccessAsync(); Geolocator geolocator = new Geolocator { DesiredAccuracyInMeters = 10 }; Geoposition position = await geolocator.GetGeopositionAsync(); double latitude = position.Coordinate.Latitude; double longitude = position.Coordinate.Longitude; var center = new Geopoint(new BasicGeoposition() { Latitude = latitude, Longitude = longitude }); await mapWorld.TrySetSceneAsync(MapScene.CreateFromLocationAndRadius(center, 3000)); }
private async void display3DLocation() { BasicGeoposition cityPosition = new BasicGeoposition() { Latitude = 55.6509863734914, Longitude = 37.6680877307923, Altitude = 10 }; SeattleLocation1 = new Geopoint(cityPosition); Geopoint cityCenter = new Geopoint(cityPosition); if (MapControl1.Is3DSupported) { // Set the aerial 3D view. MapControl1.Style = MapStyle.Terrain; // Specify the location. BasicGeoposition hwGeoposition = new BasicGeoposition() { Latitude = cityCenter.Position.Latitude, Longitude = cityCenter.Position.Longitude, Altitude = cityCenter.Position.Altitude }; Geopoint hwPoint = new Geopoint(hwGeoposition); // Create the map scene. MapScene hwScene = MapScene.CreateFromLocationAndRadius(hwPoint, 80, /* show this many meters around */ 0, /* looking at it to the North*/ 60 /* degrees pitch */); // Set the 3D view with animation. await MapControl1.TrySetSceneAsync(hwScene, MapAnimationKind.Bow); } else { // If 3D views are not supported, display dialog. ContentDialog viewNotSupportedDialog = new ContentDialog() { Title = "3D is not supported", Content = "\n3D views are not supported on this device.", PrimaryButtonText = "OK" }; await viewNotSupportedDialog.ShowAsync(); } }
/// <summary> /// update map with pin and given location from device /// </summary> /// <param name="lat"></param> /// <param name="lng"></param> /// <param name="timestamp"></param> public async void SetMapLocation(double lat, double lng, string timestamp) { var center = new Geopoint(new BasicGeoposition() { Latitude = lat, Longitude = lng }); // retrieve map try { await myMap.TrySetSceneAsync(MapScene.CreateFromLocationAndRadius(center, 250)); deviceLoc.Location = center; deviceLoc.Title = timestamp; } catch (System.Exception e) { Debug.WriteLine(e.Message); AddMessageToLog(e.Message); } }
private void UpdatePosition(double latitude, double longitude) { try { var position = new BasicGeoposition(); position.Latitude = latitude; position.Longitude = longitude; var location = new Geopoint(position); var mapScene = MapScene.CreateFromLocationAndRadius(location, 500); var trySetSceneAsync = WorldMap.TrySetSceneAsync(mapScene); if (!trySetSceneAsync.GetResults()) { Debug.WriteLine("Set scene failed but that's okay."); } } catch (Exception ex) { Debug.WriteLine(ex); } }
private async void AddMarker(Geopoint geopoint) { var marker = new MapIcon { Location = geopoint, NormalizedAnchorPoint = new Point(0.5, 1.0), ZIndex = 0, Title = "Your Shop" }; var locationMarkers = new List <MapElement>(); locationMarkers.Add(marker); var markersLayer = new MapElementsLayer { ZIndex = 1, MapElements = locationMarkers }; BingMap.Layers.Clear(); BingMap.Layers.Add(markersLayer); await BingMap.TrySetSceneAsync(MapScene.CreateFromLocationAndRadius(geopoint, 5000)); }
private async void MyMap_Loaded(object sender, RoutedEventArgs e) { if (MyMap.Is3DSupported) { MyMap.Style = MapStyle.Aerial3DWithRoads; MyMap.StyleSheet = MapStyleSheet.RoadDark(); BasicGeoposition geoPosition = new BasicGeoposition(); geoPosition.Latitude = 41.790366; geoPosition.Longitude = -6.760116; Geopoint myPoint = new Geopoint(geoPosition); MyMap.Center = myPoint; MyMap.ZoomLevel = 10; MapScene hwScene = MapScene.CreateFromLocationAndRadius(myPoint, 80, 0, 60); await MyMap.TrySetSceneAsync(hwScene, MapAnimationKind.Bow); MapScene mapScene = MapScene.CreateFromLocationAndRadius(new Geopoint(geoPosition), 500, 150, 70); await MyMap.TrySetSceneAsync(mapScene); } }
public async void Show3D(object sender, RoutedEventArgs e) { Flyout?.Hide(); // sender is the button - and the data context is the Sight CurrentSight = ((Button)sender).DataContext as Sight; if (CurrentSight == null) { return; } if (Map.Is3DSupported) { // Set the aerial 3D view. Map.Style = MapStyle.Aerial3DWithRoads; // Create the map scene. var hwScene = MapScene.CreateFromLocationAndRadius(CurrentSight.Location, 200, /* show this many meters around */ 0, /* looking at it to the North*/ 60 /* degrees pitch */); // Set the 3D view with animation. await Map.TrySetSceneAsync(hwScene, MapAnimationKind.Bow); IsDisplay3D = true; } else { // If 3D views are not supported, display dialog. var viewNotSupportedDialog = new ContentDialog { Title = "3D is not supported", Content = "\n3D views are not supported on this device.", PrimaryButtonText = "OK" }; await viewNotSupportedDialog.ShowAsync(); } }
//Vista en 3d private async void display3DLocation(double lati, double longi) { if (myMap.Is3DSupported) { // Set the aerial 3D view. myMap.Style = MapStyle.Aerial3DWithRoads; // Specify the location. // 43.773251 // 11.255474 BasicGeoposition hwGeoposition = new BasicGeoposition() { Latitude = lati, Longitude = longi }; Geopoint hwPoint = new Geopoint(hwGeoposition); // Create the map scene. MapScene hwScene = MapScene.CreateFromLocationAndRadius(hwPoint, 80, /* show this many meters around */ 0, /* looking at it to the North*/ 60 /* degrees pitch */); // Set the 3D view with animation. await myMap.TrySetSceneAsync(hwScene, MapAnimationKind.Bow); } else { // If 3D views are not supported, display dialog. ContentDialog viewNotSupportedDialog = new ContentDialog() { Title = "3D is not supported", Content = "\n3D views are not supported on this device.", PrimaryButtonText = "OK" }; await viewNotSupportedDialog.ShowAsync(); } }
private async void EnsureMapView() { await System.Threading.Tasks.Task.Delay(2000); var toolbar = flightMap.FindDescendant <StackPanel>(); if (toolbar != null) { toolbar.Visibility = Visibility.Visible; } var swapchainpanel = flightMap.FindDescendant <SwapChainPanel>(); if (swapchainpanel != null && swapchainpanel.Parent != null) { (swapchainpanel.Parent as Grid).AddMapOverlay(); } flightMap.Style = MapStyle.Aerial3DWithRoads; await flightMap.TrySetSceneAsync(MapScene.CreateFromLocationAndRadius(Helpers.MapHelper.AreaCenter, Common.CoreConstants.AreaRadius)); }