diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2017-08-22 16:32:45 +0300 |
---|---|---|
committer | Ivo van Dongen <info@ivovandongen.nl> | 2017-08-23 19:49:25 +0300 |
commit | 69050ddabbc254b12fa3ac61536f4eece7459249 (patch) | |
tree | a25b2f1faa46728005c696c66efc67be05fe77bb /platform/android/src/snapshotter/map_snapshotter.hpp | |
parent | 77d5bb54183cafbc15af4d459f9295ea15c763b4 (diff) | |
download | qtlocation-mapboxgl-upstream/ivd-android-snapshotter.tar.gz |
[android] map snapshotterupstream/ivd-android-snapshotter
Diffstat (limited to 'platform/android/src/snapshotter/map_snapshotter.hpp')
-rw-r--r-- | platform/android/src/snapshotter/map_snapshotter.hpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/platform/android/src/snapshotter/map_snapshotter.hpp b/platform/android/src/snapshotter/map_snapshotter.hpp new file mode 100644 index 0000000000..093f589c05 --- /dev/null +++ b/platform/android/src/snapshotter/map_snapshotter.hpp @@ -0,0 +1,61 @@ +#pragma once + +#include <mbgl/map/map_snapshotter.hpp> +#include <mbgl/util/default_thread_pool.hpp> +#include <mbgl/util/util.hpp> + +#include "../file_source.hpp" +#include "../geometry/lat_lng_bounds.hpp" +#include "../map/camera_position.hpp" + +#include <jni/jni.hpp> +#include "../jni/generic_global_ref_deleter.hpp" + +#include <memory> + +namespace mbgl { +namespace android { + +class SnapshotterRendererFrontend; + +class MapSnapshotter { +public: + + static constexpr auto Name() { return "com/mapbox/mapboxsdk/snapshotter/MapSnapshotter"; }; + + static jni::Class<MapSnapshotter> javaClass; + + static void registerNative(jni::JNIEnv&); + + MapSnapshotter(jni::JNIEnv&, + jni::Object<MapSnapshotter>, + jni::Object<FileSource>, + jni::jfloat pixelRatio, + jni::jint width, + jni::jint height, + jni::String styleURL, + jni::Object<LatLngBounds> region, + jni::Object<CameraPosition> position, + jni::String programCacheDir); + + ~MapSnapshotter(); + + void start(JNIEnv&); + + void cancel(JNIEnv&); + +private: + MBGL_STORE_THREAD(tid); + + JavaVM *vm = nullptr; + GenericUniqueWeakObject<MapSnapshotter> javaPeer; + + float pixelRatio; + + std::shared_ptr<mbgl::ThreadPool> threadPool; + std::unique_ptr<Actor<mbgl::MapSnapshotter::Callback>> snapshotCallback; + std::unique_ptr<mbgl::MapSnapshotter> snapshotter; +}; + +} // namespace android +} // namespace mbgl
\ No newline at end of file |