summaryrefslogtreecommitdiff
path: root/src/mbgl/style/tile_source.hpp
blob: bc97713a04796131d1e9e2669fe3dc119f28a702 (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
#pragma once

#include <mbgl/style/source.hpp>

namespace mbgl {

class Tileset;
class AsyncRequest;

namespace style {

/*
   Shared implementation for VectorSource and RasterSource. Should eventually
   be refactored to use composition rather than inheritance.
*/
class TileSource : public Source {
public:
    TileSource(SourceType,
               std::string id,
               std::string url,
               uint16_t tileSize,
               std::unique_ptr<Tileset>&&);
    ~TileSource() override;

    void load(FileSource&) final;

    const std::string& getURL() const { return url; }
    uint16_t getTileSize() const final { return tileSize; }
    const Tileset* getTileset() const { return tileset.get(); }

protected:
    Range<uint8_t> getZoomRange() final;

    const uint16_t tileSize;
    const std::string url;
    std::unique_ptr<const Tileset> tileset;
    std::unique_ptr<AsyncRequest> req;
};

} // namespace style
} // namespace mbgl