Style JSON configuration on map snapshotter (#11976)

* [core, android, darwin] - add style JSON configuration on MapSnapshotter
This commit is contained in:
Tobrun
2018-05-23 10:52:22 +02:00
committed by GitHub
parent acd8bb3ef8
commit 671fe37b1e
11 changed files with 120 additions and 12 deletions

View File

@@ -86,6 +86,7 @@ public class MapSnapshotter {
private int width;
private int height;
private String styleUrl = Style.MAPBOX_STREETS;
private String styleJson;
private LatLngBounds region;
private CameraPosition cameraPosition;
private boolean showLogo = true;
@@ -111,6 +112,15 @@ public class MapSnapshotter {
return this;
}
/**
* @param styleJson The style json to use
* @return the mutated {@link Options}
*/
public Options withStyleJson(String styleJson) {
this.styleJson = styleJson;
return this;
}
/**
* @param region the region to show in the snapshot.
* This is applied after the camera position
@@ -208,7 +218,7 @@ public class MapSnapshotter {
String programCacheDir = context.getCacheDir().getAbsolutePath();
nativeInitialize(this, fileSource, options.pixelRatio, options.width,
options.height, options.styleUrl, options.region, options.cameraPosition,
options.height, options.styleUrl, options.styleJson, options.region, options.cameraPosition,
options.showLogo, programCacheDir);
}
@@ -462,7 +472,7 @@ public class MapSnapshotter {
protected native void nativeInitialize(MapSnapshotter mapSnapshotter,
FileSource fileSource, float pixelRatio,
int width, int height, String styleUrl,
int width, int height, String styleUrl, String styleJson,
LatLngBounds region, CameraPosition position,
boolean showLogo, String programCacheDir);