Example #1
0
        private void Roads_Click(object sender, RoutedEventArgs e)
        {
            RadioButton radio = sender as RadioButton;

            switch (radio.Name)
            {
            case "Roads":
                myMap.Style = MapStyle.Road;
                break;

            case "Hybrid":
                myMap.Style = MapStyle.AerialWithRoads;
                break;

            case "Satellite":
                myMap.Style = MapStyle.Aerial;
                break;

            case "Dark":
                myMap.StyleSheet = MapStyleSheet.RoadDark();
                break;

            default:
                break;
            }
        }
Example #2
0
        async void setUpMap()
        {
            _trafficMap.MapServiceToken = Instance.TrafficAPIKey;

            // Set your current location.
            var accessStatus = await Geolocator.RequestAccessAsync();

            switch (accessStatus)
            {
            case GeolocationAccessStatus.Allowed:

                // Get the current location.
                Geolocator  geolocator = new Geolocator();
                Geoposition pos        = await geolocator.GetGeopositionAsync();

                Geopoint myLocation = pos.Coordinate.Point;

                // Set the map location.
                _trafficMap.Center           = myLocation;
                _trafficMap.LandmarksVisible = true;
                break;

            case GeolocationAccessStatus.Denied:
                // Handle the case  if access to location is denied.
                break;

            case GeolocationAccessStatus.Unspecified:
                // Handle the case if  an unspecified error occurs.
                break;
            }

            _trafficMap.ZoomLevel  = 13;
            _trafficMap.StyleSheet = MapStyleSheet.RoadDark();
        }
Example #3
0
        private async Task SetupMap()
        {
            MapControlls.Opacity = 0;
            Map.Opacity          = 0;
            Map.ZoomLevel        = 16;
            Map.MapServiceToken  =
                "UOBcq7qYTGSBYjpdwGvJ~ZoDecyJEsIhjGowIczjaTg~AmjcaSnBVS38715lpzn_KgdYiQf1AZ5KG-mLQHi0QWfPcl0xmo9WftqZ4fZtVUyO";
            Map.StyleSheet         = MapStyleSheet.RoadDark();
            Map.TrafficFlowVisible = false;

            switch (await Geolocator.RequestAccessAsync())
            {
            case GeolocationAccessStatus.Unspecified:
                break;

            case GeolocationAccessStatus.Allowed:
                _geolocator.DesiredAccuracy = PositionAccuracy.High;
                var position = await _geolocator.GetGeopositionAsync();

                Model.CurrentPosition = position.Coordinate.Point;
                Map.Center            = Model.CurrentPosition;
                FadeInAnimation.Begin();

                _geolocator.PositionChanged += OnGeoPositionChanged;
                break;

            case GeolocationAccessStatus.Denied:
                break;

            default:
                break;
            }
        }
 private string GetMapStyleSheetName(MapStyleSheet styleSheet)
 {
     if (styleSheet == MapStyleSheet.Aerial())
     {
         return("Aerial");
     }
     else if (styleSheet == MapStyleSheet.AerialWithOverlay())
     {
         return("AerialWithOverlay");
     }
     else if (styleSheet == MapStyleSheet.RoadDark())
     {
         return("RoadDark");
     }
     else if (styleSheet == MapStyleSheet.RoadLight())
     {
         return("RoadLight");
     }
     else if (styleSheet == MapStyleSheet.RoadHighContrastDark())
     {
         return("RoadHighContrastDark");
     }
     else if (styleSheet == MapStyleSheet.RoadHighContrastLight())
     {
         return("RoadHighContrastLight");
     }
     else
     {
         return("Custom");
     }
 }
        private void SetMapStyleSheet()
        {
            switch (setDefaultStyleCombobox.SelectedIndex)
            {
            case 0:
                myMap.StyleSheet = MapStyleSheet.Aerial();
                break;

            case 1:
                myMap.StyleSheet = MapStyleSheet.AerialWithOverlay();
                break;

            case 2:
                myMap.StyleSheet = MapStyleSheet.RoadDark();
                break;

            case 3:
                myMap.StyleSheet = MapStyleSheet.RoadLight();
                break;

            case 4:
                myMap.StyleSheet = MapStyleSheet.RoadHighContrastDark();
                break;

            case 5:
                myMap.StyleSheet = MapStyleSheet.RoadHighContrastLight();
                break;

            case 6:
                myMap.StyleSheet = MapStyleSheet.ParseFromJson(@"
                        {
                            ""version"": ""1.0"",
                            ""settings"": {
                                ""landColor"": ""#FFFFFF"",
                                ""spaceColor"": ""#000000""
                            },
                            ""elements"": {
                                ""mapElement"": {
                                    ""labelColor"": ""#000000"",
                                    ""labelOutlineColor"": ""#FFFFFF""
                                },
                                ""water"": {
                                    ""fillColor"": ""#DDDDDD""
                                },
                                ""area"": {
                                    ""fillColor"": ""#EEEEEE""
                                },
                                ""political"": {
                                    ""borderStrokeColor"": ""#CCCCCC"",
                                    ""borderOutlineColor"": ""#00000000""
                                }
                            }
                        }
                    ");
                break;
            }
        }
 //Evento llamado cuando la pantalla ha sido cargada. Lo uso para establecer el Index de los los combos de los mapas, ya que al añadir sus items del combo en la función Main, no se puede establecer
 //su index en ella porque su valor aun es null. Por ello, los establezco en esta función, que es llamada posteriormente
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     //Estilo del mapa inicial 2d, correspondiente al index 1 de combo2d
     MapControl.StyleSheet = MapStyleSheet.RoadDark(); //Apariencia del Mapa. Por lo que dice la documentación, se pueden personalizar los colores
                                                       //de cada tipo de apariencia del mapa, para poder cambiarlos y crear nuestras propias apariencias https://docs.microsoft.com/en-us/windows/uwp/maps-and-location/elements-of-map-style-sheet
     combo2d.SelectedIndex = 1;
     combo3d.SelectedIndex = 0;
     Debug.WriteLine(combo2d.Width + " " + combo3d.Width);
 }
Example #7
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // Specify a known location.
            BasicGeoposition cityPosition = new BasicGeoposition()
            {
                Latitude = 46.283333, Longitude = 86.666667
            };
            Geopoint cityCenter = new Geopoint(cityPosition);

            // Set the map location.
            MapMaker.StyleSheet       = MapStyleSheet.RoadDark();
            MapMaker.Center           = cityCenter;
            MapMaker.ZoomLevel        = 12;
            MapMaker.LandmarksVisible = true;
        }
        //Función que establece el mapa con mapas 2D según el valor de su combo
        private void click_MapaNormal(object sender, RoutedEventArgs e)
        {
            switch (combo2d.SelectedIndex)
            {
            case 0:
                MapControl.StyleSheet = MapStyleSheet.Aerial();
                break;

            case 1:
                MapControl.StyleSheet = MapStyleSheet.RoadDark();
                break;

            case 2:
                MapControl.StyleSheet = MapStyleSheet.RoadLight();
                break;
            }
        }
Example #9
0
        async void setUpMap()
        {
            _trafficMap.MapServiceToken = Instance.TrafficAPIKey;

            // Set your current location.
            var accessStatus = await Geolocator.RequestAccessAsync();

            switch (accessStatus)
            {
            case GeolocationAccessStatus.Allowed:

                // Get the current location.
                Geolocator  geolocator = new Geolocator();
                Geoposition pos        = await geolocator.GetGeopositionAsync();

                Geopoint myLocation = pos.Coordinate.Point;

                //K-State Campus Location
                BasicGeoposition bgp = new BasicGeoposition();
                bgp.Latitude  = 39.1930;
                bgp.Longitude = -96.5740;
                Geopoint AndersonHall = new Geopoint(bgp);


                // Set the map location.
                _trafficMap.Center           = AndersonHall;
                _trafficMap.LandmarksVisible = true;
                _trafficMap.Height           = 450;
                _trafficMap.Width            = 350;
                break;

            case GeolocationAccessStatus.Denied:
                // Handle the case  if access to location is denied.
                break;

            case GeolocationAccessStatus.Unspecified:
                // Handle the case if  an unspecified error occurs.
                break;
            }

            _trafficMap.ZoomLevel  = 14;
            _trafficMap.StyleSheet = MapStyleSheet.RoadDark();
        }
        async void setUpMap()
        {
            _trafficMap.MapServiceToken    = Instance.TrafficAPIKey;
            _trafficMapBig.MapServiceToken = Instance.TrafficAPIKey;

            // Set your current location.
            var accessStatus = await Geolocator.RequestAccessAsync();

            switch (accessStatus)
            {
            case GeolocationAccessStatus.Allowed:

                // Get the current location.
                Geolocator  geolocator = new Geolocator();
                Geoposition pos        = await geolocator.GetGeopositionAsync();

                Geopoint myLocation = pos.Coordinate.Point;

                // Set the map location.
                _trafficMap.Center              = myLocation;
                _trafficMap.LandmarksVisible    = true;
                _trafficMapBig.Center           = myLocation;
                _trafficMapBig.LandmarksVisible = true;
                break;

            case GeolocationAccessStatus.Denied:
                // Handle the case  if access to location is denied.
                break;

            case GeolocationAccessStatus.Unspecified:
                // Handle the case if  an unspecified error occurs.
                break;
            }

            _trafficMap.ZoomLevel    = 13.55;
            _trafficMapBig.ZoomLevel = 14.65;
            //FIX, System.TypeLoadException: 'Requested Windows Runtime type 'Windows.UI.Xaml.Controls.Maps.MapStyleSheet' is not registered.'
            _trafficMap.StyleSheet    = MapStyleSheet.RoadDark();
            _trafficMapBig.StyleSheet = MapStyleSheet.RoadDark();
        }
Example #11
0
        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);
            }
        }