diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2017-10-02 17:22:56 +0300 |
---|---|---|
committer | Ivo van Dongen <ivovandongen@users.noreply.github.com> | 2017-10-31 19:52:08 +0200 |
commit | 7481d317e772879fe4f346b3e0f11679ee26e7b1 (patch) | |
tree | c5f7adcdac40994da90f7dc9efd1530317528249 /platform/android/src/snapshotter | |
parent | d37144d2f8be08f499918232ec49a3cae801de46 (diff) | |
download | qtlocation-mapboxgl-7481d317e772879fe4f346b3e0f11679ee26e7b1.tar.gz |
[android] map snapshotter - add mutators
Diffstat (limited to 'platform/android/src/snapshotter')
-rw-r--r-- | platform/android/src/snapshotter/map_snapshotter.cpp | 25 | ||||
-rw-r--r-- | platform/android/src/snapshotter/map_snapshotter.hpp | 8 |
2 files changed, 31 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") ); diff --git a/platform/android/src/snapshotter/map_snapshotter.hpp b/platform/android/src/snapshotter/map_snapshotter.hpp index 093f589c05..fa8a2d7a5a 100644 --- a/platform/android/src/snapshotter/map_snapshotter.hpp +++ b/platform/android/src/snapshotter/map_snapshotter.hpp @@ -40,6 +40,14 @@ public: ~MapSnapshotter(); + void setStyleUrl(JNIEnv&, jni::String styleURL); + + void setSize(JNIEnv&, jni::jint width, jni::jint height); + + void setCameraPosition(JNIEnv&, jni::Object<CameraPosition> position); + + void setRegion(JNIEnv&, jni::Object<LatLngBounds> region); + void start(JNIEnv&); void cancel(JNIEnv&); |