Example #1
0
        public static async Task <Scene> CreateBerlin(ARSceneView sv)
        {
            // URL for a scene service of buildings in Brest, France
            Uri buildingsService = new Uri("https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/Buildings_Berlin/SceneServer");
            var iml = new ArcGISSceneLayer(buildingsService)
            {
                Opacity = 1
            };
            await iml.LoadAsync();

            var      observerCamera = new Esri.ArcGISRuntime.Mapping.Camera(new MapPoint(-4.49492, 48.3808, 48.2511, SpatialReferences.Wgs84), 344.488, 74.1212, 0.0);
            MapPoint center         = (MapPoint)GeometryEngine.Project(iml.FullExtent.GetCenter(), SpatialReferences.Wgs84);

            observerCamera = new Esri.ArcGISRuntime.Mapping.Camera(center.Y, center.X, 600, 120, 60, 0);
            var scene = new Scene(Basemap.CreateImagery());

            scene.InitialViewpoint = new Esri.ArcGISRuntime.Mapping.Viewpoint(observerCamera.Location, observerCamera);
            scene.OperationalLayers.Add(iml);
            scene.BaseSurface = new Surface();
            scene.BaseSurface.BackgroundGrid.IsVisible = false;
            scene.BaseSurface.ElevationSources.Add(new ArcGISTiledElevationSource(new Uri("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer")));
            scene.BaseSurface.NavigationConstraint = NavigationConstraint.None;
            sv.TranslationFactor = 1000;
            return(scene);
        }
Example #2
0
        public static async Task <Scene> CreateBrestFrance(ARSceneView sv)
        {
            // URL for a scene service of buildings in Brest, France
            string brestFrance         = @"https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/Buildings_Brest/SceneServer/layers/0";
            string _elevationSourceUrl = @"https://scene.arcgis.com/arcgis/rest/services/BREST_DTM_1M/ImageServer";
            var    scene = new Scene(Basemap.CreateImagery());

            var observerCamera = new Esri.ArcGISRuntime.Mapping.Camera(new MapPoint(-4.49492, 48.3808, 48.2511, SpatialReferences.Wgs84), 344.488, 74.1212, 0.0);

            scene.InitialViewpoint = new Esri.ArcGISRuntime.Mapping.Viewpoint(observerCamera.Location, observerCamera);

            scene.BaseSurface = new Surface();
            scene.BaseSurface.BackgroundGrid.IsVisible = false;
            scene.BaseSurface.ElevationSources.Add(new ArcGISTiledElevationSource(new Uri(_elevationSourceUrl)));
            scene.BaseSurface.NavigationConstraint = NavigationConstraint.None;
            var iml = new ArcGISSceneLayer(new Uri(brestFrance))
            {
                Opacity = 1
            };

            scene.OperationalLayers.Add(iml);
            await iml.LoadAsync();

            sv.TranslationFactor = 250;
            return(scene);
        }
Example #3
0
        private async void DisplayScene()
        {
            try
            {
                if (_tabletopScene == null)
                {
                    // Get the downloaded mobile scene package.
                    MobileScenePackage package = await MobileScenePackage.OpenAsync(
                        DataManager.GetDataFolder("7dd2f97bb007466ea939160d0de96a9d", "philadelphia.mspk"));

                    // Load the package.
                    await package.LoadAsync();

                    // Get the first scene.
                    _tabletopScene = package.Scenes.First();

                    // Set the clipping distance for the scene.
                    _arSceneView.ClippingDistance = 400;

                    // Enable subsurface navigation. This allows you to look at the scene from below.
                    _tabletopScene.BaseSurface.NavigationConstraint = NavigationConstraint.None;
                }

                // Display the scene.
                _arSceneView.Scene = _tabletopScene;

                // Create a camera at the bottom and center of the scene.
                //    This camera is the point at which the scene is pinned to the real-world surface.
                var originCamera = new Esri.ArcGISRuntime.Mapping.Camera(39.95787000283599,
                                                                         -75.16996728256345,
                                                                         8.813445091247559,
                                                                         0, 90, 0);

                // Set the origin camera.
                _arSceneView.OriginCamera = originCamera;

                // The width of the scene content is about 800 meters.
                double geographicContentWidth = 800;

                // The desired physical width of the scene is 1 meter.
                double tableContainerWidth = 1;

                // Set the translation factor based on the scene content width and desired physical size.
                _arSceneView.TranslationFactor = geographicContentWidth / tableContainerWidth;
            }
            catch (System.Exception ex)
            {
                new Android.App.AlertDialog.Builder(this).SetMessage("Failed to load scene").SetTitle("Error").Show();
                System.Diagnostics.Debug.WriteLine(ex);
            }
        }
Example #4
0
        private async void DisplayScene()
        {
            try
            {
                if (_tabletopScene == null)
                {
                    // Load a scene from ArcGIS Online.
                    _tabletopScene = new Scene(new Uri("https://www.arcgis.com/home/item.html?id=31874da8a16d45bfbc1273422f772270"));
                    await _tabletopScene.LoadAsync();

                    // Set the clipping distance for the scene.
                    _arSceneView.ClippingDistance = 400;

                    // Enable subsurface navigation. This allows you to look at the scene from below.
                    _tabletopScene.BaseSurface.NavigationConstraint = NavigationConstraint.None;
                }

                // Display the scene.
                _arSceneView.Scene = _tabletopScene;

                // Create a camera at the bottom and center of the scene.
                //    This camera is the point at which the scene is pinned to the real-world surface.
                var originCamera = new Esri.ArcGISRuntime.Mapping.Camera(52.52083, 13.40944, 8.813445091247559, 0, 90, 0);

                // Set the origin camera.
                _arSceneView.OriginCamera = originCamera;

                // The width of the scene content is about 800 meters.
                double geographicContentWidth = 800;

                // The desired physical width of the scene is 1 meter.
                double tableContainerWidth = 1;

                // Set the translation factor based on the scene content width and desired physical size.
                _arSceneView.TranslationFactor = geographicContentWidth / tableContainerWidth;
            }
            catch (System.Exception ex)
            {
                new Android.App.AlertDialog.Builder(this).SetMessage("Failed to load scene").SetTitle("Error").Show();
                System.Diagnostics.Debug.WriteLine(ex);
            }
        }