identifyLayer method

Future<IdentifyLayerResult> identifyLayer(
  1. Layer layer, {
  2. required Offset screenPoint,
  3. required double tolerance,
  4. int? maximumResults = 1,
})

Identifies a limited number of geoelements in the specified layer or sublayer, 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 result is returned in a single IdentifyLayerResult instance. If the returnPopupsOnly parameter is true only IdentifyLayerResult.popups is populated. If the layer does not have popups an error is returned. If the returnPopupsOnly parameter is false, both IdentifyLayerResult.geoElements and IdentifyLayerResult.popups are populated, if the layer has popups. IdentifyLayerResult.geoElements and IdentifyLayerResult.popups provide the results in a top-to-bottom order.

Parameters:

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

Return Value: A Future of IdentifyLayerResult.

Implementation

Future<IdentifyLayerResult> identifyLayer(
  Layer layer, {
  required Offset screenPoint,
  required double tolerance,
  int? maximumResults = 1,
}) {
  final coreScreenPoint = screenPoint.toArcGIS();
  final taskHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_GeoView_identifyLayerWithMaxResultsNullable(
      _handle,
      layer._handle,
      coreScreenPoint.ref,
      tolerance,
      maximumResults,
      errorHandler,
    );
  });
  return taskHandle.toFuture(
    (element) => element.getValueAsIdentifyLayerResult()!,
  );
}