diff options
author | tobrun <tobrun.van.nuland@gmail.com> | 2018-06-26 18:07:18 +0200 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2018-07-05 18:50:21 +0200 |
commit | 99f9787cc4099b76401ab5b9a9ef7d2f894f9ab6 (patch) | |
tree | 638c3ab0d0c2ed723a841f6528a5ceacc9f3f056 /platform/android/src/snapshotter/map_snapshot.cpp | |
parent | 473dd9b23f3bbd933a3af52d896803659f80acfb (diff) | |
download | qtlocation-mapboxgl-99f9787cc4099b76401ab5b9a9ef7d2f894f9ab6.tar.gz |
[core] - add LatLng for screencoordinate to mapsnapshotter
Diffstat (limited to 'platform/android/src/snapshotter/map_snapshot.cpp')
-rw-r--r-- | platform/android/src/snapshotter/map_snapshot.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/platform/android/src/snapshotter/map_snapshot.cpp b/platform/android/src/snapshotter/map_snapshot.cpp index bbbf7cc207..42c1c16ca1 100644 --- a/platform/android/src/snapshotter/map_snapshot.cpp +++ b/platform/android/src/snapshotter/map_snapshot.cpp @@ -8,9 +8,10 @@ namespace mbgl { namespace android { -MapSnapshot::MapSnapshot(float pixelRatio_, MapSnapshot::PointForFn pointForFn_) +MapSnapshot::MapSnapshot(float pixelRatio_, MapSnapshot::PointForFn pointForFn_, MapSnapshot::LatLngForFn latLngForFn_) : pixelRatio(pixelRatio_) - , pointForFn(std::move(pointForFn_)) { + , pointForFn(std::move(pointForFn_)) + , latLngForFn(std::move(latLngForFn_)) { } MapSnapshot::~MapSnapshot() = default; @@ -20,8 +21,8 @@ jni::Object<PointF> MapSnapshot::pixelForLatLng(jni::JNIEnv& env, jni::Object<La return PointF::New(env, point.x * pixelRatio, point.y * pixelRatio); } -jni::Object<LatLng> MapSnapshot::latLngForPixel(jni::JNIEnv& env, jni::Object<PointF>) { - return LatLng::New(env, {0, 0}); +jni::Object<LatLng> MapSnapshot::latLngForPixel(jni::JNIEnv& env, jni::Object<PointF>jPoint) { + return LatLng::New(env, latLngForFn(PointF::getScreenCoordinate(env, jPoint))); } // Static methods // @@ -31,13 +32,14 @@ jni::Object<MapSnapshot> MapSnapshot::New(JNIEnv& env, float pixelRatio, std::vector<std::string> attributions, bool showLogo, - mbgl::MapSnapshotter::PointForFn pointForFn) { + mbgl::MapSnapshotter::PointForFn pointForFn, + mbgl::MapSnapshotter::LatLngForFn latLngForFn) { // Create the bitmap auto bitmap = Bitmap::CreateBitmap(env, std::move(image)); // Create the Mapsnapshot peers static auto constructor = javaClass.GetConstructor<jni::jlong, jni::Object<Bitmap>, jni::Array<jni::String>, jni::jboolean>(env); - auto nativePeer = std::make_unique<MapSnapshot>(pixelRatio, pointForFn); + auto nativePeer = std::make_unique<MapSnapshot>(pixelRatio, pointForFn, latLngForFn); return javaClass.New(env, constructor, reinterpret_cast<jlong>(nativePeer.release()), bitmap, jni::Make<jni::Array<jni::String>>(env, attributions), (jni::jboolean) showLogo); } |