identifyLayers method

Future<List<IdentifyLayerResult>> identifyLayers(
  1. {required Offset screenPoint,
  2. required double tolerance,
  3. int? maximumResultsPerLayer = 1}
)

Identifies a limited number of geoelements at the given screen point, in each identifiable layer or sublayer in the GeoViewController's ArcGISMap or ArcGISScene.

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 collection of IdentifyLayerResult to match the order of the GeoViewController's GeoModel.operationalLayers or GeoModel.operationalLayers collection. 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:

  • 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.
  • maximumResultsPerLayer — The maximum number of geoelements and/or popups returned in the IdentifyLayerResult per layer or sublayer. 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 List of IdentifyLayerResult, containing one entry for each layer in the view that supports identify. Each entry contains a Layer and a List of elements of the type contained by the layer (for example, Feature for a FeatureLayer).

Implementation

Future<List<IdentifyLayerResult>> identifyLayers(
    {required Offset screenPoint,
    required double tolerance,
    int? maximumResultsPerLayer = 1}) {
  final coreScreenPoint = screenPoint.toArcGIS();
  final taskHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_GeoView_identifyLayersWithMaxResultsNullable(
        _handle,
        coreScreenPoint.ref,
        tolerance,
        maximumResultsPerLayer,
        errorHandler);
  });
  return taskHandle.toFuture((element) => element.getValueAsList()!);
}