protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_shared); arFragment = (ArFragment)SupportFragmentManager.FindFragmentById(Resource.Id.ux_fragment); arFragment.TapArPlane += (s, e) => onTapArPlaneListener(e.HitResult, e.Plane, e.MotionEvent); sceneView = arFragment.ArSceneView; textView = FindViewById <TextView>(Resource.Id.textView); textView.Visibility = ViewStates.Visible; locateButton = FindViewById <Button>(Resource.Id.locateButton); createButton = FindViewById <Button>(Resource.Id.createButton); anchorNumInput = FindViewById <EditText>(Resource.Id.anchorNumText); editTextInfo = FindViewById <TextView>(Resource.Id.editTextInfo); enableCorrectUIControls(); Scene scene = sceneView.Scene; scene.Update += (s, e) => { if (cloudAnchorManager != null) { // Pass frames to Spatial Anchors for processing. cloudAnchorManager.Update(sceneView.ArFrame); } }; MaterialFactory.MakeOpaqueWithColor(this, new Color(Android.Graphics.Color.Red)).GetAsync().ContinueWith(t => failedColor = (Material)t.Result); MaterialFactory.MakeOpaqueWithColor(this, new Color(Android.Graphics.Color.Green)).GetAsync().ContinueWith(t => savedColor = (Material)t.Result); MaterialFactory.MakeOpaqueWithColor(this, new Color(Android.Graphics.Color.Yellow)).GetAsync().ContinueWith(t => readyColor = foundColor = (Material)t.Result); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_anchors); basicDemo = Intent.GetBooleanExtra("BasicDemo", true); arFragment = (ArFragment)SupportFragmentManager.FindFragmentById(Resource.Id.ux_fragment); arFragment.TapArPlane += (s, e) => onTapArPlaneListener(e.HitResult, e.Plane, e.MotionEvent); sceneView = arFragment.ArSceneView; Scene scene = sceneView.Scene; scene.Update += (s, e) => { if (cloudAnchorManager != null) { // Pass frames to Spatial Anchors for processing. cloudAnchorManager.Update(sceneView.ArFrame); } ; }; backButton = FindViewById <Button>(Resource.Id.backButton); statusText = FindViewById <TextView>(Resource.Id.statusText); scanProgressText = FindViewById <TextView>(Resource.Id.scanProgressText); actionButton = FindViewById <Button>(Resource.Id.actionButton); actionButton.Click += (s, e) => advanceDemo(); MaterialFactory.MakeOpaqueWithColor(this, new Color(Android.Graphics.Color.Red)).GetAsync().ContinueWith(t => failedColor = (Material)t.Result); MaterialFactory.MakeOpaqueWithColor(this, new Color(Android.Graphics.Color.Green)).GetAsync().ContinueWith(t => savedColor = (Material)t.Result); MaterialFactory.MakeOpaqueWithColor(this, new Color(Android.Graphics.Color.Yellow)).GetAsync().ContinueWith(t => readyColor = foundColor = (Material)t.Result); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); this.SetContentView(Resource.Layout.activity_anchors); this.basicDemo = this.Intent.GetBooleanExtra("BasicDemo", true); this.arFragment = (ArFragment)this.SupportFragmentManager.FindFragmentById(Resource.Id.ar_fragment); this.arFragment.TapArPlane += (_, e) => this.OnTapArPlaneListener(e.HitResult, e.Plane, e.MotionEvent); this.sceneView = this.arFragment.ArSceneView; Scene scene = this.sceneView.Scene; scene.Update += (_, args) => { // Pass frames to Spatial Anchors for processing. this.cloudAnchorManager?.Update(this.sceneView.ArFrame); }; this.backButton = (Button)this.FindViewById(Resource.Id.backButton); this.backButton.Click += this.OnExitDemoClicked; this.statusText = (TextView)this.FindViewById(Resource.Id.statusText); this.scanProgressText = (TextView)this.FindViewById(Resource.Id.scanProgressText); this.actionButton = (Button)this.FindViewById(Resource.Id.actionButton); this.actionButton.Click += (_, args) => this.AdvanceDemo(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); this.SetContentView(Resource.Layout.activity_shared); this.arFragment = (ArFragment)this.SupportFragmentManager.FindFragmentById(Resource.Id.ar_fragment); this.arFragment.TapArPlane += (sender, args) => this.OnTapArPlaneListener(args.HitResult, args.Plane, args.MotionEvent); this.sceneView = this.arFragment.ArSceneView; this.exitButton = (Button)this.FindViewById(Resource.Id.mainMenu); this.exitButton.Click += this.OnExitDemoClicked; this.textView = (TextView)this.FindViewById(Resource.Id.textView); this.textView.Visibility = ViewStates.Visible; this.locateButton = (Button)this.FindViewById(Resource.Id.locateButton); this.locateButton.Click += this.OnLocateButtonClicked; this.createButton = (Button)this.FindViewById(Resource.Id.createButton); this.createButton.Click += this.OnCreateButtonClicked; this.anchorNumInput = (EditText)this.FindViewById(Resource.Id.anchorNumText); this.editTextInfo = (TextView)this.FindViewById(Resource.Id.editTextInfo); this.EnableCorrectUIControls(); Scene scene = this.sceneView.Scene; scene.Update += (_, args) => { // Pass frames to Spatial Anchors for processing. this.cloudAnchorManager?.Update(this.sceneView.ArFrame); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); this.SetContentView(Resource.Layout.create_anchors); this.arFragment = (ArFragment)this.SupportFragmentManager.FindFragmentById(Resource.Id.ux_fragment); this.arFragment.TapArPlane += (sender, args) => this.OnTapArPlaneListener(args.HitResult, args.Plane, args.MotionEvent); this.sceneView = this.arFragment.ArSceneView; Scene scene = this.sceneView.Scene; scene.Update += (_, args) => { // Pass frames to Spatial Anchors for processing. this.cloudAnchorManager?.Update(this.sceneView.ArFrame); }; this.exitButton = (Button)this.FindViewById(Resource.Id.backButton); this.exitButton.Click += this.OnExitDemoClicked; this.textView = (TextView)this.FindViewById(Resource.Id.statusText); this.textView.Visibility = ViewStates.Visible; this.scanProgressText = (TextView)this.FindViewById(Resource.Id.scanProgressText); // Initialize the colors. MaterialFactory.MakeOpaqueWithColor(this, new Color(Android.Graphics.Color.Red)).GetAsync().ContinueWith(materialTask => failedColor = (Material)materialTask.Result); MaterialFactory.MakeOpaqueWithColor(this, new Color(Android.Graphics.Color.Green)).GetAsync().ContinueWith(materialTask => savedColor = (Material)materialTask.Result); MaterialFactory.MakeOpaqueWithColor(this, new Color(Android.Graphics.Color.Yellow)).GetAsync().ContinueWith(materialTask => { readyColor = (Material)materialTask.Result; foundColor = readyColor; }); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); this.SetContentView(Resource.Layout.activity_shared); this.arFragment = (ArFragment)this.SupportFragmentManager.FindFragmentById(Resource.Id.ux_fragment); this.sceneView = this.arFragment.ArSceneView; this.exitButton = (Button)this.FindViewById(Resource.Id.mainMenu); this.exitButton.Click += this.OnExitDemoClicked; this.textView = (TextView)this.FindViewById(Resource.Id.textView); this.textView.Visibility = ViewStates.Visible; this.locateButton = (Button)this.FindViewById(Resource.Id.locateButton); this.locateButton.Click += this.OnLocateButtonClicked; this.anchorNumInput = (EditText)this.FindViewById(Resource.Id.anchorNumText); this.editTextInfo = (TextView)this.FindViewById(Resource.Id.editTextInfo); this.EnableCorrectUIControls(); Scene scene = this.sceneView.Scene; scene.Update += (_, args) => { // Pass frames to Spatial Anchors for processing. this.cloudAnchorManager?.Update(this.sceneView.ArFrame); }; // Initialize the colors. MaterialFactory.MakeOpaqueWithColor(this, new Color(Android.Graphics.Color.Blue)).GetAsync().ContinueWith(materialTask => failedColor = (Material)materialTask.Result); MaterialFactory.MakeOpaqueWithColor(this, new Color(Android.Graphics.Color.Green)).GetAsync().ContinueWith(materialTask => savedColor = (Material)materialTask.Result); MaterialFactory.MakeOpaqueWithColor(this, new Color(Android.Graphics.Color.Blue)).GetAsync().ContinueWith(materialTask => { readyColor = (Material)materialTask.Result; foundColor = readyColor; }); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); this.SetContentView(Resource.Layout.locate_anchors); this.arFragment = (ArFragment)this.SupportFragmentManager.FindFragmentById(Resource.Id.ux_fragment); this.sceneView = this.arFragment.ArSceneView; Scene scene = this.sceneView.Scene; scene.Update += (_, args) => { // Pass frames to Spatial Anchors for processing. this.cloudAnchorManager?.Update(this.sceneView.ArFrame); }; this.exitButton = (Button)this.FindViewById(Resource.Id.backButton); this.exitButton.Click += this.OnExitDemoClicked; this.locateButton = (Button)this.FindViewById(Resource.Id.locateButton); this.locateButton.Click += this.OnLocateButtonClicked; this.textView = (TextView)this.FindViewById(Resource.Id.statusText); this.textView.Visibility = ViewStates.Visible; this.anchorNumInput = (EditText)this.FindViewById(Resource.Id.anchorNumText); MaterialFactory.MakeOpaqueWithColor(this, new Color(Android.Graphics.Color.Purple)).GetAsync().ContinueWith(materialTask => { readyColor = (Material)materialTask.Result; foundColor = readyColor; }); }
/// <summary> /// Overrise to setup the session configuration /// </summary> protected override Config GetSessionConfiguration(Session session) { var config = new Config(session); config.SetUpdateMode(Config.UpdateMode.LatestCameraImage); config.SetFocusMode(Config.FocusMode.Auto); ArSceneView.SetupSession(session); return(config); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); arSceneView = (ArSceneView)FindViewById(Resource.Id.ar_scene_view); exampleLayout = ViewRenderable.InvokeBuilder().SetView(this, Resource.Layout.example_layout).Build(); CompletableFuture.AllOf(exampleLayout).Handle(this); arSceneView.Scene.AddOnUpdateListener(this); ARLocationPermissionHelper.RequestPermission(this); }
private void SetupSessionForSceneView(Context context, ArSceneView sceneView) { try { Session session = new Session(context); Config config = new Config(session); config.SetUpdateMode(Config.UpdateMode.LatestCameraImage); session.Configure(config); sceneView.SetupSession(session); } catch (Exception ex) { Android.Util.Log.Error("ASADemo: ", ex.ToString()); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_shared); arFragment = (ArFragment)SupportFragmentManager.FindFragmentById(Resource.Id.ux_fragment); arFragment.TapArPlane += (sender, args) => OnTapArPlaneListener(args.HitResult, args.Plane, args.MotionEvent); sceneView = arFragment.ArSceneView; exitButton = (Button)FindViewById(Resource.Id.mainMenu); exitButton.Click += OnExitDemoClicked; exitButton.Visibility = ViewStates.Gone; textView = (TextView)FindViewById(Resource.Id.textView); textView.Visibility = ViewStates.Visible; locateButton = (Button)FindViewById(Resource.Id.locateButton); locateButton.Click += OnLocateButtonClicked; createButton = (Button)FindViewById(Resource.Id.createButton); createButton.Click += OnCreateButtonClicked; anchorNumInput = (EditText)FindViewById(Resource.Id.anchorNumText); editTextInfo = (TextView)FindViewById(Resource.Id.editTextInfo); backingPlateTwo = (LinearLayout)FindViewById(Resource.Id.backingplateTwo); currentStep = DemoStep.MindrStart; EnableCorrectUIControls(); Scene scene = sceneView.Scene; scene.Update += (_, args) => { // Pass frames to Spatial Anchors for processing. cloudAnchorManager?.Update(sceneView.ArFrame); }; // Initialize the colors. MaterialFactory.MakeOpaqueWithColor(this, new Color(Android.Graphics.Color.Red)).GetAsync().ContinueWith(materialTask => failedColor = (Material)materialTask.Result); MaterialFactory.MakeOpaqueWithColor(this, new Color(Android.Graphics.Color.Green)).GetAsync().ContinueWith(materialTask => savedColor = (Material)materialTask.Result); MaterialFactory.MakeOpaqueWithColor(this, new Color(Android.Graphics.Color.DarkBlue)).GetAsync().ContinueWith(materialTask => selectedColor = (Material)materialTask.Result); MaterialFactory.MakeOpaqueWithColor(this, new Color(Android.Graphics.Color.Orange)).GetAsync().ContinueWith(materialTask => { readyColor = (Material)materialTask.Result; foundColor = readyColor; }); // HAX LocateAllAnchors(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_coarse_reloc); arFragment = (ArFragment)SupportFragmentManager.FindFragmentById(Resource.Id.ar_fragment); sceneView = arFragment.ArSceneView; sensorStatusView = FindViewById <SensorStatusView>(Resource.Id.sensor_status); Scene scene = sceneView.Scene; scene.Update += (_, args) => { // Pass frames to Spatial Anchors for processing. cloudAnchorManager?.Update(sceneView.ArFrame); sensorStatusView.Update(); }; FragmentHelper.ReplaceFragment(this, new ActionSelectionFragment()); }