Class RasterDataSource


  • public final class RasterDataSource
    extends NativeBase

    Data source to load map layers using a raster image format (jpg, png). The example below illustrates how to create a raster data source and how to link it to a newly created map layer.

     RasterDataSource rasterDataSource = new RasterDataSource(mapContext, rasterDataSourceConfig);
    
        MapLayer layer = new MapLayerBuilder()
           // The name and the type of the data source have to be provided.
           // In our case, the name of the raster data source is in rasterDataSourceConfig.
           .withDataSource(rasterDataSourceConfig.name, MapContentType.RASTER_IMAGE)
           .forMap(map)
           .withName("rasterLayer")
           .build();
    • Constructor Detail

      • RasterDataSource

        public RasterDataSource​(@NonNull
                                MapContext context,
                                @NonNull
                                RasterDataSourceConfiguration configuration)

        Creates a RasterDataSource instance with the provided data source configuration.

        Parameters:
        context -

        The map context to associate the data source with.

        configuration -

        The data source configuration object to use.

      • RasterDataSource

        public RasterDataSource​(@NonNull
                                MapContext context,
                                @NonNull
                                RasterDataSourceConfiguration configuration,
                                @NonNull
                                RasterDataSourceListener listener)

        Creates a RasterDataSource instance with the provided data source configuration and registers a listener.

        Parameters:
        context -

        The map context to associate the data source with.

        configuration -

        The data source configuration object to use.

        listener -

        The initial listener to be registered for receiving state notifications. Due to the asynchronous nature of the data source initialization, the listeners registered later might miss some notifications. This listener is guaranteed to receive all notifications.

      • RasterDataSource

        public RasterDataSource​(@NonNull
                                MapContext context,
                                @NonNull
                                java.lang.String name,
                                @NonNull
                                RasterTileSource tileSource)

        Creates a RasterDataSource instance with the provided raster tile source. Note: This is a beta release of this feature, so there could be a few bugs and unexpected behavior. Related APIs may change for new releases without a deprecation process.

        Parameters:
        context -

        The map context to associate the data source with.

        name -

        The unique name of the data source.

        tileSource -

        The raster tile source.

      • RasterDataSource

        public RasterDataSource​(@NonNull
                                MapContext context,
                                @NonNull
                                java.lang.String name,
                                @NonNull
                                RasterTileSource tileSource,
                                @NonNull
                                RasterDataSourceListener listener)

        Creates a RasterDataSource instance with the provided raster tile source and registers a listener. Note: This is a beta release of this feature, so there could be a few bugs and unexpected behavior. Related APIs may change for new releases without a deprecation process.

        Parameters:
        context -

        The map context to associate the data source with.

        name -

        The unique name of the data source.

        tileSource -

        The raster tile source.

        listener -

        The initial listener to be registered for receiving state notifications. Due to the asynchronous nature of the data source initialization, the listeners registered later might miss some notifications. This listener is guaranteed to receive all notifications.

    • Method Detail

      • changeConfiguration

        public void changeConfiguration​(@NonNull
                                        RasterDataSourceConfigurationUpdate configuration)

        Applies the configuration update to the data source. An example for a configuration update is the update to a new bearer token for authentication.

        Parameters:
        configuration -

        The data source configuration update to apply.

      • addListener

        public void addListener​(@NonNull
                                RasterDataSourceListener listener)

        Add listener for receiving state notifications. The new listener is appended to the set of data source listeners as a strong reference and will receive only the notifications occurring after the registration. Caller is responsible for releasing the strong reference by calling removeListener(com.here.sdk.mapview.datasource.RasterDataSourceListener).

        Parameters:
        listener -

        Listener to be added for receiving state notifications.

      • removeListener

        public void removeListener​(@NonNull
                                   RasterDataSourceListener listener)

        Remove a listener from receiving state notifications.

        Parameters:
        listener -

        Listener to be removed from receiving state notifications.

      • removeListeners

        public void removeListeners()

        Remove all listeners from receiving state notifications.

      • destroy

        public void destroy()

        Frees all internally used resources. After calling this method, the object is not usable anymore.