Class PolygonPrefetcher

java.lang.Object
com.here.NativeBase
com.here.sdk.prefetcher.PolygonPrefetcher

public final class PolygonPrefetcher extends NativeBase

Supports downloading of map data - in advance - into the cache to optimize temporary offline use cases that rely on cached map data. Please note, this class puts data in the map cache, which has its own size constraints, and extensive usage may start evicting old cached data. Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.

  • Constructor Details

    • PolygonPrefetcher

      public PolygonPrefetcher(@NonNull SDKNativeEngine sdkEngine)

      Creates a PolygonPrefetcher instance for a given SDKNativeEngine.

      Parameters:
      sdkEngine -

      Instance of an existing SDKEngine.

  • Method Details

    • prefetch

      @NonNull public TaskHandle prefetch(@NonNull GeoPolygon geoPolygon, @NonNull PrefetchStatusListener callback)

      Prefetches map data for an area bounded by geo polygon. After the operation is finished PrefetchStatusListener.onComplete(com.here.sdk.maploader.MapLoaderError) is invoked on the main thread. Progress is reported by invocation of PrefetchStatusListener.onProgress(int) on the main thread. If there is not enough space left in the cache to store needed tiles, operation will fail with MapLoaderError.NOT_ENOUGH_SPACE. To increase cache size, use SDKOptions.cacheSizeInBytes API.

      To control list of map content features for area prefetch, use LayerConfiguration.enabledFeatures.

      To prefetch map data within user-defined circular area around a given location:

      1. Create a GeoCircle using the given location and radius.
      2. Create a GeoPolygon using the GeoCircle.
      3. Pass the afroementioned GeoPolygon to the sdk.prefetcher.PolygonPrefetcher.prefetch API. Usage: GeoCircle geoCircle = GeoCircle(location, radius); GeoPolygon geoPolygon = GeoPolygon.withGeoCircle(geoCircle);
      Parameters:
      geoPolygon -

      Area to prefetch map data for.

      callback -

      Callback that is triggered to report progress and the result of prefetch.

      Returns:

      Handle that will be used to manipulate execution of the task.

    • estimateMapDataSize

      @NonNull public TaskHandle estimateMapDataSize(@NonNull GeoPolygon geoPolygon, @NonNull MapDataSizeListener callback)

      Estimates map data size for the area bounded by geo polygon. Size for tiles that are already in the cache will not be included in the final result.

      Parameters:
      geoPolygon -

      Area to estimate map data size for.

      callback -

      Callback that is triggered to report the result of map data size estimation.

      Returns:

      Handle that will be used to manipulate execution of the task.