private async void OnMapViewTapped(object sender, Esri.ArcGISRuntime.Xamarin.Forms.GeoViewInputEventArgs e) { var tolerance = 10d; // Use larger tolerance for touch var maximumResults = 1; // Only return one graphic var onlyReturnPopups = false; // Don't return only popups // Use the following method to identify graphics in a specific graphics overlay IdentifyGraphicsOverlayResult identifyResults = await MyMapView.IdentifyGraphicsOverlayAsync( overlay, e.Position, tolerance, onlyReturnPopups, maximumResults ); // Check if we got results if (identifyResults.Graphics.Count > 0) { // Make sure that the UI changes are done in the UI thread Device.BeginInvokeOnMainThread(async() => { var json = JsonConvert.SerializeObject(identifyResults.Graphics[0].Attributes, Formatting.Indented); await DisplayAlert("", json, "OK"); }); } }
public void GeoViewTapped(object sender, Esri.ArcGISRuntime.Xamarin.Forms.GeoViewInputEventArgs e) { if (MySceneView.SetInitialTransformation(e.Position)) { InitializeSceneAsync(); } else { DisplayAlert("No plane found", "Try moving the phone around until you see white dots", "Ok"); } }
private async void OnMapViewTapped(object sender, Esri.ArcGISRuntime.Xamarin.Forms.GeoViewInputEventArgs e) { var tolerance = 10d; // Use larger tolerance for touch var maximumResults = 1; // Only return one graphic // Use the following method to identify graphics in a specific graphics overlay IReadOnlyList <Graphic> identifyResults = await MyMapView.IdentifyGraphicsOverlayAsync( _polygonOverlay, e.Position, tolerance, maximumResults); // Check if we got results if (identifyResults.Count > 0) { // Make sure that the UI changes are done in the UI thread Device.BeginInvokeOnMainThread(async() => { await DisplayAlert("", "Tapped on graphic", "OK"); }); } }
private async void MainMapView_GeoViewTapped(object sender, Esri.ArcGISRuntime.Xamarin.Forms.GeoViewInputEventArgs e) { Reset(); var layer = MainMapView.Map.OperationalLayers.OfType <FeatureLayer>().FirstOrDefault(X => X.Id == "Victoria_Buildings_4805"); if (layer == null) { return; } var queryResults = await layer.FeatureTable.QueryFeaturesAsync(new Esri.ArcGISRuntime.Data.QueryParameters() { Geometry = GeometryEngine.Buffer(e.Location, 20 * MainMapView.UnitsPerPixel) }); foreach (var result in queryResults.ToArray()) { _overlay.Graphics.Add(new Graphic(result.Geometry, _querySymbol)); } }