Style JSON configuration on map snapshotter (#11976)
* [core, android, darwin] - add style JSON configuration on MapSnapshotter
This commit is contained in:
@@ -20,6 +20,7 @@ MapSnapshotter::MapSnapshotter(jni::JNIEnv& _env,
|
||||
jni::jint width,
|
||||
jni::jint height,
|
||||
jni::String styleURL,
|
||||
jni::String styleJSON,
|
||||
jni::Object<LatLngBounds> region,
|
||||
jni::Object<CameraPosition> position,
|
||||
jni::jboolean _showLogo,
|
||||
@@ -42,12 +43,19 @@ MapSnapshotter::MapSnapshotter(jni::JNIEnv& _env,
|
||||
if (region) {
|
||||
bounds = LatLngBounds::getLatLngBounds(_env, region);
|
||||
}
|
||||
|
||||
std::pair<bool, std::string> style;
|
||||
if (styleJSON) {
|
||||
style = std::make_pair(true, jni::Make<std::string>(_env, styleJSON));
|
||||
} else {
|
||||
style = std::make_pair(false, jni::Make<std::string>(_env, styleURL));
|
||||
}
|
||||
|
||||
showLogo = _showLogo;
|
||||
// Create the core snapshotter
|
||||
snapshotter = std::make_unique<mbgl::MapSnapshotter>(fileSource,
|
||||
*threadPool,
|
||||
jni::Make<std::string>(_env, styleURL),
|
||||
style,
|
||||
size,
|
||||
pixelRatio,
|
||||
cameraOptions,
|
||||
@@ -141,7 +149,7 @@ void MapSnapshotter::registerNative(jni::JNIEnv& env) {
|
||||
|
||||
// Register the peer
|
||||
jni::RegisterNativePeer<MapSnapshotter>(env, MapSnapshotter::javaClass, "nativePtr",
|
||||
std::make_unique<MapSnapshotter, JNIEnv&, jni::Object<MapSnapshotter>, jni::Object<FileSource>, jni::jfloat, jni::jint, jni::jint, jni::String, jni::Object<LatLngBounds>, jni::Object<CameraPosition>, jni::jboolean, jni::String>,
|
||||
std::make_unique<MapSnapshotter, JNIEnv&, jni::Object<MapSnapshotter>, jni::Object<FileSource>, jni::jfloat, jni::jint, jni::jint, jni::String, jni::String, jni::Object<LatLngBounds>, jni::Object<CameraPosition>, jni::jboolean, jni::String>,
|
||||
"nativeInitialize",
|
||||
"finalize",
|
||||
METHOD(&MapSnapshotter::setStyleUrl, "setStyleUrl"),
|
||||
|
||||
@@ -34,6 +34,7 @@ public:
|
||||
jni::jint width,
|
||||
jni::jint height,
|
||||
jni::String styleURL,
|
||||
jni::String styleJSON,
|
||||
jni::Object<LatLngBounds> region,
|
||||
jni::Object<CameraPosition> position,
|
||||
jni::jboolean showLogo,
|
||||
|
||||
Reference in New Issue
Block a user