private Anchor CreateAnchor(HitResult hitResult) { AnchorVisual visual = new AnchorVisual(hitResult.CreateAnchor()); visual.SetColor(readyColorMaterial); visual.AddToScene(this.arFragment); this.anchorVisuals[string.Empty] = visual; this.RunOnUiThread(() => { this.scanProgressText.Visibility = ViewStates.Visible; if (this.enoughDataForSaving) { this.statusText.Text = "Ready to save"; this.actionButton.Text = "Save cloud anchor"; this.actionButton.Visibility = ViewStates.Visible; } else { this.statusText.Text = "Move around the anchor"; } }); this.currentDemoStep = DemoStep.SaveAnchor; return(visual.LocalAnchor); }
private Anchor CreateAnchor(HitResult hitResult) { AnchorVisual visual = new AnchorVisual(hitResult.CreateAnchor()); visual.SetColor(readyColor); visual.AddToScene(this.arFragment); this.anchorVisuals[string.Empty] = visual; return(visual.LocalAnchor); }
private void AnchorLookedUp(string anchorId) { Log.Debug("ASADemo", "anchor " + anchorId); this.anchorId = anchorId; this.DestroySession(); bool anchorLocated = false; this.cloudAnchorManager = new AzureSpatialAnchorsManager(this.sceneView.Session); this.cloudAnchorManager.OnAnchorLocated += (sender, args) => this.RunOnUiThread(() => { CloudSpatialAnchor anchor = args.Anchor; LocateAnchorStatus status = args.Status; if (status == LocateAnchorStatus.AlreadyTracked || status == LocateAnchorStatus.Located) { anchorLocated = true; AnchorVisual foundVisual = new AnchorVisual(anchor.LocalAnchor) { CloudAnchor = anchor }; foundVisual.AnchorNode.SetParent(this.arFragment.ArSceneView.Scene); string cloudAnchorIdentifier = foundVisual.CloudAnchor.Identifier; foundVisual.SetColor(foundColor); foundVisual.AddToScene(this.arFragment); this.anchorVisuals[cloudAnchorIdentifier] = foundVisual; } }); this.cloudAnchorManager.OnLocateAnchorsCompleted += (sender, args) => { this.currentStep = DemoStep.Start; this.RunOnUiThread(() => { if (anchorLocated) { this.textView.Text = "Anchor located!"; } else { this.textView.Text = "Anchor was not located. Check the logs for errors and\\or create a new anchor and try again."; } this.EnableCorrectUIControls(); }); }; this.cloudAnchorManager.StartSession(); AnchorLocateCriteria criteria = new AnchorLocateCriteria(); criteria.SetIdentifiers(new string[] { anchorId }); this.cloudAnchorManager.StartLocating(criteria); }
private void RenderLocatedAnchor(CloudSpatialAnchor anchor) { AnchorVisual foundVisual = new AnchorVisual(anchor.LocalAnchor) { CloudAnchor = anchor }; foundVisual.AnchorNode.SetParent(this.arFragment.ArSceneView.Scene); string cloudAnchorIdentifier = foundVisual.CloudAnchor.Identifier; foundVisual.SetColor(foundColorMaterial); foundVisual.AddToScene(this.arFragment); this.anchorVisuals[cloudAnchorIdentifier] = foundVisual; }