コード例 #1
0
        private void OnBasemapsMenuItemClicked(object sender, PopupMenu.MenuItemClickEventArgs e)
        {
            // Get the title of the selected item
            string selectedBasemapType = e.Item.TitleCondensedFormatted.ToString();

            // Apply the chosen basemap
            switch (selectedBasemapType)
            {
            case "Topographic":
                // Set the basemap to Topographic
                _myMapView.Map.Basemap = Basemap.CreateTopographic();
                break;

            case "Streets":
                // Set the basemap to Streets
                _myMapView.Map.Basemap = Basemap.CreateStreets();
                break;

            case "Imagery":
                // Set the basemap to Imagery
                _myMapView.Map.Basemap = Basemap.CreateImagery();
                break;

            case "Oceans":
                // Set the basemap to Oceans
                _myMapView.Map.Basemap = Basemap.CreateOceans();
                break;
            }
        }
コード例 #2
0
        private void OnBasemapsMenuItemClicked(object sender, PopupMenu.MenuItemClickEventArgs e)
        {
            // Get title from the selected item
            var selectedBasemapType = e.Item.TitleCondensedFormatted.ToString();

            // Get index that is used to get the selected url
            var selectedIndex = _basemapTypes.ToList().IndexOf(selectedBasemapType);

            switch (selectedIndex)
            {
            case 0:

                // Set the basemap to Topographic
                _myMapView.Map.Basemap = Basemap.CreateTopographic();
                break;

            case 1:

                // Set the basemap to Streets
                _myMapView.Map.Basemap = Basemap.CreateStreets();
                break;

            case 2:

                // Set the basemap to Imagery
                _myMapView.Map.Basemap = Basemap.CreateImagery();
                break;

            case 3:

                // Set the basemap to Oceans
                _myMapView.Map.Basemap = Basemap.CreateOceans();
                break;
            }
        }
コード例 #3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Create a new MapView control and provide its location coordinates on the frame
            _myMapView       = new MapView();
            _myMapView.Frame = new CoreGraphics.CGRect(0, 0, View.Bounds.Width, View.Bounds.Height);

            // Create a new Map instance with the basemap
            Map myMap = new Map(SpatialReferences.WebMercator);

            myMap.Basemap = Basemap.CreateTopographic();

            // Assign the Map to the MapView
            _myMapView.Map = myMap;

            // Create a segmented control to display buttons
            _segmentControl       = new UISegmentedControl();
            _segmentControl.Frame = new CoreGraphics.CGRect(8, 8, View.Bounds.Width - 16, 24);
            _segmentControl.InsertSegment("Topo", 0, false);
            _segmentControl.InsertSegment("Streets", 1, false);
            _segmentControl.InsertSegment("Imagery", 2, false);
            _segmentControl.InsertSegment("Ocean", 3, false);

            _segmentControl.SelectedSegment = 0;

            _segmentControl.ValueChanged += (sender, e) =>
            {
                var selectedSegmentId = (sender as UISegmentedControl).SelectedSegment;

                switch (selectedSegmentId)
                {
                case 0:

                    // Set the basemap to Topographic
                    _myMapView.Map.Basemap = Basemap.CreateTopographic();
                    break;

                case 1:

                    // Set the basemap to Streets
                    _myMapView.Map.Basemap = Basemap.CreateStreets();
                    break;

                case 2:

                    // Set the basemap to Imagery
                    _myMapView.Map.Basemap = Basemap.CreateImagery();
                    break;

                case 3:

                    // Set the basemap to Oceans
                    _myMapView.Map.Basemap = Basemap.CreateOceans();
                    break;
                }
            };

            View.AddSubviews(_myMapView, _toolbar, _segmentControl);
        }
コード例 #4
0
        private void ApplyBasemap(string basemapName)
        {
            // Set the basemap for the map according to the user's choice in the list box
            Map myMap = MyMapView.Map;

            switch (basemapName)
            {
            case "Light Gray":
                // Set the basemap to Light Gray Canvas
                myMap.Basemap = Basemap.CreateLightGrayCanvas();
                break;

            case "Topographic":
                // Set the basemap to Topographic
                myMap.Basemap = Basemap.CreateTopographic();
                break;

            case "Streets":
                // Set the basemap to Streets
                myMap.Basemap = Basemap.CreateStreets();
                break;

            case "Imagery":
                // Set the basemap to Imagery
                myMap.Basemap = Basemap.CreateImagery();
                break;

            case "Ocean":
                // Set the basemap to Oceans
                myMap.Basemap = Basemap.CreateOceans();
                break;
            }
        }
        private void OnBasemapListSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var selectedBasemap = e.AddedItems[0].ToString();

            switch (selectedBasemap)
            {
            case "Topo":
                // Set the basemap to Topographic
                MyMapView.Map.Basemap = Basemap.CreateTopographic();
                break;

            case "Streets":
                // Set the basemap to Streets
                MyMapView.Map.Basemap = Basemap.CreateStreets();
                break;

            case "Imagery":
                // Set the basemap to Imagery
                MyMapView.Map.Basemap = Basemap.CreateImagery();
                break;

            case "Ocean":
                // Set the basemap to Oceans
                MyMapView.Map.Basemap = Basemap.CreateOceans();
                break;

            default:
                break;
            }
        }
コード例 #6
0
        public void agSetupScene()
        {
            //MySceneView.Scene = new Scene(Basemap.CreateLightGrayCanvas());
            MySceneView.Scene = new Scene(Basemap.CreateOceans());

            MySceneView.Scene.BaseSurface.ElevationSources.Add(new ArcGISTiledElevationSource(new System.Uri("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer")));

            MySceneView.StereoRendering          = new SideBySideBarrelDistortionStereoRendering();
            MySceneView.IsAttributionTextVisible = false;

            // USC
            //camera = new Camera(34.02209, -118.2853, 300, 0, 0, 0);

            // downtown high
            camera = new Camera(34.048008, -118.257687, 1000, 0, 0, 0);


            MySceneView.SetViewpointCamera(camera);

            fpcController = new FirstPersonCameraController(camera);

            var phoneSensors = new PhoneMotionDataSource();

            fpcController.DeviceMotionDataSource = phoneSensors;
            fpcController.Framerate      = FirstPersonFrameRate.Speed;
            MySceneView.CameraController = fpcController;
            phoneSensors.StartUpdatingAngles(false);
        }
コード例 #7
0
        private async void Initialize()
        {
            // Initialize the map with an oceans basemap
            Map myMap = new Map(Basemap.CreateOceans());

            // Get the path to the ENC Exchange Set
            string encPath = GetEncPath();

            // Store a list of data set extent's - will be used to zoom the mapview to the full extent of the Exchange Set
            List <Envelope> dataSetExtents = new List <Envelope>();

            // Create the cell and layer
            EncLayer myEncLayer = new EncLayer(new EncCell(encPath));

            // Add the layer to the map
            myMap.OperationalLayers.Add(myEncLayer);

            // Wait for the layer to load
            await myEncLayer.LoadAsync();

            // Set the viewpoint
            myMap.InitialViewpoint = new Viewpoint(myEncLayer.FullExtent);

            // Add the map to the mapview
            MyMapView.Map = myMap;

            // Subscribe to tap events (in order to use them to identify and select features)
            MyMapView.GeoViewTapped += MyMapView_GeoViewTapped;
        }
コード例 #8
0
        private void AddBasemap(string basemapName)
        {
            // Apply the chosen basemap
            switch (basemapName)
            {
            case "Topographic":
                // Set the basemap to Topographic
                MyMapView.Map.Basemap = Basemap.CreateTopographic();
                break;

            case "Streets":
                // Set the basemap to Streets
                MyMapView.Map.Basemap = Basemap.CreateStreets();
                break;

            case "Imagery":
                // Set the basemap to Imagery
                MyMapView.Map.Basemap = Basemap.CreateImagery();
                break;

            case "Oceans":
                // Set the basemap to Oceans
                MyMapView.Map.Basemap = Basemap.CreateOceans();
                break;
            }
        }
        private void Initialize()
        {
            // Create a new map with the oceans basemap and add it to the map view.
            _myMapView.Map = new Map(Basemap.CreateOceans());

            // Call a function that will create a new feature collection layer and zoom to it.
            CreateNewFeatureCollection();
        }
        private void Initialize()
        {
            // Add a default value for the portal item Id.
            _collectionItemIdTextBox.Text = FeatureCollectionItemId;

            // Create a new map with the oceans basemap and add it to the map view
            _myMapView.Map = new Map(Basemap.CreateOceans());
        }
コード例 #11
0
        private void Initialize()
        {
            // When the spatial reference changes (the map loads) add the local geodatabase tables as feature layers.
            _mapView.SpatialReferenceChanged += MapView_SpatialReferenceChanged;

            // Create a new map with the oceans basemap and add it to the map view.
            _mapView.Map = new Map(Basemap.CreateOceans());
        }
コード例 #12
0
        private void Initialize()
        {
            // Create a new map with the oceans basemap and add it to the map view
            _myMapView.Map = new Map(Basemap.CreateOceans());

            // Call a function that will create a new feature collection layer from a service query
            GetFeaturesFromQuery();
        }
コード例 #13
0
        // 改变底图
        private void ChangeBaseMap_list_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Map myMap = myMapView.Map;

            switch (ChangeBaseMap_list.SelectedIndex)
            {
            case 0:
                myMap.Basemap = Basemap.CreateDarkGrayCanvasVector();
                myMapView_Eagle.Map.Basemap = Basemap.CreateDarkGrayCanvasVector();
                break;

            case 1:
                myMap.Basemap = Basemap.CreateImagery();
                myMapView_Eagle.Map.Basemap = Basemap.CreateImagery();
                break;

            case 2:
                myMap.Basemap = Basemap.CreateImageryWithLabels();
                myMapView_Eagle.Map.Basemap = Basemap.CreateImageryWithLabels();
                break;

            case 3:
                myMap.Basemap = Basemap.CreateTerrainWithLabels();
                myMapView_Eagle.Map.Basemap = Basemap.CreateTerrainWithLabels();
                break;

            case 4:
                myMap.Basemap = Basemap.CreateLightGrayCanvas();
                myMapView_Eagle.Map.Basemap = Basemap.CreateLightGrayCanvas();
                break;

            case 5:
                myMap.Basemap = Basemap.CreateTopographic();
                myMapView_Eagle.Map.Basemap = Basemap.CreateTopographic();
                break;

            case 6:
                myMap.Basemap = Basemap.CreateNationalGeographic();
                myMapView_Eagle.Map.Basemap = Basemap.CreateNationalGeographic();
                break;

            case 7:
                myMap.Basemap = Basemap.CreateNavigationVector();
                myMapView_Eagle.Map.Basemap = Basemap.CreateNavigationVector();
                break;

            case 8:
                myMap.Basemap = Basemap.CreateOceans();
                myMapView_Eagle.Map.Basemap = Basemap.CreateOceans();
                break;

            case 9:
                myMap.Basemap = Basemap.CreateStreets();
                myMapView_Eagle.Map.Basemap = Basemap.CreateStreets();
                break;
            }
        }
        private async void Initialize()
        {
            // Apply initial display settings
            UpdateDisplaySettings();

            // Initialize the map with an oceans basemap
            MyMapView.Map = new Map(Basemap.CreateOceans());

            // Get the path to the ENC Exchange Set
            string encPath = DataManager.GetDataFolder("9d2987a825c646468b3ce7512fb76e2d", "ExchangeSetwithoutUpdates", "ENC_ROOT",
                                                       "CATALOG.031");

            // Create the Exchange Set
            // Note: this constructor takes an array of paths because so that update sets can be loaded alongside base data
            EncExchangeSet myEncExchangeSet = new EncExchangeSet(new string[] { encPath });

            // Wait for the exchange set to load
            await myEncExchangeSet.LoadAsync();

            // Store a list of data set extent's - will be used to zoom the mapview to the full extent of the Exchange Set
            List <Envelope> dataSetExtents = new List <Envelope>();

            // Add each data set as a layer
            foreach (EncDataset myEncDataSet in myEncExchangeSet.Datasets)
            {
                // Create the cell and layer
                EncLayer myEncLayer = new EncLayer(new EncCell(myEncDataSet));

                // Add the layer to the map
                MyMapView.Map.OperationalLayers.Add(myEncLayer);

                // Wait for the layer to load
                await myEncLayer.LoadAsync();

                // Add the extent to the list of extents
                dataSetExtents.Add(myEncLayer.FullExtent);
            }

            // Use the geometry engine to compute the full extent of the ENC Exchange Set
            Envelope fullExtent = GeometryEngine.CombineExtents(dataSetExtents);

            // Set the viewpoint
            MyMapView.SetViewpoint(new Viewpoint(fullExtent));

            // Subscribe to notifications about leaving so that settings can be re-set
            this.Unloaded += SampleUnloaded;

            // Enable the setting change UI.
            DayRadioButton.Checked            += Setting_Checked;
            DuskRadioButton.Checked           += Setting_Checked;
            NightRadioButton.Checked          += Setting_Checked;
            PaperPointRadioButton.Checked     += Setting_Checked;
            SymbolizedAreaRadioButton.Checked += Setting_Checked;
            PlainAreaRadioButton.Checked      += Setting_Checked;
            SimplifiedRadioButton.Checked     += Setting_Checked;
        }
コード例 #15
0
ファイル: MapViewModel.cs プロジェクト: flappah/s1xxviewer
        public MapViewModel()
        {
            Task.Factory.StartNew(() =>
            {
                //string licenseKey =
                //    "runtimelite,1000,rud#########,day-month-year,####################";
                //Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.SetLicense(licenseKey);

                _map = new Map(Basemap.CreateOceans());
            });
        }
コード例 #16
0
        private async void Initialize()
        {
            // Create new Map
            Map myMap = new Map(Basemap.CreateOceans());

            // Create the hurricanes feature layer once
            FeatureLayer noOffsetLayer = new FeatureLayer(_featureLayerUri);

            // Apply a blue dot renderer to distinguish hurricanes without offsets
            SimpleMarkerSymbol blueDot = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, System.Drawing.Color.Blue, 10);

            noOffsetLayer.Renderer = new SimpleRenderer(blueDot);

            // Add the non-offset layer to the map
            myMap.OperationalLayers.Add(noOffsetLayer);

            // Create the offset hurricanes feature layer
            FeatureLayer withOffsetLayer = new FeatureLayer(_featureLayerUri);

            // Apply a red dot renderer to distinguish these hurricanes from the non-offset hurricanes
            SimpleMarkerSymbol redDot = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, System.Drawing.Color.Red, 10);

            withOffsetLayer.Renderer = new SimpleRenderer(redDot);

            // Apply the time offset (red hurricane dots will be from 10 days before the current extent)
            withOffsetLayer.TimeOffset = new TimeValue(10, Esri.ArcGISRuntime.ArcGISServices.TimeUnit.Days);

            // Add the layer to the map
            myMap.OperationalLayers.Add(withOffsetLayer);

            // Apply the Map to the MapView
            MyMapView.Map = myMap;

            try
            {
                // Ensure the no offset layer is loaded
                await noOffsetLayer.LoadAsync();

                // Store a reference to the original time extent
                _originalExtent = noOffsetLayer.FullTimeExtent;

                // Update the time extent set on the map
                UpdateTimeExtent();

                // Enable the slider
                TimeSlider.IsEnabled = true;
            }
            catch (Exception e)
            {
                await new MessageDialog(e.ToString(), "Error").ShowAsync();
            }
        }
コード例 #17
0
        private async void Initialize()
        {
            // Create new Map with oceans basemap.
            Map myMap = new Map(Basemap.CreateOceans());

            // Create the hurricanes feature layer once.
            FeatureLayer noOffsetLayer = new FeatureLayer(_featureLayerUri);

            // Apply a blue dot renderer to distinguish hurricanes without offsets.
            SimpleMarkerSymbol blueDot = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, System.Drawing.Color.Blue, 10);

            noOffsetLayer.Renderer = new SimpleRenderer(blueDot);

            // Add the non-offset layer to the map.
            myMap.OperationalLayers.Add(noOffsetLayer);

            // Create the offset hurricanes feature layer.
            FeatureLayer withOffsetLayer = new FeatureLayer(_featureLayerUri);

            // Apply a red dot renderer to distinguish these hurricanes from the non-offset hurricanes.
            SimpleMarkerSymbol redDot = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, System.Drawing.Color.Red, 10);

            withOffsetLayer.Renderer = new SimpleRenderer(redDot);

            // Apply the time offset (red hurricane dots will be from 10 days before the current extent).
            withOffsetLayer.TimeOffset = new TimeValue(10, Esri.ArcGISRuntime.ArcGISServices.TimeUnit.Days);

            // Add the layer to the map.
            myMap.OperationalLayers.Add(withOffsetLayer);

            // Apply the Map to the MapView.
            _myMapView.Map = myMap;

            try
            {
                // Ensure the no offset layer is loaded.
                await noOffsetLayer.LoadAsync();

                // Store a reference to the original time extent.
                _originalExtent = noOffsetLayer.FullTimeExtent;

                // Update the time extent set on the map.
                UpdateTimeExtent();

                // Listen for slider changes.
                _timeSlider.ValueChanged += TimeSlider_ValueChanged;
            }
            catch (Exception e)
            {
                new UIAlertView("Error", e.ToString(), (IUIAlertViewDelegate)null, "OK", null).Show();
            }
        }
コード例 #18
0
        private async void Initialize()
        {
            // Initialize the map with an oceans basemap.
            MyMapView.Map = new Map(Basemap.CreateOceans());

            // Get the path to the ENC Exchange Set.
            string encPath = DataManager.GetDataFolder("9d2987a825c646468b3ce7512fb76e2d", "ExchangeSetwithoutUpdates", "ENC_ROOT", "CATALOG.031");

            // Create the Exchange Set.
            // Note: this constructor takes an array of paths because so that update sets can be loaded alongside base data.
            EncExchangeSet myEncExchangeSet = new EncExchangeSet(encPath);

            try
            {
                // Wait for the exchange set to load.
                await myEncExchangeSet.LoadAsync();

                // Store a list of data set extent's - will be used to zoom the mapview to the full extent of the Exchange Set.
                List <Envelope> dataSetExtents = new List <Envelope>();

                // Add each data set as a layer.
                foreach (EncDataset myEncDataset in myEncExchangeSet.Datasets)
                {
                    // Create the cell and layer.
                    EncLayer myEncLayer = new EncLayer(new EncCell(myEncDataset));

                    // Add the layer to the map.
                    MyMapView.Map.OperationalLayers.Add(myEncLayer);

                    // Wait for the layer to load.
                    await myEncLayer.LoadAsync();

                    // Add the extent to the list of extents.
                    dataSetExtents.Add(myEncLayer.FullExtent);
                    Console.WriteLine("Loop 1");
                }

                // Use the geometry engine to compute the full extent of the ENC Exchange Set.
                Envelope fullExtent = GeometryEngine.CombineExtents(dataSetExtents);

                // Set the viewpoint.
                MyMapView.SetViewpoint(new Viewpoint(fullExtent));

                // Subscribe to tap events (in order to use them to identify and select features).
                MyMapView.GeoViewTapped += MyMapView_GeoViewTapped;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Error");
            }
        }
        private async void Initialize()
        {
            // Subscribe to event notifications.
            _colorSchemeSegment.ValueChanged += ColorSchemeChanged;
            _areaSegment.ValueChanged        += AreaStyleChanged;
            _pointSegment.ValueChanged       += PointStyleChanged;

            // Initialize the map with an oceans basemap.
            _myMapView.Map = new Map(Basemap.CreateOceans());

            // Get the path to the ENC Exchange Set.
            string encPath = DataManager.GetDataFolder("9d2987a825c646468b3ce7512fb76e2d", "ExchangeSetwithoutUpdates", "ENC_ROOT", "CATALOG.031");

            // Create the Exchange Set.
            // Note: this constructor takes an array of paths because so that update sets can be loaded alongside base data.
            EncExchangeSet encExchangeSet = new EncExchangeSet(encPath);

            try
            {
                // Wait for the layer to load.
                await encExchangeSet.LoadAsync();

                // Store a list of data set extent's - will be used to zoom the mapview to the full extent of the Exchange Set.
                List <Envelope> dataSetExtents = new List <Envelope>();

                // Add each data set as a layer.
                foreach (EncDataset encDataSet in encExchangeSet.Datasets)
                {
                    EncLayer encLayer = new EncLayer(new EncCell(encDataSet));

                    // Add the layer to the map.
                    _myMapView.Map.OperationalLayers.Add(encLayer);

                    // Wait for the layer to load.
                    await encLayer.LoadAsync();

                    // Add the extent to the list of extents.
                    dataSetExtents.Add(encLayer.FullExtent);
                }

                // Use the geometry engine to compute the full extent of the ENC Exchange Set.
                Envelope fullExtent = GeometryEngine.CombineExtents(dataSetExtents);

                // Set the viewpoint.
                _myMapView.SetViewpoint(new Viewpoint(fullExtent));
            }
            catch (Exception e)
            {
                new UIAlertView("Error", e.ToString(), (IUIAlertViewDelegate)null, "OK", null).Show();
            }
        }
コード例 #20
0
        private void Initialize()
        {
            // When the spatial reference changes (the map loads) add the local geodatabase tables as feature layers
            _mapView.SpatialReferenceChanged += async(s, e) =>
            {
                // Call a function (and await it) to get the local geodatabase (or generate it from the feature service)
                await GetLocalGeodatabase();

                // Once the local geodatabase is available, load the tables as layers to the map
                LoadLocalGeodatabaseTables();
            };

            // Create a new map with the oceans basemap and add it to the map view
            _mapView.Map = new Map(Basemap.CreateOceans());
        }
        private void Initialize()
        {
            try
            {
                // Create a new map with the oceans basemap and add it to the map view
                Map myMap = new Map(Basemap.CreateOceans());
                MyMapView.Map = myMap;

                // Call a function that will create a new feature collection layer from a service query
                GetFeaturesFromQuery();
            }
            catch (Exception ex)
            {
                DisplayAlert("Error", "Unable to create feature collection layer: " + ex.Message, "OK");
            }
        }
        private void Initialize()
        {
            try
            {
                // Create a new map with the oceans basemap and add it to the map view
                Map myMap = new Map(Basemap.CreateOceans());
                MyMapView.Map = myMap;

                // Call a function that will create a new feature collection layer and zoom to it
                CreateNewFeatureCollection();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to create feature collection layer: " + ex.Message, "Error");
            }
        }
        private void Initialize()
        {
            try
            {
                // Create a new map with the oceans basemap and add it to the map view.
                _myMapView.Map = new Map(Basemap.CreateOceans());

                // Call a function that will create a new feature collection layer and zoom to it.
                CreateNewFeatureCollection();
            }
            catch (Exception ex)
            {
                UIAlertView alert = new UIAlertView("Error", "Unable to create feature collection layer: " + ex.Message, (IUIAlertViewDelegate)null, "OK");
                alert.Show();
            }
        }
コード例 #24
0
        private async void Initialize()
        {
            // Initialize the map with an oceans basemap
            MyMapView.Map = new Map(Basemap.CreateOceans());

            // Get the path to the ENC Exchange Set
            string encPath = DataManager.GetDataFolder("9d2987a825c646468b3ce7512fb76e2d", "ExchangeSetwithoutUpdates", "ENC_ROOT",
                                                       "CATALOG.031");

            // Create the Exchange Set
            // Note: this constructor takes an array of paths because so that update sets can be loaded alongside base data
            EncExchangeSet myEncExchangeSet = new EncExchangeSet(encPath);

            try
            {
                // Wait for the exchange set to load
                await myEncExchangeSet.LoadAsync();

                // Store a list of data set extent's - will be used to zoom the mapview to the full extent of the Exchange Set
                List <Envelope> dataSetExtents = new List <Envelope>();

                // Add each data set as a layer
                foreach (EncDataset myEncDataSet in myEncExchangeSet.Datasets)
                {
                    EncLayer myEncLayer = new EncLayer(new EncCell(myEncDataSet));

                    // Add the layer to the map
                    MyMapView.Map.OperationalLayers.Add(myEncLayer);

                    // Wait for the layer to load
                    await myEncLayer.LoadAsync();

                    // Add the extent to the list of extents
                    dataSetExtents.Add(myEncLayer.FullExtent);
                }

                // Use the geometry engine to compute the full extent of the ENC Exchange Set
                Envelope fullExtent = GeometryEngine.CombineExtents(dataSetExtents);

                // Set the viewpoint
                await MyMapView.SetViewpointAsync(new Viewpoint(fullExtent));
            }
            catch (Exception e)
            {
                await Application.Current.MainPage.DisplayAlert("Error", e.ToString(), "OK");
            }
        }
        private async void Initialize()
        {
            try
            {
                // Create a new map with the oceans basemap and add it to the map view
                var map = new Map(Basemap.CreateOceans());
                MyMapView.Map = map;

                // Call a function that will create a new feature collection layer from a service query
                GetFeaturesFromQuery();
            }
            catch (Exception ex)
            {
                var messageDlg = new MessageDialog("Unable to create feature collection layer: " + ex.Message, "Error");
                await messageDlg.ShowAsync();
            }
        }
コード例 #26
0
        private async void Initialize()
        {
            // Create new Map
            Map myMap = new Map(Basemap.CreateOceans());

            // Create the hurricanes feature layer once
            FeatureLayer noOffsetLayer = new FeatureLayer(_featureLayerUri);

            // Apply a blue dot renderer to distinguish hurricanes without offsets
            SimpleMarkerSymbol blueDot = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, System.Drawing.Color.Blue, 10);

            noOffsetLayer.Renderer = new SimpleRenderer(blueDot);

            // Add the non-offset layer to the map
            myMap.OperationalLayers.Add(noOffsetLayer);

            // Create the offset hurricanes feature layer
            FeatureLayer withOffsetLayer = new FeatureLayer(_featureLayerUri);

            // Center the Viewpoint on the FeatureLayer once the feature layer has loaded.
            withOffsetLayer.Loaded += (s, e) => { _myMapView.SetViewpointGeometryAsync(withOffsetLayer.FullExtent, 50); };

            // Apply a red dot renderer to distinguish these hurricanes from the non-offset hurricanes
            SimpleMarkerSymbol redDot = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, System.Drawing.Color.Red, 10);

            withOffsetLayer.Renderer = new SimpleRenderer(redDot);

            // Apply the time offset (red hurricane dots will be from 10 days before the current extent)
            withOffsetLayer.TimeOffset = new TimeValue(10, Esri.ArcGISRuntime.ArcGISServices.TimeUnit.Days);

            // Add the layer to the map
            myMap.OperationalLayers.Add(withOffsetLayer);

            // Apply the Map to the MapView
            _myMapView.Map = myMap;

            // Ensure the no offset layer is loaded
            await noOffsetLayer.LoadAsync();

            // Store a reference to the original time extent
            _originalExtent = noOffsetLayer.FullTimeExtent;

            // Update the time extent set on the map
            UpdateTimeExtent();
        }
コード例 #27
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());
            }
        }
コード例 #28
0
        private void Initialize()
        {
            try
            {
                // Create a new map with the oceans basemap and add it to the map view
                Map myMap = new Map(Basemap.CreateOceans());
                _myMapView.Map = myMap;

                // Call a function that will create a new feature collection layer and zoom to it
                CreateNewFeatureCollection();
            }
            catch (Exception ex)
            {
                var alertBuilder = new AlertDialog.Builder(this);
                alertBuilder.SetTitle("Error");
                alertBuilder.SetMessage("Unable to create feature collection layer: " + ex.Message);
                alertBuilder.Show();
            }
        }
コード例 #29
0
        private async void OnChangeBasemapButtonClicked(object sender, EventArgs e)
        {
            // Show sheet and get title from the selection
            var selectedBasemap =
                await DisplayActionSheet("Select basemap", "Cancel", null, titles);

            // If selected cancel do nothing
            if (selectedBasemap == "Cancel")
            {
                return;
            }

            switch (selectedBasemap)
            {
            case "Topo":

                // Set the basemap to Topographic
                MyMapView.Map.Basemap = Basemap.CreateTopographic();
                break;

            case "Streets":

                // Set the basemap to Streets
                MyMapView.Map.Basemap = Basemap.CreateStreets();
                break;

            case "Imagery":

                // Set the basemap to Imagery
                MyMapView.Map.Basemap = Basemap.CreateImagery();
                break;

            case "Ocean":

                // Set the basemap to Imagery
                MyMapView.Map.Basemap = Basemap.CreateOceans();
                break;

            default:
                break;
            }
        }
コード例 #30
0
        private void Initialize()
        {
            // Create a new map to display in the map view with the oceans basemap.
            MyMapView.Map = new Map(Basemap.CreateOceans());

            try
            {
                // Load the shape file in the map.
                LoadTheShapefile();

                // Add an event handler to listen for taps/clicks to start the identify operation.
                MyMapView.GeoViewTapped += MyMapView_GeoViewTapped;

                // Add an event handler for when the user chooses a day from the date picker.
                MyDatePicker.SelectedDateChanged += MyDatePicker_SelectedDateChanged;
            }
            catch (Exception e)
            {
                // Something went wrong; show an error message to the user.
                MessageBox.Show(e.ToString(), "Error initializing the application.");
            }
        }