private void Initialize()
        {
            // Create a scene for the sceneview.
            Scene myScene = new Scene(Basemap.CreateImagery());

            MySceneView.Scene = myScene;

            // Create a geometry for the ground overlay.
            Envelope overlayGeometry = new Envelope(-123.066227926904, 44.04736963555683, -123.0796942287304, 44.03878298600624, SpatialReferences.Wgs84);

            // Create a KML Icon for the overlay image.
            KmlIcon overlayImage = new KmlIcon(_imageryUri);

            // Create the KML ground overlay.
            KmlGroundOverlay overlay = new KmlGroundOverlay(overlayGeometry, overlayImage);

            // Set the rotation of the ground overlay.
            overlay.Rotation = -3.046024799346924;

            // Create a KML dataset with the ground overlay as the root node.
            KmlDataset dataset = new KmlDataset(overlay);

            // Create a KML layer for the scene view.
            KmlLayer layer = new KmlLayer(dataset);

            // Add the layer to the map.
            MySceneView.Scene.OperationalLayers.Add(layer);

            // Move the viewpoint to the ground overlay.
            MySceneView.SetViewpoint(new Viewpoint(overlay.Geometry, new Camera(overlay.Geometry.Extent.GetCenter(), 1250, 45, 60, 0)));

            // Add an event handler for the on-screen slider.
            OpacitySlider.ValueChanged += (s, e) =>
            {
                // Change the color of the KML ground overlay image to edit the alpha-value. (Other color values are left as-is in the original image.)
                overlay.Color = System.Drawing.Color.FromArgb((int)e.NewValue, 0, 0, 0);

                // Make the value an integer (For the UI).
                OpacitySlider.Value = (int)OpacitySlider.Value;
            };
        }
        private void Initialize()
        {
            // Create a new scene
            Scene myScene = new Scene();

            // Crate a new base map using the static/shared create imagery method
            Basemap myBaseMap = Basemap.CreateImagery();

            // Add the imagery basemap to the scene's base map property
            myScene.Basemap = myBaseMap;

            // Add scene (with an imagery basemap) to the scene view's scene property
            MySceneView.Scene = myScene;

            // Create a new surface
            Surface mySurface = new Surface();

            // Define the string that points to the elevation image service
            string myElevationImageService = "http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer";

            // Create a Uri from the elevation image service string
            Uri myUri = new Uri(myElevationImageService);

            // Create an ArcGIS tiled elevation
            ArcGISTiledElevationSource myArcGISTiledElevationSource = new ArcGISTiledElevationSource();

            // Set the ArcGIS tiled elevation sources property to the Uri of the elevation image service
            myArcGISTiledElevationSource.Source = myUri;

            // Add the ArcGIS tiled elevation source to the surface's elevated sources collection
            mySurface.ElevationSources.Add(myArcGISTiledElevationSource);

            // Set the scene's base surface to the surface with the ArcGIS tiled elevation source
            myScene.BaseSurface = mySurface;

            // Create camera with an initial camera position (Mount Everest in the Alps mountains)
            Camera myCamera = new Camera(28.4, 83.9, 10010.0, 10.0, 80.0, 300.0);

            // Set the scene view's camera position
            MySceneView.SetViewpointCameraAsync(myCamera);
        }
        private async void Initialize()
        {
            // Add an imagery basemap.
            Map map = new Map(Basemap.CreateImagery());

            // Load the raster file.
            Raster rasterFile = new Raster(_rasterPath);

            // Create the layer.
            RasterLayer rasterLayer = new RasterLayer(rasterFile);

            // Create a color map where values 0-149 are red and 150-249 are yellow.
            IEnumerable <Color> colors = new int[250]
                                         .Select((c, i) => i < 150 ? Color.Red : Color.Yellow);

            // Create a colormap renderer.
            ColormapRenderer colormapRenderer = new ColormapRenderer(colors);

            // Set the colormap renderer on the raster layer.
            rasterLayer.Renderer = colormapRenderer;

            // Add the layer to the map.
            map.OperationalLayers.Add(rasterLayer);

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

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

                // Set the viewpoint.
                await MyMapView.SetViewpointGeometryAsync(rasterLayer.FullExtent, 15);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                await new MessageDialog(e.Message, "Sample error").ShowAsync();
            }
        }
Exemple #4
0
        public async void Initialize()
        {
            MobileMapPackage myMapPackage = await MobileMapPackage.OpenAsync(@"..\..\..\..\SampleData\sample_maps.mmpk");

            // マップ ビューの持つ Map プロパティにモバイル マップ パッケージが持つマップを割り当てる
            MyMapView.Map = myMapPackage.Maps.First();
            // 背景に ArcGIS Online の衛星画像サービスを表示する
            MyMapView.Map.Basemap = Basemap.CreateImagery();
            // マップのレイヤーを取得してレイヤーの透過率を設定
            MyMapView.Map.OperationalLayers[0].Opacity = 0.5;
            // マップのスケール範囲を設定
            MyMapView.Map.MinScale = 5000000;
            MyMapView.Map.MaxScale = 5000;

            // マップに追加されているレイヤーの一覧取得
            TreeViewMultipleTemplatesSample();


            // マップ ビューのタップイベント
            MyMapView.GeoViewTapped += MyMapView_GeoViewTapped;
        }
Exemple #5
0
        private void CreateLayout()
        {
            // Setup the visual frame for the MapView
            var mapViewRect = new CoreGraphics.CGRect(0, 90, View.Bounds.Width, View.Bounds.Height - 90);

            // Create a map view with a basemap
            _myMapView       = new MapView();
            _myMapView.Map   = new Map(Basemap.CreateImagery());
            _myMapView.Frame = mapViewRect;

            // Create a button to load a web map
            var      buttonRect       = new CoreGraphics.CGRect(40, 50, View.Bounds.Width - 80, 30);
            UIButton loadWebMapButton = new UIButton(buttonRect);

            loadWebMapButton.SetTitleColor(UIColor.Blue, UIControlState.Normal);
            loadWebMapButton.SetTitle("Load secure web map", UIControlState.Normal);
            loadWebMapButton.TouchUpInside += LoadWebMapButton_TouchUpInside;

            // Add the map view and button to the page
            View.AddSubviews(loadWebMapButton, _myMapView);
        }
Exemple #6
0
        private void CreateLayout()
        {
            // Create a stack layout
            LinearLayout layout = new LinearLayout(this)
            {
                Orientation = Orientation.Vertical
            };

            // Create the mapview
            _myMapView = new MapView(this)
            {
                // Add an imagery basemap
                Map = new Map(Basemap.CreateImagery())
            };

            // Add the mapview to the layout
            layout.AddView(_myMapView);

            // Set the layout as the sample view
            SetContentView(layout);
        }
Exemple #7
0
        public MainPageViewModel()
        {
            Map = new Map(SpatialReference.Create(102100));

            // Add the tile basemap only after the map has loaded so it doesn't block the map if offline
            Map.Loaded += (sender, e) => { Map.Basemap = Basemap.CreateImagery(); };

            GraphicsOverlay editGraphics = new GraphicsOverlay();

            editGraphics.Id = "MyGraphics";
            GraphicsOverlays.Add(editGraphics);

            // Add some test graphics

            var point       = new MapPoint(-3000000, 5000000);
            var pointSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, SystemColor.Red, 25);
            List <KeyValuePair <string, object> > PolyPoint = new List <KeyValuePair <string, object> >();

            PolyPoint.Add(new KeyValuePair <string, object>("Number", 678910));
            PolyPoint.Add(new KeyValuePair <string, object>("Type", "This is Point"));
            Graphic mapPoint = new Graphic(point, PolyPoint, pointSymbol);

            GraphicsOverlays["MyGraphics"].Graphics.Add(mapPoint);

            var travelPolyline = new SimpleLineSymbol(SimpleLineSymbolStyle.Dash, SystemColor.Red, 5);
            var travelPosition = new PolylineBuilder(SpatialReference.Create(102100));

            travelPosition.AddPoint(new MapPoint(0, 0));
            travelPosition.AddPoint(new MapPoint(1000000, 1000000));
            travelPosition.AddPoint(new MapPoint(5000000, 5000000));
            travelPosition.AddPoint(new MapPoint(2000000, 8000000));
            var travelRoute = travelPosition.ToGeometry();
            List <KeyValuePair <string, object> > Polyline = new List <KeyValuePair <string, object> >();

            Polyline.Add(new KeyValuePair <string, object>("Number", 12345));
            Polyline.Add(new KeyValuePair <string, object>("Type", "This is polyline"));
            var travelTrip = new Graphic(travelRoute, Polyline, travelPolyline);

            GraphicsOverlays["MyGraphics"].Graphics.Add(travelTrip);
        }
        private async void Initialize()
        {
            // Create new Scene.
            Scene myScene = new Scene {
                Basemap = Basemap.CreateImagery()
            };

            // Create and add an elevation source for the Scene.
            ArcGISTiledElevationSource elevationSrc = new ArcGISTiledElevationSource(_elevationSourceUrl);

            myScene.BaseSurface.ElevationSources.Add(elevationSrc);

            // Create new scene layer from the URL.
            ArcGISSceneLayer sceneLayer = new ArcGISSceneLayer(_serviceUri);

            // Add created layer to the operational layers collection.
            myScene.OperationalLayers.Add(sceneLayer);

            try
            {
                // Load the layer.
                await sceneLayer.LoadAsync();

                // Get the center of the scene layer.
                MapPoint center = (MapPoint)GeometryEngine.Project(sceneLayer.FullExtent.GetCenter(), SpatialReferences.Wgs84);

                // Create a camera with coordinates showing layer data.
                Camera camera = new Camera(center.Y, center.X, 225, 220, 80, 0);

                // Assign the Scene to the SceneView.
                MySceneView.Scene = myScene;

                // Set view point of scene view using camera.
                await MySceneView.SetViewpointCameraAsync(camera);
            }
            catch (Exception e)
            {
                await new MessageDialog2(e.ToString(), "Error").ShowAsync();
            }
        }
Exemple #9
0
        public void Initialize()
        {
            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateImagery());

            // Create initial map location and reuse the location for graphic
            MapPoint centralLocation = new MapPoint(_positionPublisher.getX(), _positionPublisher.getY(), SpatialReferences.Wgs84);

            Viewpoint initialViewpoint = new Viewpoint(centralLocation, 7500);

            // Set initial viewpoint
            myMap.InitialViewpoint = initialViewpoint;

            // Provide used Map to the MapView
            MainWindow.View.Map2D.Map = myMap;

            // Create overlay to where graphics are shown
            overlay = new GraphicsOverlay();

            // Add created overlay to the MapView
            MainWindow.View.Map2D.GraphicsOverlays.Add(overlay);

            // Create a simple marker symbol
            SimpleMarkerSymbol simpleSymbol = new SimpleMarkerSymbol()
            {
                Color = Color.Red,
                Size  = 10,
                Style = SimpleMarkerSymbolStyle.Circle
            };

            // Add a new graphic with a central point that was created earlier
            graphicWithSymbol = new Graphic(centralLocation, simpleSymbol);
            overlay.Graphics.Add(graphicWithSymbol);

            // Hook into the tapped event
            MainWindow.View.Map2D.GeoViewTapped += OnMapViewTapped;

            //VShed(centralLocation);
            CreateOverlays();
        }
        private void Initialize()
        {
            // Set up the scene with an imagery basemap.
            MySceneView.Scene = new Scene(Basemap.CreateImagery());

            // Set the initial viewpoint for the scene.
            MapPoint point         = new MapPoint(83.9, 28.4, 1000, SpatialReferences.Wgs84);
            Camera   initialCamera = new Camera(point, 1000, 0, 50, 0);

            MySceneView.SetViewpointCamera(initialCamera);

            // Create a graphics overlay.
            GraphicsOverlay overlay = new GraphicsOverlay();

            overlay.SceneProperties.SurfacePlacement = SurfacePlacement.Relative;
            MySceneView.GraphicsOverlays.Add(overlay);

            // Add a renderer using rotation expressions.
            SimpleRenderer renderer = new SimpleRenderer();

            renderer.SceneProperties.HeadingExpression = "[HEADING]";
            renderer.SceneProperties.PitchExpression   = "[PITCH]";

            // Apply the renderer to the graphics overlay.
            overlay.Renderer = renderer;

            // Create a red cone graphic.
            SimpleMarkerSceneSymbol coneSymbol = SimpleMarkerSceneSymbol.CreateCone(Color.Red, 100, 100);

            coneSymbol.Pitch = -90;
            MapPoint conePoint = new MapPoint(83.9, 28.41, 200, SpatialReferences.Wgs84);
            Graphic  cone      = new Graphic(conePoint, coneSymbol);

            // Add the cone graphic to the overlay.
            overlay.Graphics.Add(cone);

            // Listen for changes in slider values and update graphic properties.
            HeadingSlider.ValueChanged += (sender, e) => { cone.Attributes["HEADING"] = HeadingSlider.Value; };
            PitchSlider.ValueChanged   += (sender, e) => { cone.Attributes["PITCH"] = PitchSlider.Value; };
        }
Exemple #11
0
        private async void Initialize()
        {
            try
            {
                // Create a new Scene with an imagery basemap.
                Scene myScene = new Scene(Basemap.CreateImagery());

                // Add the Scene to the SceneView.
                _mySceneView.Scene = myScene;

                // Create a new GraphicsOverlay and add it to the SceneView.
                GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
                graphicsOverlay.SceneProperties.SurfacePlacement = SurfacePlacement.Relative;
                _mySceneView.GraphicsOverlays.Add(graphicsOverlay);

                // Call a function to create a new distance composite symbol with three ranges.
                DistanceCompositeSceneSymbol compositeSymbol = await CreateCompositeSymbol();

                // Create a new point graphic with the composite symbol, add it to the graphics overlay.
                MapPoint locationPoint = new MapPoint(-2.708471, 56.096575, 5000, SpatialReferences.Wgs84);
                Graphic  pointGraphic  = new Graphic(locationPoint, compositeSymbol);
                graphicsOverlay.Graphics.Add(pointGraphic);

                // Add an orbit camera controller to lock the camera to the graphic.
                OrbitGeoElementCameraController cameraController = new OrbitGeoElementCameraController(pointGraphic, 20)
                {
                    CameraPitchOffset   = 80,
                    CameraHeadingOffset = -30
                };
                _mySceneView.CameraController = cameraController;
            }
            catch (Exception e)
            {
                // Something went wrong, display the error
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle("Error");
                alert.SetMessage(e.Message);
                alert.Show();
            }
        }
Exemple #12
0
        private async void Initialize()
        {
            // Create a new Scene with an imagery basemap.
            Scene scene = new Scene(Basemap.CreateImagery());

            // Add a base surface with elevation data.
            Surface elevationSurface = new Surface();
            Uri     elevationService = new Uri("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer");

            elevationSurface.ElevationSources.Add(new ArcGISTiledElevationSource(elevationService));
            scene.BaseSurface = elevationSurface;

            // Add a scene layer.
            Uri buildingsService            = new Uri("https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/Buildings_Berlin/SceneServer");
            ArcGISSceneLayer buildingsLayer = new ArcGISSceneLayer(buildingsService);

            scene.OperationalLayers.Add(buildingsLayer);

            // Assign the Scene to the SceneView.
            _mySceneView.Scene = scene;

            try
            {
                // Create a camera with an interesting view.
                await buildingsLayer.LoadAsync();

                MapPoint center     = (MapPoint)GeometryEngine.Project(buildingsLayer.FullExtent.GetCenter(), SpatialReferences.Wgs84);
                Camera   viewCamera = new Camera(center.Y, center.X, 600, 120, 60, 0);

                // Set the viewpoint with the camera.
                _mySceneView.SetViewpointCamera(viewCamera);

                // Listen for taps.
                _mySceneView.GeoViewTapped += SceneViewTapped;
            }
            catch (Exception e)
            {
                new UIAlertView("Error", e.ToString(), (IUIAlertViewDelegate)null, "OK", null).Show();
            }
        }
Exemple #13
0
        private async void Initialize()
        {
            // Create the scene with a basemap.
            Scene flyoverScene = new Scene(Basemap.CreateImagery());

            // Create the integrated mesh layer and add it to the scene.
            IntegratedMeshLayer meshLayer =
                new IntegratedMeshLayer(
                    new Uri("https://www.arcgis.com/home/item.html?id=dbc72b3ebb024c848d89a42fe6387a1b"));

            flyoverScene.OperationalLayers.Add(meshLayer);

            try
            {
                // Wait for the layer to load so that extent is available.
                await meshLayer.LoadAsync();

                // Start with the camera at the center of the mesh layer.
                Envelope layerExtent  = meshLayer.FullExtent;
                Camera   originCamera = new Camera(layerExtent.GetCenter().Y, layerExtent.GetCenter().X, 600, 0, 90, 0);
                _arSceneView.OriginCamera = originCamera;

                // Set the translation factor to enable rapid movement through the scene.
                _arSceneView.TranslationFactor = 1000;

                // Enable atmosphere and space effects for a more immersive experience.
                _arSceneView.SpaceEffect      = SpaceEffect.Stars;
                _arSceneView.AtmosphereEffect = AtmosphereEffect.Realistic;

                // Display the scene.
                await flyoverScene.LoadAsync();

                _arSceneView.Scene = flyoverScene;
            }
            catch (Exception ex)
            {
                new Android.App.AlertDialog.Builder(this).SetMessage("Failed to start AR").SetTitle("Error").Show();
                System.Diagnostics.Debug.WriteLine(ex);
            }
        }
        private void Initialize()
        {
            // Create the scene with a basemap.
            MySceneView.Scene = new Scene(Basemap.CreateImagery());

            // Add an elevation source to the scene.
            Surface elevationSurface = new Surface();
            ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource(new Uri(_elevationServiceUrl));

            elevationSurface.ElevationSources.Add(elevationSource);
            MySceneView.Scene.BaseSurface = elevationSurface;

            // Set the initial viewpoint.
            Camera initialCamera = new Camera(64.416919, -14.483728, 100, 318, 105, 0);

            MySceneView.SetViewpointCamera(initialCamera);

            // Configure the picker.
            AtmosphereEffectPicker.ItemsSource   = new [] { "Realistic", "Horizon only", "None" };
            AtmosphereEffectPicker.SelectedIndex = 1;

            // Apply the selected atmosphere effect option.
            AtmosphereEffectPicker.SelectedIndexChanged += (o, e) =>
            {
                switch (AtmosphereEffectPicker.SelectedIndex)
                {
                case 0:
                    MySceneView.AtmosphereEffect = AtmosphereEffect.Realistic;
                    break;

                case 1:
                    MySceneView.AtmosphereEffect = AtmosphereEffect.HorizonOnly;
                    break;

                case 2:
                    MySceneView.AtmosphereEffect = AtmosphereEffect.None;
                    break;
                }
            };
        }
        private async void Initialize()
        {
            // Create a simple string array of the human-readable stretch renderer names from the ObservableCollection
            string[] myStringArray_RendererTypes = { "Min Max", "Percent Clip", "Standard Deviation" };

            // Create an ArrayAdapter from the simple string array
            ArrayAdapter myArrayAdapter_LayerNamesInTheMap = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, myStringArray_RendererTypes);

            // Display the human-readable stretch renderer names to be displayed a ListView
            _RendererTypes.Adapter = myArrayAdapter_LayerNamesInTheMap;

            // Add an imagery basemap
            _myMapView.Map = new Map(Basemap.CreateImagery());

            // Get the file name
            string filepath = GetRasterPath();

            // Load the raster file
            Raster myRasterFile = new Raster(filepath);

            // Create the layer
            RasterLayer myRasterLayer = new RasterLayer(myRasterFile);

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

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

                // Set the viewpoint
                await _myMapView.SetViewpointGeometryAsync(myRasterLayer.FullExtent);
            }
            catch (Exception e)
            {
                new AlertDialog.Builder(this).SetMessage(e.ToString()).SetTitle("Error").Show();
            }
        }
Exemple #16
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            try
            {
                ARView.RenderVideoFeed = false;
                ARView.OriginCamera    = new Esri.ArcGISRuntime.Mapping.Camera(new MapPoint(-119.622075, 37.720650, 2105), 0, 90, 0); //Yosemite

                Surface sceneSurface = new Surface();
                sceneSurface.ElevationSources.Add(new ArcGISTiledElevationSource(new Uri("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer")));
                Scene scene = new Scene(Basemap.CreateImagery())
                {
                    BaseSurface = sceneSurface
                };
                ARView.Scene = scene;
                ARView.StartTrackingAsync(Esri.ArcGISRuntime.ARToolkit.ARLocationTrackingMode.Ignore);
            }
            catch (System.Exception ex)
            {
                Toast.MakeText(this, "Failed to load scene: \n" + ex.Message, ToastLength.Long).Show();
            }
        }
Exemple #17
0
        private async void Initialize()
        {
            // Initialize the GUI controls appearance
            ObservableCollection <string> myObservableCollection_RendererTypes = new ObservableCollection <string>();

            myObservableCollection_RendererTypes.Add("Min Max");
            myObservableCollection_RendererTypes.Add("Percent Clip");
            myObservableCollection_RendererTypes.Add("Standard Deviation");
            RendererTypes.ItemsSource  = myObservableCollection_RendererTypes;
            RendererTypes.SelectedItem = "Min Max";

            // Add an imagery basemap
            MyMapView.Map = new Map(Basemap.CreateImagery());

            // Get the file name
            string filepath = GetRasterPath();

            // Load the raster file
            Raster myRasterFile = new Raster(filepath);

            // Create the layer
            RasterLayer myRasterLayer = new RasterLayer(myRasterFile);

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

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

                // Set the viewpoint
                await MyMapView.SetViewpointGeometryAsync(myRasterLayer.FullExtent);
            }
            catch (Exception e)
            {
                await Application.Current.MainPage.DisplayAlert("Error", e.ToString(), "OK");
            }
        }
Exemple #18
0
        private async void Init()
        {
            try
            {
                ARView.OriginCamera = new Esri.ArcGISRuntime.Mapping.Camera(new MapPoint(-119.622075, 37.720650, 2105), 0, 90, 0); //Yosemite

                Surface sceneSurface = new Surface();
                sceneSurface.ElevationSources.Add(new ArcGISTiledElevationSource(new Uri("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer")));
                Scene scene = new Scene(Basemap.CreateImagery())
                {
                    BaseSurface = sceneSurface
                };
                ARView.Scene = scene;
                await scene.LoadAsync();
            }
            catch (System.Exception ex)
            {
                await DisplayAlert("Failed to load scene", ex.Message, "OK");

                await Navigation.PopAsync();
            }
        }
Exemple #19
0
        private void Initialize()
        {
            // Create the scene with a basemap.
            MySceneView.Scene = new Scene(Basemap.CreateImagery());

            // Add an elevation source to the scene.
            Surface elevationSurface = new Surface();
            ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource(new Uri(_elevationServiceUrl));

            elevationSurface.ElevationSources.Add(elevationSource);
            MySceneView.Scene.BaseSurface = elevationSurface;

            // Set the initial viewpoint.
            Camera initialCamera = new Camera(64.416919, -14.483728, 100, 318, 105, 0);

            MySceneView.SetViewpointCamera(initialCamera);

            // Apply the selected atmosphere effect option.
            RealisticOption.Selected   += (sender, e) => MySceneView.AtmosphereEffect = AtmosphereEffect.Realistic;
            HorizonOnlyOption.Selected += (sender, e) => MySceneView.AtmosphereEffect = AtmosphereEffect.HorizonOnly;
            NoneOption.Selected        += (sender, e) => MySceneView.AtmosphereEffect = AtmosphereEffect.None;
        }
Exemple #20
0
 private void BasemapSelector_Checked(object sender, RoutedEventArgs e)
 {
     if (basemapSelector_LightGray == null || basemapSelector_Imagery == null || basemapSelector_Ocean == null || mapView.Map == null)
     {
         return;
     }
     basemapSelector_LightGray.IsChecked = (sender == basemapSelector_LightGray);
     basemapSelector_Imagery.IsChecked   = (sender == basemapSelector_Imagery);
     basemapSelector_Ocean.IsChecked     = (sender == basemapSelector_Ocean);
     if (basemapSelector_LightGray.IsChecked)
     {
         mapView.Map.Basemap = Basemap.CreateLightGrayCanvas();
     }
     else if (basemapSelector_Imagery.IsChecked)
     {
         mapView.Map.Basemap = Basemap.CreateImagery();
     }
     else if (basemapSelector_Ocean.IsChecked)
     {
         mapView.Map.Basemap = Basemap.CreateOceans();
     }
 }
Exemple #21
0
        public void ChangeBasemap(string selectedBasemap)
        {
            // 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;
            }
        }
Exemple #22
0
        /// <summary>
        /// this method helps to change the view of the basemap as the selection is made from the combobox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BasemapCombobox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                int index = BasemapCombobox.SelectedIndex;

                switch (index)
                {
                case 0:
                    MyMapView.Map.Basemap = Basemap.CreateStreets();
                    break;

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

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

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

                case 4:
                    MyMapView.Map.Basemap = Basemap.CreateOpenStreetMap();
                    break;

                default:
                    MyMapView.Map.Basemap = Basemap.CreateOpenStreetMap();
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #23
0
        private void Initialize()
        {
            // Add event handler for when this sample is unloaded.
            Unloaded += SampleUnloaded;

            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateImagery());

            // Provide used Map to the MapView
            MyMapView.Map = myMap;

            // Set navigation types as items source and set default value
            ModeChooser.ItemsSource   = _navigationTypes;
            ModeChooser.SelectedIndex = 0;

            // Update the UI when the user pans the view, changing the location mode
            MyMapView.LocationDisplay.AutoPanModeChanged += (sender, args) =>
            {
                switch (MyMapView.LocationDisplay.AutoPanMode)
                {
                case LocationDisplayAutoPanMode.Off:
                    ModeChooser.SelectedIndex = 0;
                    break;

                case LocationDisplayAutoPanMode.Recenter:
                    ModeChooser.SelectedIndex = 1;
                    break;

                case LocationDisplayAutoPanMode.Navigation:
                    ModeChooser.SelectedIndex = 2;
                    break;

                case LocationDisplayAutoPanMode.CompassNavigation:
                    ModeChooser.SelectedIndex = 3;
                    break;
                }
            };
        }
Exemple #24
0
        private async void Initialize()
        {
            // Create a simple string array of the human-readable stretch renderer names from the ObservableCollection
            string[] myStringArray_RendererTypes = { "Min Max", "Percent Clip", "Standard Deviation" };

            // Create an ArrayAdapter from the simple string array
            ArrayAdapter myArrayAdapter_LayerNamesInTheMap = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, myStringArray_RendererTypes);

            // Display the human-readable stretch renderer names to be displayed a ListView
            _RendererTypes.Adapter = myArrayAdapter_LayerNamesInTheMap;

            // Add an imagery basemap
            Map myMap = new Map(Basemap.CreateImagery());

            // Wait for the map to load
            await myMap.LoadAsync();

            // Get the file name
            string filepath = GetRasterPath();

            // Load the raster file
            Raster myRasterFile = new Raster(filepath);

            // Create the layer
            RasterLayer myRasterLayer = new RasterLayer(myRasterFile);

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

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

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

            // Add map to the mapview
            _myMapView.Map = myMap;
        }
        private async void Initialize()
        {
            // Initialize the GUI controls appearance
            ObservableCollection <string> myObservableCollection_RendererTypes = new ObservableCollection <string>();

            myObservableCollection_RendererTypes.Add("Min Max");
            myObservableCollection_RendererTypes.Add("Percent Clip");
            myObservableCollection_RendererTypes.Add("Standard Deviation");
            RendererTypes.ItemsSource  = myObservableCollection_RendererTypes;
            RendererTypes.SelectedItem = "Min Max";

            // Add an imagery basemap
            Map myMap = new Map(Basemap.CreateImagery());

            // Wait for the map to load
            await myMap.LoadAsync();

            // Get the file name
            string filepath = GetRasterPath();

            // Load the raster file
            Raster myRasterFile = new Raster(filepath);

            // Create the layer
            RasterLayer myRasterLayer = new RasterLayer(myRasterFile);

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

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

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

            // Add map to the mapview
            MyMapView.Map = myMap;
        }
Exemple #26
0
        private void Initialize()
        {
            // Create the map.
            MyMapView.Map = new Map(Basemap.CreateImagery());

            // Set the images for the point icon picker.
            List <string> iconLinks = new List <string>()
            {
                "https://static.arcgis.com/images/Symbols/Shapes/BlueCircleLargeB.png",
                "https://static.arcgis.com/images/Symbols/Shapes/BlueDiamondLargeB.png",
                "https://static.arcgis.com/images/Symbols/Shapes/BluePin1LargeB.png",
                "https://static.arcgis.com/images/Symbols/Shapes/BluePin2LargeB.png",
                "https://static.arcgis.com/images/Symbols/Shapes/BlueSquareLargeB.png",
                "https://static.arcgis.com/images/Symbols/Shapes/BlueStarLargeB.png"
            };
            List <Uri> _iconList = iconLinks.Select(x => new Uri(x)).ToList();

            IconPicker.ItemsSource   = _iconList;
            IconPicker.SelectedIndex = 0;

            // Set up a new kml document and kml layer.
            ResetKml();
        }
Exemple #27
0
        public CityOfBrestSample()
        {
            this.InitializeComponent();

            arview.RenderVideoFeed = false;
            Surface sceneSurface = new Surface();

            sceneSurface.ElevationSources.Add(new ArcGISTiledElevationSource(new Uri("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer")));
            Scene scene = new Scene(Basemap.CreateImagery())
            {
                BaseSurface = sceneSurface
            };

            // Create and add a building layer.
            ArcGISSceneLayer buildingsLayer = new ArcGISSceneLayer(new Uri("https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/Buildings_Brest/SceneServer/layers/0"));

            scene.OperationalLayers.Add(buildingsLayer);
            MapPoint start = new MapPoint(-4.494677, 48.384472, 24.772694, SpatialReferences.Wgs84);

            arview.OriginCamera = new Camera(start, 200, 0, 90, 0);
            arview.Scene        = scene;
            arview.StartTrackingAsync();
        }
Exemple #28
0
        private async void Initialize()
        {
            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateImagery());

            // Provide used Map to the MapView
            MyMapView.Map = myMap;

            // Create a new WMS layer displaying the specified layers from the service
            _wmsLayer = new WmsLayer(_wmsUrl, _wmsLayerNames);

            // Load the layer
            await _wmsLayer.LoadAsync();

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

            // Zoom to the layer's extent
            MyMapView.SetViewpoint(new Viewpoint(_wmsLayer.FullExtent));

            // Subscribe to tap events - starting point for feature identification
            MyMapView.GeoViewTapped += MyMapView_GeoViewTapped;
        }
        private void ApplyBasemap(string basemapName)
        {
            // Get the current map
            Map myMap = MyMapView.Map;

            // Set the basemap for the map according to the user's choice in the list box
            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;

            default:
                break;
            }
        }
Exemple #30
0
        private async void Initialize()
        {
            // Create the layers.
            ArcGISSceneLayer devOne    = new ArcGISSceneLayer(new Uri("https://scenesampleserverdev.arcgis.com/arcgis/rest/services/Hosted/DevA_Trees/SceneServer/layers/0"));
            ArcGISSceneLayer devTwo    = new ArcGISSceneLayer(new Uri("https://scenesampleserverdev.arcgis.com/arcgis/rest/services/Hosted/DevA_Pathways/SceneServer/layers/0"));
            ArcGISSceneLayer devThree  = new ArcGISSceneLayer(new Uri("https://scenesampleserverdev.arcgis.com/arcgis/rest/services/Hosted/DevA_BuildingShell_Textured/SceneServer/layers/0"));
            ArcGISSceneLayer nonDevOne = new ArcGISSceneLayer(new Uri("https://scenesampleserverdev.arcgis.com/arcgis/rest/services/Hosted/PlannedDemo_BuildingShell/SceneServer/layers/0"));
            FeatureLayer     nonDevTwo = new FeatureLayer(new Uri("https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/DevelopmentProjectArea/FeatureServer/0"));

            // Create the group layer and add sublayers.
            GroupLayer gLayer = new GroupLayer();

            gLayer.Name = "Group: Dev A";
            gLayer.Layers.Add(devOne);
            gLayer.Layers.Add(devTwo);
            gLayer.Layers.Add(devThree);

            // Create the scene with a basemap.
            _mySceneView.Scene = new Scene(Basemap.CreateImagery());

            // Add the top-level layers to the scene.
            _mySceneView.Scene.OperationalLayers.Add(gLayer);
            _mySceneView.Scene.OperationalLayers.Add(nonDevOne);
            _mySceneView.Scene.OperationalLayers.Add(nonDevTwo);

            // Wait for all of the layers in the group layer to load.
            await Task.WhenAll(gLayer.Layers.ToList().Select(m => m.LoadAsync()).ToList());

            // Zoom to the extent of the group layer.
            _mySceneView.SetViewpoint(new Viewpoint(gLayer.FullExtent));

            // Add the layer list to the UI.
            foreach (Layer layer in _mySceneView.Scene.OperationalLayers)
            {
                AddLayersToUI(layer);
            }
        }