identifyGraphicsOverlay method

Future<IdentifyGraphicsOverlayResult> identifyGraphicsOverlay(
  1. GraphicsOverlay graphicsOverlay,
  2. {required Offset screenPoint,
  3. required double tolerance,
  4. int? maximumResults = 1}
)

Identifies a limited number of graphics in the specified graphics overlay, at the given screen point.

As locations from user gestures are not always accurate to the exact pixel, you can define a tolerance for the identify operation. The tolerance parameter sets the radius of a circle, centered at the specified coordinates, in device-independent pixels (DIP). If the tolerance value is 0, identify performs the test at the specified coordinates. If it is greater than 0, identify tests inside the circle. For touch displays a value of 22 is recommended to cover an average finger tap. The maximum allowed value is 100 DIPs.

The returnPopupsOnly parameter controls which properties are populated in the IdentifyGraphicsOverlayResult instance. If true, only IdentifyGraphicsOverlayResult.popups is populated. If the overlay does not have popups an error is returned. If false, IdentifyGraphicsOverlayResult.geoElements, IdentifyGraphicsOverlayResult.graphics, and IdentifyGraphicsOverlayResult.popups are populated, if the overlay has popups.

Parameters:

  • graphicsOverlay — The graphics overlay in which to identify the graphics.
  • screenPoint — The screen coordinates to identify the graphics.
  • tolerance — A radius in device-independent pixels (DIP) that specifies how precise the identify operation should be.
  • maximumResults — The maximum number of graphics and/or popups returned in the IdentifyGraphicsOverlayResult. A value of 1 means that only the top-most graphic or popup will be identified. A value of null means that the number of results will not be limited.

Return Value: A Future of IdentifyGraphicsOverlayResult

Implementation

Future<IdentifyGraphicsOverlayResult> identifyGraphicsOverlay(
    GraphicsOverlay graphicsOverlay,
    {required Offset screenPoint,
    required double tolerance,
    int? maximumResults = 1}) {
  final coreScreenPoint = screenPoint.toArcGIS();
  final taskHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore
        .RT_GeoView_identifyGraphicsOverlayWithMaxResultsNullable(
            _handle,
            graphicsOverlay._handle,
            coreScreenPoint.ref,
            tolerance,
            maximumResults,
            errorHandler);
  });
  return taskHandle.toFuture(
      (element) => element.getValueAsIdentifyGraphicsOverlayResult()!);
}