ArcGISRuntimeXamarin.Samples.FeatureLayerSelection.FeatureLayerSelection.OnMapViewTapped C# (CSharp) 메소드

OnMapViewTapped() 개인적인 메소드

private OnMapViewTapped ( object sender, GeoViewInputEventArgs e ) : void
sender object
e GeoViewInputEventArgs
리턴 void
        private async void OnMapViewTapped(object sender, GeoViewInputEventArgs e)
        {
            try
            {
                // Define the selection tolerance
                double tolerance = 5;

                // Convert the tolerance to map units
                double mapTolerance = tolerance * MyMapView.UnitsPerPixel;

                // Define the envelope around the tap location for selecting features
                var selectionEnvelope = new Envelope(e.Location.X - mapTolerance, e.Location.Y - mapTolerance, e.Location.X + mapTolerance,
                    e.Location.Y + mapTolerance, MyMapView.Map.SpatialReference);

                // Define the query parameters for selecting features
                var queryParams = new QueryParameters();

                // Set the geometry to selection envelope for selection by geometry
                queryParams.Geometry = selectionEnvelope;

                // Select the features based on query parameters defined above
                await _featureLayer.SelectFeaturesAsync(queryParams, SelectionMode.New);
            }
            catch (Exception ex)
            {
                await DisplayAlert("Sample error", ex.ToString(),"OK");
            }
        }
    }