| 1 | #pragma once |
|---|---|
| 2 | |
| 3 | #include <mbgl/style/source.hpp> |
| 4 | #include <mbgl/util/tileset.hpp> |
| 5 | #include <mbgl/util/variant.hpp> |
| 6 | |
| 7 | namespace mbgl { |
| 8 | |
| 9 | class AsyncRequest; |
| 10 | |
| 11 | namespace style { |
| 12 | |
| 13 | class RasterSource : public Source { |
| 14 | public: |
| 15 | RasterSource(std::string id, variant<std::string, Tileset> urlOrTileset, uint16_t tileSize, SourceType sourceType = SourceType::Raster); |
| 16 | ~RasterSource() override; |
| 17 | |
| 18 | const variant<std::string, Tileset>& getURLOrTileset() const; |
| 19 | optional<std::string> getURL() const; |
| 20 | |
| 21 | uint16_t getTileSize() const; |
| 22 | |
| 23 | class Impl; |
| 24 | const Impl& impl() const; |
| 25 | |
| 26 | void loadDescription(FileSource&) final; |
| 27 | |
| 28 | private: |
| 29 | const variant<std::string, Tileset> urlOrTileset; |
| 30 | std::unique_ptr<AsyncRequest> req; |
| 31 | }; |
| 32 | |
| 33 | template <> |
| 34 | inline bool Source::is<RasterSource>() const { |
| 35 | return getType() == SourceType::Raster; |
| 36 | } |
| 37 | |
| 38 | } // namespace style |
| 39 | } // namespace mbgl |
| 40 |
