Snapshotter

Snapshotter is high-level component responsible for taking map snapshot with given MapSnapshotOptions.

open class Snapshotter

Constructors

Snapshotter
Link copied to clipboard
fun Snapshotter(context: Context, options: MapSnapshotOptions, overlayOptions: SnapshotOverlayOptions)

Types

Companion
Link copied to clipboard

Static variables and methods.

object Companion

Functions

cameraForCoordinates
Link copied to clipboard

Convenience method that returns the camera options object for given arguments

fun cameraForCoordinates(coordinates: List<Point>, padding: EdgeInsets, bearing: Double, pitch: Double): CameraOptions
cancel
Link copied to clipboard

Cancel taking snapshot if it was running.

fun cancel()
clearData
Link copied to clipboard

Clears temporary map data.

Clears temporary map data from the data path defined in the given resource options. Useful to reduce the disk usage or in case the disk cache contains invalid data.

Note that calling this API will affect all maps that use the same data path and does not affect persistent map data like offline style packages.

fun clearData(callback: AsyncOperationResultCallback)
coordinateBoundsForCamera
Link copied to clipboard

Returns the coordinate bounds for a given camera.

Note that if the given camera shows the antimeridian, the returned wrapped bounds might not represent the minimum bounding box.

fun coordinateBoundsForCamera(options: CameraOptions): CoordinateBounds
destroy
Link copied to clipboard

Destroy snapshotter.

fun destroy()
equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
getCameraState
Link copied to clipboard

Get the current camera state.

fun getCameraState(): CameraState
getSize
Link copied to clipboard

Gets the size of the snapshot

fun getSize(): Size
getStyleJson
Link copied to clipboard

Get the JSON serialization string of the current Mapbox Style in use.

fun getStyleJson(): String
getStyleUri
Link copied to clipboard

Get the URI of the current Mapbox Style in use.

fun getStyleUri(): String
hashCode
Link copied to clipboard
open override fun hashCode(): Int
isInTileMode
Link copied to clipboard

Returns TRUE if the snapshotter is in the tile mode.

fun isInTileMode(): Boolean
setCamera
Link copied to clipboard

Set the camera options of the snapshot.

fun setCamera(cameraOptions: CameraOptions)
setSize
Link copied to clipboard

Sets the size of the snapshot

fun setSize(size: Size)
setStyleJson
Link copied to clipboard

Load the style from a provided JSON string.

This method should be called on the same thread where @see Map object is initialized.

fun setStyleJson(styleJson: String)
setStyleListener
Link copied to clipboard

Set SnapshotStyleListener to listen to all events style related.

fun setStyleListener(listener: SnapshotStyleListener)
setStyleUri
Link copied to clipboard

Set the URI of the current Mapbox Style in use.

fun setStyleUri(styleUri: String)
setTileMode
Link copied to clipboard

Sets the snapshotter to the tile mode.

In the tile mode, the snapshotter fetches the still image of a single tile.

fun setTileMode(set: Boolean)
start
Link copied to clipboard

Start taking a snapshot.

fun start(callback: SnapshotCreatedListener)
subscribe
Link copied to clipboard

Subscribes an Observer to a provided list of event types. Observable will hold a strong reference to an Observer instance, therefore, in order to stop receiving notifications, caller must call unsubscribe with an Observer instance used for an initial subscription.

fun subscribe(observer: Observer, events: List<String>)
toString
Link copied to clipboard
open override fun toString(): String
unsubscribe
Link copied to clipboard

Unsubscribes an Observer from all events.

fun unsubscribe(observer: Observer)

Unsubscribes an Observer from a provided list of event types.

fun unsubscribe(observer: Observer, events: List<String>)