1 | #pragma once |
---|---|
2 | |
3 | #include <mbgl/style/source.hpp> |
4 | #include <mbgl/util/image.hpp> |
5 | #include <mbgl/util/optional.hpp> |
6 | |
7 | namespace mbgl { |
8 | class LatLng; |
9 | class AsyncRequest; |
10 | |
11 | namespace style { |
12 | |
13 | class ImageSource : public Source { |
14 | public: |
15 | ImageSource(std::string id, const std::array<LatLng, 4>); |
16 | ~ImageSource() override; |
17 | |
18 | optional<std::string> getURL() const; |
19 | void setURL(const std::string& url); |
20 | |
21 | void setImage(PremultipliedImage&&); |
22 | |
23 | void setCoordinates(const std::array<LatLng, 4>&); |
24 | std::array<LatLng, 4> getCoordinates() const; |
25 | |
26 | class Impl; |
27 | const Impl& impl() const; |
28 | |
29 | void loadDescription(FileSource&) final; |
30 | private: |
31 | optional<std::string> url; |
32 | std::unique_ptr<AsyncRequest> req; |
33 | }; |
34 | |
35 | template <> |
36 | inline bool Source::is<ImageSource>() const { |
37 | return getType() == SourceType::Image; |
38 | } |
39 | |
40 | } // namespace style |
41 | } // namespace mbgl |
42 |