MapLibre Native Core
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
raster_source.hpp
Go to the documentation of this file.
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 
19  std::optional<std::string> getURL() const;
20 
21  uint16_t getTileSize() const;
22 
23  class Impl;
24  const Impl& impl() const;
25 
27 
28  bool supportsLayerType(const mbgl::style::LayerTypeInfo*) const override;
29 
30  mapbox::base::WeakPtr<Source> makeWeakPtr() final {
31  return weakFactory.makeWeakPtr();
32  }
33 
34 protected:
35  Mutable<Source::Impl> createMutable() const noexcept final;
36 
37 private:
38  const variant<std::string, Tileset> urlOrTileset;
39  std::unique_ptr<AsyncRequest> req;
40  mapbox::base::WeakPtrFactory<Source> weakFactory {this};
41 };
42 
43 template <>
44 inline bool Source::is<RasterSource>() const {
45  return getType() == SourceType::Raster;
46 }
47 
48 } // namespace style
49 } // namespace mbgl
mapbox::base::WeakPtr< Source > makeWeakPtr() final
Mutable< Source::Impl > createMutable() const noexcept final
RasterSource(std::string id, variant< std::string, Tileset > urlOrTileset, uint16_t tileSize, SourceType sourceType=SourceType::Raster)
void loadDescription(FileSource &) final
std::optional< std::string > getURL() const
const Impl & impl() const
const variant< std::string, Tileset > & getURLOrTileset() const
bool supportsLayerType(const mbgl::style::LayerTypeInfo *) const override
uint16_t getTileSize() const
std::unique_ptr< Expression > string(std::unique_ptr< Expression >, std::unique_ptr< Expression > def=nullptr)
Definition: actor.hpp:15
mapbox::util::variant< T... > variant
Definition: variant.hpp:17
Definition: tile_id.hpp:256