diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2017-10-09 16:54:32 +0300 |
---|---|---|
committer | Fabian Guerra <fabian.guerra@mapbox.com> | 2017-10-31 21:32:50 -0400 |
commit | 21617a42c6057731dd083f9531434267f2fff52b (patch) | |
tree | 65d14990463cd73404b5898c43232e50e557a5b1 /platform/android/src/snapshotter/map_snapshot.hpp | |
parent | 1060d142c6cac15704d822817a0d5dd47913e283 (diff) | |
download | qtlocation-mapboxgl-21617a42c6057731dd083f9531434267f2fff52b.tar.gz |
[android] map snapshotter - wrap snapshot in native peer for access to the pointFor functionality
Diffstat (limited to 'platform/android/src/snapshotter/map_snapshot.hpp')
-rw-r--r-- | platform/android/src/snapshotter/map_snapshot.hpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/platform/android/src/snapshotter/map_snapshot.hpp b/platform/android/src/snapshotter/map_snapshot.hpp new file mode 100644 index 0000000000..6d60d49728 --- /dev/null +++ b/platform/android/src/snapshotter/map_snapshot.hpp @@ -0,0 +1,41 @@ +#pragma once + +#include <mbgl/map/map_snapshotter.hpp> + +#include <jni/jni.hpp> + +#include "../geometry/lat_lng.hpp" +#include "../graphics/pointf.hpp" + +namespace mbgl { +namespace android { + +class MapSnapshot { +public: + + using PointForFn = mbgl::MapSnapshotter::PointForFn; + + static constexpr auto Name() { return "com/mapbox/mapboxsdk/snapshotter/MapSnapshot"; }; + + static void registerNative(jni::JNIEnv&); + + static jni::Object<MapSnapshot> New(JNIEnv& env, + PremultipliedImage&& image, + float pixelRatio, + PointForFn pointForFn); + + MapSnapshot(jni::JNIEnv&) {}; + MapSnapshot(float pixelRatio, PointForFn); + ~MapSnapshot(); + + jni::Object<PointF> pixelForLatLng(jni::JNIEnv&, jni::Object<LatLng>); + +private: + static jni::Class<MapSnapshot> javaClass; + + float pixelRatio; + mbgl::MapSnapshotter::PointForFn pointForFn; +}; + +} // namespace android +} // namespace mbgl
\ No newline at end of file |