public class MapSnapshotter extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
MapSnapshotter.ErrorHandler
Can be used to get notified of errors
in snapshot generation
|
static class |
MapSnapshotter.Options
MapSnapshotter options
|
static interface |
MapSnapshotter.SnapshotReadyCallback
Get notified on snapshot completion.
|
Constructor and Description |
---|
MapSnapshotter(Context context,
MapSnapshotter.Options options)
Creates the Map snapshotter, but doesn't start rendering or
loading yet.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addOverlay(MapSnapshot mapSnapshot)
Draw an overlay on the map snapshot.
|
void |
cancel()
Must be called in on the thread
the object was created on.
|
protected void |
finalize() |
protected void |
nativeCancel() |
protected void |
nativeInitialize(MapSnapshotter mapSnapshotter,
FileSource fileSource,
float pixelRatio,
int width,
int height,
String styleUrl,
String styleJson,
LatLngBounds region,
CameraPosition position,
boolean showLogo,
String programCacheDir,
String localIdeographFontFamily) |
protected void |
nativeStart() |
protected void |
onSnapshotFailed(String reason)
Called by JNI peer when snapshot has failed.
|
protected void |
onSnapshotReady(MapSnapshot snapshot)
Called by JNI peer when snapshot is ready.
|
protected void |
reset() |
void |
setCameraPosition(CameraPosition cameraPosition)
Updates the snapshotter with a new
CameraPosition |
void |
setRegion(LatLngBounds region)
Updates the snapshotter with a new
LatLngBounds |
void |
setSize(int width,
int height)
Updates the snapshotter with a new size
|
void |
setStyleJson(String styleJson)
Updates the snapshotter with a new style json
|
void |
setStyleUrl(String styleUrl)
Updates the snapshotter with a new style url
|
void |
start(MapSnapshotter.SnapshotReadyCallback callback)
Starts loading and rendering the snapshot.
|
void |
start(MapSnapshotter.SnapshotReadyCallback callback,
MapSnapshotter.ErrorHandler errorHandler)
Starts loading and rendering the snapshot.
|
public MapSnapshotter(Context context, MapSnapshotter.Options options)
context
- the Context that is or contains the Application contextoptions
- the options to use for the snapshotpublic void start(MapSnapshotter.SnapshotReadyCallback callback)
callback
- the callback to use when the snapshot is readypublic void start(MapSnapshotter.SnapshotReadyCallback callback, MapSnapshotter.ErrorHandler errorHandler)
callback
- the callback to use when the snapshot is readyerrorHandler
- the error handler to use on snapshot errorspublic void setSize(int width, int height)
width
- the widthheight
- the heightpublic void setCameraPosition(CameraPosition cameraPosition)
CameraPosition
cameraPosition
- the camera positionpublic void setRegion(LatLngBounds region)
LatLngBounds
region
- the regionpublic void setStyleUrl(String styleUrl)
styleUrl
- the style urlpublic void setStyleJson(String styleJson)
styleJson
- the style jsonpublic void cancel()
protected void addOverlay(MapSnapshot mapSnapshot)
mapSnapshot
- the map snapshot to draw the overlay onprotected void onSnapshotReady(MapSnapshot snapshot)
snapshot
- the generated snapshotprotected void onSnapshotFailed(String reason)
reason
- the exception stringprotected void reset()
protected void nativeInitialize(MapSnapshotter mapSnapshotter, FileSource fileSource, float pixelRatio, int width, int height, String styleUrl, String styleJson, LatLngBounds region, CameraPosition position, boolean showLogo, String programCacheDir, String localIdeographFontFamily)
protected void nativeStart()
protected void nativeCancel()
© 2015–2018 Mapbox. All rights reserved.