private async void SceneViewTapped(object sender, Esri.ArcGISRuntime.Xamarin.Forms.GeoViewInputEventArgs e) { // Get the scene layer from the scene (first and only operational layer). ArcGISSceneLayer sceneLayer = (ArcGISSceneLayer)MySceneView.Scene.OperationalLayers.First(); // Clear any existing selection. sceneLayer.ClearSelection(); try { // Identify the layer at the tap point. // Use a 10-pixel tolerance around the point and return a maximum of one feature. Point tapPoint = new Point(e.Position.X, e.Position.Y); IdentifyLayerResult result = await MySceneView.IdentifyLayerAsync(sceneLayer, tapPoint, 10, false, 1); // Get the GeoElements that were identified (will be 0 or 1 element). IReadOnlyList <GeoElement> geoElements = result.GeoElements; // If a GeoElement was identified, select it in the scene. if (geoElements.Any()) { GeoElement geoElement = geoElements.FirstOrDefault(); if (geoElement != null) { // Select the feature to highlight it in the scene view. sceneLayer.SelectFeature((Feature)geoElement); } } } catch (Exception ex) { await Application.Current.MainPage.DisplayAlert("Error", ex.ToString(), "OK"); } }
private async void SceneViewTapped(object sender, Esri.ArcGISRuntime.UI.Controls.GeoViewInputEventArgs e) { // Get the scene layer from the scene (first and only operational layer). ArcGISSceneLayer sceneLayer = (ArcGISSceneLayer)MySceneView.Scene.OperationalLayers.First(); // Clear any existing selection. sceneLayer.ClearSelection(); // Identify the layer at the tap point. // Use a 10-pixel tolerance around the point and return a maximum of one feature. IdentifyLayerResult result = await MySceneView.IdentifyLayerAsync(sceneLayer, e.Position, 10, false, 1); // Get the GeoElements that were identified (will be 0 or 1 element). IReadOnlyList <GeoElement> geoElements = result.GeoElements; // If a GeoElement was identified, select it in the scene. if (geoElements.Any()) { GeoElement geoElement = geoElements.FirstOrDefault(); if (geoElement != null) { // Select the feature to highlight it in the scene view. sceneLayer.SelectFeature((Feature)geoElement); } } }
private async void SceneViewTapped(object sender, GeoViewInputEventArgs e) { // Get the scene layer from the scene (first and only operational layer). ArcGISSceneLayer sceneLayer = (ArcGISSceneLayer)_mySceneView.Scene.OperationalLayers.First(); // Clear any existing selection. sceneLayer.ClearSelection(); try { // Identify the layer at the tap point. // Use a 10-pixel tolerance around the point and return a maximum of one feature. IdentifyLayerResult result = await _mySceneView.IdentifyLayerAsync(sceneLayer, e.Position, 10, false, 1); // Get the GeoElements that were identified (will be 0 or 1 element). IReadOnlyList <GeoElement> geoElements = result.GeoElements; // If a GeoElement was identified, select it in the scene. if (geoElements.Any()) { GeoElement geoElement = geoElements.FirstOrDefault(); if (geoElement != null) { // Select the feature to highlight it in the scene view. sceneLayer.SelectFeature((Feature)geoElement); } } } catch (Exception ex) { new AlertDialog.Builder(this).SetMessage(ex.ToString()).SetTitle("Error").Show(); } }