private void BasemapCombobox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                int index = BasemapCombobox.SelectedIndex;
                switch (index)
                {
                case 0:
                    MyMapView.Map.Basemap = Basemap.CreateStreetsVector();
                    break;

                case 1:
                    MyMapView.Map.Basemap = Basemap.CreateTopographicVector();
                    break;

                case 2:
                    MyMapView.Map.Basemap = Basemap.CreateImageryWithLabelsVector();
                    break;

                case 3:
                    MyMapView.Map.Basemap = Basemap.CreateStreetsNightVector();
                    break;

                default:
                    MyMapView.Map.Basemap = Basemap.CreateOpenStreetMap();
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public MapWindow()
        {
            InitializeComponent();
            scraper = new Scraper();
            Map covidMap = new Map(Basemap.CreateImageryWithLabelsVector());

            mapView.Map = covidMap;
            DrawAllPointsOnMap();
        }
        private void Initialize()
        {
            // Set a basemap.
            _myMapView.Map = new Map(Basemap.CreateImageryWithLabelsVector());

            // Apply a grid by default.
            ApplyCurrentSettings();

            // Zoom to a default scale that will show the grid labels if they are enabled.
            _myMapView.SetViewpointCenterAsync(
                new MapPoint(-7702852.905619, 6217972.345771, SpatialReferences.WebMercator), 23227);
        }
Exemple #4
0
        public static Basemap FromBasemapType(this BasemapType type)
        {
            switch (type)
            {
            case BasemapType.DarkGrayCanvasVector: return(Basemap.CreateDarkGrayCanvasVector());

            case BasemapType.Imagery: return(Basemap.CreateImagery());

            case BasemapType.ImageryWithLabels: return(Basemap.CreateImageryWithLabels());

            case BasemapType.ImageryWithLabelsVector: return(Basemap.CreateImageryWithLabelsVector());

            case BasemapType.LightGrayCanvas: return(Basemap.CreateLightGrayCanvas());

            case BasemapType.LightGrayCanvasVector: return(Basemap.CreateLightGrayCanvasVector());

            case BasemapType.NationalGeographic: return(Basemap.CreateNationalGeographic());

            case BasemapType.NavigationVector: return(Basemap.CreateNavigationVector());

            case BasemapType.Oceans: return(Basemap.CreateOceans());

            case BasemapType.OpenStreetMap: return(Basemap.CreateOpenStreetMap());

            case BasemapType.Streets: return(Basemap.CreateStreets());

            case BasemapType.StreetsNightVector: return(Basemap.CreateStreetsNightVector());

            case BasemapType.StreetsVector: return(Basemap.CreateStreetsVector());

            case BasemapType.StreetsWithReliefVector: return(Basemap.CreateStreetsWithReliefVector());

            case BasemapType.TerrainWithLabels: return(Basemap.CreateTerrainWithLabels());

            case BasemapType.TerrainWithLabelsVector: return(Basemap.CreateTerrainWithLabelsVector());

            case BasemapType.Topographic: return(Basemap.CreateTopographic());

            case BasemapType.TopographicVector: return(Basemap.CreateTopographicVector());

            default: throw new NotImplementedException(type.ToString());
            }
        }
        private void Initialize()
        {
            // Set up the map view with a basemap.
            MyMapView.Map = new Map(Basemap.CreateImageryWithLabelsVector());

            // Configure the UI options.
            GridTypeCombo.ItemsSource = new[] { "LatLong", "MGRS", "UTM", "USNG" };
            var colorItemsSource = new[] { Colors.Red, Colors.Green, Colors.Blue, Colors.White, Colors.Purple };

            GridColorCombo.ItemsSource     = colorItemsSource;
            LabelColorCombo.ItemsSource    = colorItemsSource;
            HaloColorCombo.ItemsSource     = colorItemsSource;
            LabelPositionCombo.ItemsSource = Enum.GetNames(typeof(GridLabelPosition));
            LabelFormatCombo.ItemsSource   = Enum.GetNames(typeof(LatitudeLongitudeGridLabelFormat));
            foreach (var combo in new[]
                     { GridTypeCombo, GridColorCombo, LabelColorCombo, HaloColorCombo, LabelPositionCombo, LabelFormatCombo })
            {
                combo.SelectedIndex = 0;
            }

            // Update the halo color so it isn't the same as the text color.
            HaloColorCombo.SelectedIndex = 3;

            // Subscribe to change events so the label format combo can be disabled as necessary.
            GridTypeCombo.SelectionChanged += (o, e) =>
            {
                LabelFormatCombo.IsEnabled = GridTypeCombo.SelectedItem.ToString() == "LatLong";
            };

            // Subscribe to the button click event.
            ApplySettingsButton.Click += ApplySettingsButton_Click;

            // Enable the action button.
            ApplySettingsButton.IsEnabled = true;

            // Zoom to a default scale that will show the grid labels if they are enabled.
            MyMapView.SetViewpointCenterAsync(
                new MapPoint(-7702852.905619, 6217972.345771, SpatialReferences.WebMercator), 23227);

            // Apply default settings.
            ApplySettingsButton_Click(this, null);
        }
        private void Initialize()
        {
            // Set up the map view with a basemap.
            MyMapView.Map = new Map(Basemap.CreateImageryWithLabelsVector());

            // Configure the UI options.
            gridTypeCombo.ItemsSource = new[] { "LatLong", "MGRS", "UTM", "USNG" };
            var colorItemsSource = new[] { "Red", "Green", "Blue", "White", "Purple" };

            gridColorCombo.ItemsSource     = colorItemsSource;
            labelColorCombo.ItemsSource    = colorItemsSource;
            haloColorCombo.ItemsSource     = colorItemsSource;
            labelPositionCombo.ItemsSource = Enum.GetNames(typeof(GridLabelPosition));
            labelFormatCombo.ItemsSource   = Enum.GetNames(typeof(LatitudeLongitudeGridLabelFormat));
            foreach (var combo in new[] { gridTypeCombo, gridColorCombo, labelColorCombo, labelPositionCombo, labelFormatCombo })
            {
                combo.SelectedIndex = 0;
            }

            // Apply a good default halo color selection.
            haloColorCombo.SelectedIndex = 3;

            // Subscribe to grid type change events in order to disable the format change option when it doesn't apply.
            gridTypeCombo.SelectionChanged += (o, e) =>
            {
                labelFormatCombo.IsEnabled = gridTypeCombo.SelectedItem.ToString() == "LatLong";
            };

            // Subscribe to the button click event.
            applySettingsButton.Click += ApplySettingsButton_Click;

            // Enable the action button.
            applySettingsButton.IsEnabled = true;

            // Zoom to a default scale that will show the grid labels if they are enabled.
            MyMapView.SetViewpointCenterAsync(
                new MapPoint(-7702852.905619, 6217972.345771, SpatialReferences.WebMercator), 23227);

            // Apply default settings.
            ApplySettingsButton_Click(this, null);
        }
Exemple #7
0
        private void Initialize()
        {
            // Define the route stop locations (points)
            MapPoint fromPoint = new MapPoint(-112.068962, 33.638390, SpatialReferences.Wgs84);
            MapPoint toPoint   = new MapPoint(-112.1028099, 33.7334937, SpatialReferences.Wgs84);

            // Create Stop objects with the points and add them to a list of stops
            Stop stop1 = new Stop(new MapPoint(-112.068962, 33.638390, SpatialReferences.Wgs84));
            Stop stop2 = new Stop(new MapPoint(-111.994930, 33.618900, SpatialReferences.Wgs84));
            Stop stop3 = new Stop(new MapPoint(-112.0021089, 33.6858299, SpatialReferences.Wgs84));
            Stop stop4 = new Stop(new MapPoint(-111.9734644, 33.6348065, SpatialReferences.Wgs84));
            Stop stop5 = new Stop(new MapPoint(-112.1028099, 33.7334937, SpatialReferences.Wgs84));

            _routeStops = new List <Stop> {
                stop1, stop2, stop3, stop4, stop5
            };

            //// Create Stop objects with the points and add them to a list of stops
            //Stop stop1 = new Stop(fromPoint);
            //Stop stop2 = new Stop(toPoint);
            //_routeStops = new List<Stop> { stop1, stop2 };

            // Picture marker symbols: from = car, to = checkered flag
            PictureMarkerSymbol carSymbol  = new PictureMarkerSymbol(_carIconUri);
            PictureMarkerSymbol flagSymbol = new PictureMarkerSymbol(_checkedFlagIconUri);

            // Add a slight offset (pixels) to the picture symbols.
            carSymbol.OffsetX  = -carSymbol.Width / 2;
            carSymbol.OffsetY  = -carSymbol.Height / 2;
            flagSymbol.OffsetX = -flagSymbol.Width / 2;
            flagSymbol.OffsetY = -flagSymbol.Height / 2;

            // Set the height and width.
            flagSymbol.Height = 60;
            flagSymbol.Width  = 60;
            carSymbol.Height  = 60;
            carSymbol.Width   = 60;

            // Create graphics for the stops
            Graphic fromGraphic = new Graphic(fromPoint, carSymbol)
            {
                ZIndex = 1
            };
            Graphic toGraphic = new Graphic(toPoint, flagSymbol)
            {
                ZIndex = 1
            };

            // Create the graphics overlay and add the stop graphics
            _routeGraphicsOverlay = new GraphicsOverlay();
            _routeGraphicsOverlay.Graphics.Add(fromGraphic);
            _routeGraphicsOverlay.Graphics.Add(toGraphic);

            // Get an Envelope that covers the area of the stops (and a little more)
            Envelope        routeStopsExtent = new Envelope(fromPoint, toPoint);
            EnvelopeBuilder envBuilder       = new EnvelopeBuilder(routeStopsExtent);

            envBuilder.Expand(1.5);

            // Create a new viewpoint apply it to the map view when the spatial reference changes
            Viewpoint sanDiegoViewpoint = new Viewpoint(envBuilder.ToGeometry());

            MyMapView.SpatialReferenceChanged += (s, e) => MyMapView.SetViewpoint(sanDiegoViewpoint);

            // Add a new Map and the graphics overlay to the map view
            MyMapView.Map = new Map(Basemap.CreateImageryWithLabelsVector());
            MyMapView.GraphicsOverlays.Add(_routeGraphicsOverlay);
        }
Exemple #8
0
        public Basemap GetBasemap(BasemapType basemapType)
        {
            Basemap basemap = null;

            switch (basemapType)
            {
            case BasemapType.Imagery:
                basemap = Basemap.CreateImagery();
                break;

            case BasemapType.ImageryWithLabels:
                basemap = Basemap.CreateImageryWithLabels();
                break;

            case BasemapType.Streets:
                basemap = Basemap.CreateStreets();
                break;

            case BasemapType.Topographic:
                basemap = Basemap.CreateTopographic();
                break;

            case BasemapType.TerrainWithLabels:
                basemap = Basemap.CreateTerrainWithLabels();
                break;

            case BasemapType.LightGrayCanvas:
                basemap = Basemap.CreateLightGrayCanvas();
                break;

            case BasemapType.NationalGeographic:
                basemap = Basemap.CreateNationalGeographic();
                break;

            case BasemapType.Oceans:
                basemap = Basemap.CreateOceans();
                break;

            case BasemapType.OpenStreetMap:
                basemap = Basemap.CreateOpenStreetMap();
                break;

            case BasemapType.ImageryWithLabelsVector:
                basemap = Basemap.CreateImageryWithLabelsVector();
                break;

            case BasemapType.StreetsVector:
                basemap = Basemap.CreateStreetsVector();
                break;

            case BasemapType.TopographicVector:
                basemap = Basemap.CreateTopographicVector();
                break;

            case BasemapType.TerrainWithLabelsVector:
                basemap = Basemap.CreateTerrainWithLabelsVector();
                break;

            case BasemapType.LightGrayCanvasVector:
                basemap = Basemap.CreateLightGrayCanvasVector();
                break;

            case BasemapType.NavigationVector:
                basemap = Basemap.CreateNavigationVector();
                break;

            case BasemapType.StreetsNightVector:
                basemap = Basemap.CreateStreetsVector();
                break;

            case BasemapType.StreetsWithReliefVector:
                basemap = Basemap.CreateStreetsWithReliefVector();
                break;

            case BasemapType.DarkGrayCanvasVector:
                basemap = Basemap.CreateDarkGrayCanvasVector();
                break;

            default:
                break;
            }

            return(basemap);
        }
Exemple #9
0
        public Basemap GetBaseMap(CusMapView cusMapView)
        {
            switch (cusMapView.Map.MapType)
            {
            case MapType.Imagery:
                return(Basemap.CreateImagery());

            case MapType.Streets:
                return(Basemap.CreateStreets());

            case MapType.ImageryWithLabels:
                return(Basemap.CreateImageryWithLabels());

            case MapType.ImageryWithLabelsVector:
                return(Basemap.CreateImageryWithLabelsVector());

            case MapType.LightGrayCanvas:
                return(Basemap.CreateLightGrayCanvas());

            case MapType.LightGrayCanvasVector:
                return(Basemap.CreateLightGrayCanvasVector());

            case MapType.DarkGrayCanvasVector:
                return(Basemap.CreateDarkGrayCanvasVector());

            case MapType.NationalGeographic:
                return(Basemap.CreateNationalGeographic());

            case MapType.Oceans:
                return(Basemap.CreateOceans());

            case MapType.StreetsVector:
                return(Basemap.CreateStreetsVector());

            case MapType.StreetsWithReliefVector:
                return(Basemap.CreateStreetsWithReliefVector());

            case MapType.StreetsNightVector:
                return(Basemap.CreateStreetsNightVector());

            case MapType.NavigationVector:
                return(Basemap.CreateNavigationVector());

            case MapType.TerrainWithLabels:
                return(Basemap.CreateTerrainWithLabels());

            case MapType.TerrainWithLabelsVector:
                return(Basemap.CreateTerrainWithLabelsVector());

            case MapType.Topographic:
                return(Basemap.CreateTopographic());

            case MapType.TopographicVector:
                return(Basemap.CreateTopographicVector());

            case MapType.OpenStreetMap:
                return(Basemap.CreateOpenStreetMap());

            case MapType.WebMap:
                if (!string.IsNullOrEmpty(cusMapView.Map.WebMapUrl))
                {
                    return(new Basemap(new Uri(cusMapView.Map.WebMapUrl)));
                }

                throw new ArgumentOutOfRangeException(nameof(cusMapView.Map.WebMapUrl), cusMapView.Map.WebMapUrl, null);

            default:
                throw new ArgumentOutOfRangeException(nameof(cusMapView.Map.MapType), cusMapView.Map.MapType, null);
            }
        }