コード例 #1
0
        /* -------------------------------------------------------------------------------------------------------------------------------
         * -------------------------------------------------------------------------------------------------------------------------------
         * ------------------------------------------------- Map drawing -----------------------------------------------------------------
         * -------------------------------------------------------------------------------------------------------------------------------
         * ------------------------------------------------------------------------------------------------------------------------------- */

        private void cmbMapType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var combo = sender as ComboBox;
            var sel   = combo.SelectedItem as ComboBoxItem;

            if (sel.Tag == null)
            {
                return;
            }
            // Find and remove the current basemap layer from the map
            if (MyMap == null)
            {
                return;
            }
            var oldBasemap = MyMap.Layers["BaseMap"];

            MyMap.Layers.Remove(oldBasemap);
            // Create a new basemap layer
            var newBasemap = new Esri.ArcGISRuntime.Layers.ArcGISTiledMapServiceLayer();

            // Set the ServiceUri with the url defined for the ComboBoxItem's Tag
            newBasemap.ServiceUri = sel.Tag.ToString();
            // Give the layer the same ID so it can still be found with the code above
            newBasemap.ID = "BaseMap";
            // Insert the new basemap layer as the first (bottom) layer in the map
            MyMap.Layers.Insert(0, newBasemap);
        }
コード例 #2
0
        private void drawLableLayer(bool enable)
        {
            var secondLayer = MyMap.Layers["SecondLayer"];

            if (secondLayer != null && enable == false)
            {
                MyMap.Layers.Remove(secondLayer);
            }
            else if (secondLayer == null && enable == true)
            {
                var newSecLayer = new Esri.ArcGISRuntime.Layers.ArcGISTiledMapServiceLayer();
                newSecLayer.ID         = "SecondLayer";
                newSecLayer.ServiceUri = "http://services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer";
                MyMap.Layers.Insert(1, newSecLayer);
            }
        }
コード例 #3
0
        private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var combo = sender as ComboBox;
            var sel = combo.SelectedItem as ComboBoxItem;
            if (sel.Tag == null) { return; }

            // Find and remove the current basemap layer from the map
            if (MyMap == null) { return; }
            var oldBasemap = MyMap.Layers["BaseMap"];
            MyMap.Layers.Remove(oldBasemap);

            // Create a new basemap layer
            var newBasemap = new Esri.ArcGISRuntime.Layers.ArcGISTiledMapServiceLayer();

            // Set the ServiceUri with the url defined for the ComboBoxItem's Tag
            newBasemap.ServiceUri = sel.Tag.ToString();

            // Give the layer the same ID so it can still be found with the code above
            newBasemap.ID = "BaseMap";

            // Insert the new basemap layer as the first (bottom) layer in the map
            MyMap.Layers.Insert(0, newBasemap);

        }