summaryrefslogtreecommitdiff
path: root/src/mbgl/style/sources/geojson_source_impl.hpp
blob: 9572355f2c836e41045b3c6ebb9ebc903384ba00 (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
#pragma once

#include <mbgl/style/source_impl.hpp>
#include <mbgl/style/sources/geojson_source.hpp>
#include <mbgl/util/variant.hpp>
#include <mbgl/tile/geojson_tile.hpp>

namespace mbgl {

class AsyncRequest;

namespace style {

class GeoJSONSource::Impl : public Source::Impl {
public:
    Impl(std::string id, Source&, const GeoJSONOptions);
    ~Impl() final;

    void setURL(std::string);
    optional<std::string> getURL();

    void setGeoJSON(const GeoJSON&);
    void setTileData(GeoJSONTile&, const OverscaledTileID& tileID);

    void loadDescription(FileSource&) final;

    uint16_t getTileSize() const final {
        return util::tileSize;
    }

private:
    Range<uint8_t> getZoomRange() final;
    std::unique_ptr<Tile> createTile(const OverscaledTileID&, const UpdateParameters&) final;

    GeoJSONOptions options;
    optional<std::string> url;
    std::unique_ptr<AsyncRequest> req;
    variant<GeoJSONVTPointer, SuperclusterPointer> geoJSONOrSupercluster;
};

} // namespace style
} // namespace mbgl