blob: 3c2df20282b0ed6ad2c7d8e1f404d4938addab0f (
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#pragma once
#include <mbgl/util/image.hpp>
#include <mbgl/util/optional.hpp>
#include <mbgl/util/geo.hpp>
#include <exception>
#include <memory>
#include <string>
#include <vector>
#include <functional>
namespace mbgl {
struct CameraOptions;
class LatLngBounds;
class ResourceOptions;
namespace style {
class Style;
} // namespace style
class MapSnapshotterObserver {
public:
virtual ~MapSnapshotterObserver() = default;
static MapSnapshotterObserver& nullObserver();
virtual void onDidFailLoadingStyle(const std::string&) {}
virtual void onDidFinishLoadingStyle() {}
virtual void onStyleImageMissing(const std::string&) {}
};
class MapSnapshotter {
public:
MapSnapshotter(Size size,
float pixelRatio,
const ResourceOptions&,
MapSnapshotterObserver&,
optional<std::string> localFontFamily = nullopt);
MapSnapshotter(Size size, float pixelRatio, const ResourceOptions&);
~MapSnapshotter();
void setStyleURL(const std::string& styleURL);
std::string getStyleURL() const;
void setStyleJSON(const std::string& styleJSON);
std::string getStyleJSON() const;
void setSize(const Size&);
Size getSize() const;
void setCameraOptions(const CameraOptions&);
CameraOptions getCameraOptions() const;
void setRegion(const LatLngBounds&);
LatLngBounds getRegion() const;
style::Style& getStyle();
const style::Style& getStyle() const;
using PointForFn = std::function<ScreenCoordinate (const LatLng&)>;
using LatLngForFn = std::function<LatLng (const ScreenCoordinate&)>;
using Attributions = std::vector<std::string>;
using Callback = std::function<void (std::exception_ptr, PremultipliedImage, Attributions, PointForFn, LatLngForFn)>;
void snapshot(Callback);
void cancel();
private:
class Impl;
std::unique_ptr<Impl> impl;
};
} // namespace mbgl
|