protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            try
            {
                var p    = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData);
                var path = System.IO.Path.Combine(p, "philadelphia.mspk");
                MobileScenePackage package = await MobileScenePackage.OpenAsync(path);

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

                // Show the first scene.
                var scene = package.Scenes[0];
                scene.BaseSurface.BackgroundGrid.IsVisible = false;
                scene.BaseSurface.NavigationConstraint     = NavigationConstraint.None;
                ARView.Scene = scene;
                //We'll set the origin of the scene in the middle so we can use that as the tie-point
                ARView.OriginCamera      = new Esri.ArcGISRuntime.Mapping.Camera(39.9579126, -75.1705827, 9.64, 0, 90, 0);
                ARView.TranslationFactor = 1000; // By increasing the translation factor, the scene appears as if it's at scale 1:1000
                ARView.NorthAlign        = false;
                //Set the clipping distance to only render a circular area around the origin
                ARView.ClippingDistance = 350;
                //Set the initial location 1.5 meter in front of and .5m above the scene
                ARView.SetInitialTransformation(TransformationMatrix.Create(0, 0, 0, 1, 0, .5, 1.5));
                //Listen for double-tap to place
                ARView.GeoViewDoubleTapped += ArView_GeoViewDoubleTapped;
            }
            catch (System.Exception ex)
            {
                Toast.MakeText(this, "Failed to load scene: \n" + ex.Message, ToastLength.Long).Show();
            }
            ToggleRenderPlanes(true);
        }
Esempio n. 2
0
        private async void Init()
        {
            try
            {
                var p    = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData);
                var path = System.IO.Path.Combine(p, "philadelphia.mspk");
                MobileScenePackage package = await MobileScenePackage.OpenAsync(path);

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

                // Show the first scene.
                var scene = package.Scenes[0];
                scene.BaseSurface.BackgroundGrid.IsVisible = false;
                scene.BaseSurface.NavigationConstraint     = NavigationConstraint.None;
                ARView.Scene = scene;
                //We'll set the origin of the scene in the middle so we can use that as the tie-point
                ARView.OriginCamera      = new Esri.ArcGISRuntime.Mapping.Camera(39.9579126, -75.1705827, 9.64, 0, 90, 0);
                ARView.TranslationFactor = 1000; // By increasing the translation factor, the scene appears as if it's at scale 1:1000
                //Set the initial location 1.5 meter in front of and .5m above the scene
                ARView.SetInitialTransformation(TransformationMatrix.Create(0, 0, 0, 1, 0, .5, 1.5));
                //Set the clipping distance to only render a circular area around the origin
                ARView.ClippingDistance = 350;
                //Listend for double-tap to place
                ARView.GeoViewDoubleTapped        += ArView_GeoViewDoubleTapped;
                scene.OperationalLayers[0].Opacity = .5;
            }
            catch (System.Exception ex)
            {
                await DisplayAlert("Failed to load scene", ex.Message, "OK");

                await Navigation.PopAsync();
            }
        }
 private void ArView_GeoViewDoubleTapped(object sender, GeoViewInputEventArgs e)
 {
     if (ARView.SetInitialTransformation(e.Position))
     {
         Toast.MakeText(this, "Placed scene", ToastLength.Short).Show();
     }
     else
     {
         Toast.MakeText(this, "Couldn't place scene", ToastLength.Short).Show();
     }
 }
Esempio n. 4
0
 private void ArView_GeoViewDoubleTapped(object sender, GeoViewInputEventArgs e)
 {
     if (ARView.Scene?.LoadStatus != Esri.ArcGISRuntime.LoadStatus.Loaded)
     {
         return;
     }
     if (ARView.SetInitialTransformation(e.Position))
     {
         //Scene placed successfully
         ARView.Scene.OperationalLayers[0].Opacity = 1;
     }
 }
Esempio n. 5
0
 private void ARView_OnLocationSelected(ARView sender, LocationsVM.Location location)
 {
     if (ARView.ExternalUserControl == null)
     {
         ARView.ExternalUserControl = new ExternalControl()
         {
             DataContext = location
         }
     }
     ;
     else
     {
         ARView.ExternalUserControl = null;
     }
 }
Esempio n. 6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            ARView kaart;

            kaart = new ARView(this);
            //titel
            RunningApp          = new TextView(this);
            RunningApp.TextSize = 40;
            RunningApp.Text     = "Running App! ";
            RunningApp.SetTextColor(Color.Blue);

            // start+stop knop
            Startknop          = new Button(this);
            Startknop.TextSize = 20;
            Startknop.Text     = "Start";
            Startknop.SetTextColor(Color.Pink);
            Stopknop          = new Button(this);
            Stopknop.TextSize = 20;
            Stopknop.Text     = "Stop";
            Stopknop.SetTextColor(Color.Pink);

            //De knoppen
            LinearLayout knoppen;

            knoppen = new LinearLayout(this);
            knoppen.AddView(Startknop);
            knoppen.AddView(Stopknop);
            knoppen.Orientation = Orientation.Horizontal;

            //Overzicht
            LinearLayout Overzicht;

            Overzicht = new LinearLayout(this);
            Overzicht.AddView(RunningApp);
            Overzicht.AddView(knoppen);
            Overzicht.AddView(kaart);
            Overzicht.Orientation = Orientation.Vertical;

            this.SetContentView(Overzicht);
        }
Esempio n. 7
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();
            }
        }
 protected override void OnDisappearing()
 {
     base.OnDisappearing();
     ARView.StopTrackingAsync();
 }
 protected override void OnAppearing()
 {
     base.OnAppearing();
     ARView.StartTrackingAsync();
 }
Esempio n. 10
0
 protected override void OnAppearing()
 {
     base.OnAppearing();
     ARView.StartTrackingAsync(Esri.ArcGISRuntime.ARToolkit.ARLocationTrackingMode.Ignore);
 }
Esempio n. 11
0
 private void ARView_OnLocationReleased(ARView sender, LocationsVM.Location location)
 {
     ARView.ExternalUserControl = null;
 }