summaryrefslogtreecommitdiff
path: root/platform/android/src/snapshotter/map_snapshot.hpp
blob: 6b82d02835be7f6fa97bd8920a6fe3c4f8c84fc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once

#include <mbgl/map/map_snapshotter.hpp>

#include <jni/jni.hpp>

#include "../geometry/lat_lng.hpp"
#include "../graphics/pointf.hpp"

#include <vector>
#include <string>

namespace mbgl {
namespace android {

class MapSnapshot {
public:

    using PointForFn = mbgl::MapSnapshotter::PointForFn;
    using LatLngForFn = mbgl::MapSnapshotter::LatLngForFn;

    static constexpr auto Name() { return "com/mapbox/mapboxsdk/snapshotter/MapSnapshot"; };

    static void registerNative(jni::JNIEnv&);

    static jni::Local<jni::Object<MapSnapshot>> New(JNIEnv& env,
                                        PremultipliedImage&& image,
                                        float pixelRatio,
                                        std::vector<std::string> attributions,
                                        bool showLogo,
                                        PointForFn pointForFn,
                                        LatLngForFn latLngForFn);

    MapSnapshot(jni::JNIEnv&) {};
    MapSnapshot(float pixelRatio, PointForFn, LatLngForFn);
    ~MapSnapshot();

    jni::Local<jni::Object<PointF>> pixelForLatLng(jni::JNIEnv&, jni::Object<LatLng>&);
    jni::Local<jni::Object<LatLng>> latLngForPixel(jni::JNIEnv&, jni::Object<PointF>&);

private:
    float pixelRatio;
    mbgl::MapSnapshotter::PointForFn pointForFn;
    mbgl::MapSnapshotter::LatLngForFn latLngForFn;
};

} // namespace android
} // namespace mbgl