diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2017-10-02 17:22:56 +0300 |
---|---|---|
committer | Fabian Guerra Soto <fabian.guerra@mapbox.com> | 2017-11-01 09:23:53 -0400 |
commit | fd3587608b950df86809606819e89fbe71139ac3 (patch) | |
tree | 1f825b49f527b41f5dba21f3d9b888f5bc782a03 /platform/android/src/snapshotter/map_snapshotter.cpp | |
parent | 31873725d7612621792af2258c55ab414b64acb6 (diff) | |
download | qtlocation-mapboxgl-fd3587608b950df86809606819e89fbe71139ac3.tar.gz |
[android] map snapshotter - add mutators
Diffstat (limited to 'platform/android/src/snapshotter/map_snapshotter.cpp')
-rw-r--r-- | platform/android/src/snapshotter/map_snapshotter.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/platform/android/src/snapshotter/map_snapshotter.cpp b/platform/android/src/snapshotter/map_snapshotter.cpp index d64218d11a..74e43c70a1 100644 --- a/platform/android/src/snapshotter/map_snapshotter.cpp +++ b/platform/android/src/snapshotter/map_snapshotter.cpp @@ -81,9 +81,26 @@ void MapSnapshotter::start(JNIEnv&) { void MapSnapshotter::cancel(JNIEnv&) { MBGL_VERIFY_THREAD(tid); - snapshotCallback.reset(); - snapshotter.reset(); +} + + +void MapSnapshotter::setStyleUrl(JNIEnv& env, jni::String styleURL) { + snapshotter->setStyleURL(jni::Make<std::string>(env, styleURL)); +} + +void MapSnapshotter::setSize(JNIEnv&, jni::jint width, jni::jint height) { + auto size = mbgl::Size { static_cast<uint32_t>(width), static_cast<uint32_t>(height) }; + snapshotter->setSize(size); +} + +void MapSnapshotter::setCameraPosition(JNIEnv& env, jni::Object<CameraPosition> position) { + auto options = CameraPosition::getCameraOptions(env, position); + snapshotter->setCameraOptions(options); +} + +void MapSnapshotter::setRegion(JNIEnv& env, jni::Object<LatLngBounds> region) { + snapshotter->setRegion(LatLngBounds::getLatLngBounds(env, region)); } // Static methods // @@ -101,6 +118,10 @@ void MapSnapshotter::registerNative(jni::JNIEnv& env) { 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::String>, "nativeInitialize", "finalize", + METHOD(&MapSnapshotter::setStyleUrl, "setStyleUrl"), + METHOD(&MapSnapshotter::setSize, "setSize"), + METHOD(&MapSnapshotter::setCameraPosition, "setCameraPosition"), + METHOD(&MapSnapshotter::setRegion, "setRegion"), METHOD(&MapSnapshotter::start, "nativeStart"), METHOD(&MapSnapshotter::cancel, "nativeCancel") ); |