diff options
author | Tobrun <tobrun@mapbox.com> | 2018-05-23 10:52:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-23 10:52:22 +0200 |
commit | 671fe37b1e6cde56c3edec76ce62542e4c8e57b7 (patch) | |
tree | 28d30fe67943a8ca258b4a57ebd435b947afdf82 /platform/android/src | |
parent | acd8bb3ef8df8611e4507225358b0a9ab7dc48a5 (diff) | |
download | qtlocation-mapboxgl-671fe37b1e6cde56c3edec76ce62542e4c8e57b7.tar.gz |
Style JSON configuration on map snapshotter (#11976)
* [core, android, darwin] - add style JSON configuration on MapSnapshotter
Diffstat (limited to 'platform/android/src')
-rw-r--r-- | platform/android/src/snapshotter/map_snapshotter.cpp | 12 | ||||
-rw-r--r-- | platform/android/src/snapshotter/map_snapshotter.hpp | 1 |
2 files changed, 11 insertions, 2 deletions
diff --git a/platform/android/src/snapshotter/map_snapshotter.cpp b/platform/android/src/snapshotter/map_snapshotter.cpp index a006953d36..ca1307dd16 100644 --- a/platform/android/src/snapshotter/map_snapshotter.cpp +++ b/platform/android/src/snapshotter/map_snapshotter.cpp @@ -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"), diff --git a/platform/android/src/snapshotter/map_snapshotter.hpp b/platform/android/src/snapshotter/map_snapshotter.hpp index 4cdf4bcf2b..33d32e01a1 100644 --- a/platform/android/src/snapshotter/map_snapshotter.hpp +++ b/platform/android/src/snapshotter/map_snapshotter.hpp @@ -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, |