summaryrefslogtreecommitdiff
path: root/platform/android/src/snapshotter/map_snapshot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/src/snapshotter/map_snapshot.cpp')
-rw-r--r--platform/android/src/snapshotter/map_snapshot.cpp14
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);
}