RasterDataSource
public class RasterDataSource
extension RasterDataSource: NativeBase
extension RasterDataSource: Hashable
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.
let rasterDataSource = RasterDataSource(mapContext, rasterDataSourceConfig)
let layer = 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(named: rasterDataSourceConfig.name, contentType: MapContentType.rasterImage)
.forMap(map)
.withName("rasterLayer")
.build();
-
Creates a RasterDataSource instance with the provided data source configuration.
Declaration
Swift
public init(context: MapContext, configuration: RasterDataSourceConfiguration)Parameters
contextThe map context to associate the data source with.
configurationThe data source configuration object to use.
-
Creates a RasterDataSource instance with the provided data source configuration and registers a delegate.
Declaration
Swift
public init(context: MapContext, configuration: RasterDataSourceConfiguration, delegate: RasterDataSourceDelegate)Parameters
contextThe map context to associate the data source with.
configurationThe data source configuration object to use.
delegateThe initial delegate to be registered for receiving state notifications. Due to the asynchronous nature of the data source initialization, the delegates registered later might miss some notifications. This delegate is guaranteed to receive all notifications.
-
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.
Declaration
Swift
public init(context: MapContext, name: String, tileSource: RasterTileSource)Parameters
contextThe map context to associate the data source with.
nameThe unique name of the data source.
tileSourceThe raster tile source.
-
Creates a RasterDataSource instance with the provided raster tile source and registers a delegate. 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.
Declaration
Swift
public init(context: MapContext, name: String, tileSource: RasterTileSource, delegate: RasterDataSourceDelegate)Parameters
contextThe map context to associate the data source with.
nameThe unique name of the data source.
tileSourceThe raster tile source.
delegateThe initial delegate to be registered for receiving state notifications. Due to the asynchronous nature of the data source initialization, the delegates registered later might miss some notifications. This delegate is guaranteed to receive all notifications.
-
Applies the configuration update to the data source. An example for a configuration update is the update to a new bearer token for authentication.
Declaration
Swift
public func changeConfiguration(_ configuration: RasterDataSourceConfigurationUpdate)Parameters
configurationThe data source configuration update to apply.
-
Add delegate for receiving state notifications. The new delegate is appended to the set of data source delegates as a strong reference and will receive only the notifications occurring after the registration. Caller is responsible for releasing the strong reference by calling
RasterDataSource.removeDelegate(...).Declaration
Swift
public func addDelegate(_ listener: RasterDataSourceDelegate)Parameters
listenerDelegate to be added for receiving state notifications.
-
Remove a delegate from receiving state notifications.
Declaration
Swift
public func removeDelegate(_ listener: RasterDataSourceDelegate)Parameters
listenerDelegate to be removed from receiving state notifications.
-
Remove all delegates from receiving state notifications.
Declaration
Swift
public func removeDelegates()