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;
        }
        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();
            }
        }
Exemplo n.º 3
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");
            }
        }
Exemplo n.º 4
0
        private async void Initialize()
        {
            // Initialize the map with an oceans basemap
            MyMapView.Map = new Map(BasemapStyle.ArcGISOceans);

            // 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()
        {
            // 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);

            // 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));
        }
        private async void Initialize()
        {
            // Add display options to UI
            ColorSchemePicker.ItemsSource = new List <String>()
            {
                "Day", "Dusk", "Night"
            };
            AreaPicker.ItemsSource = new List <String>()
            {
                "Plain", "Symbolized"
            };
            PointPicker.ItemsSource = new List <String>()
            {
                "Paper Chart", "Simplified"
            };

            // Provide initial selection
            ColorSchemePicker.SelectedIndex = 0; AreaPicker.SelectedIndex = 0; PointPicker.SelectedIndex = 0;

            // Apply initial display settings
            UpdateDisplaySettings();

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

            // 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 });

            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));

                // Subscribe to notifications about leaving so that settings can be reset.
                // This looks different because of sample viewer plumbing.
                // Replace `((ArcGISRuntime.SamplePage)this.Parent)` with `this` in your app.
                ((Page)this.Parent).Disappearing += SampleUnloaded;
            }
            catch (Exception e)
            {
                await Application.Current.MainPage.DisplayAlert("Error", e.ToString(), "OK");
            }
        }