summaryrefslogtreecommitdiff
path: root/include/mbgl/style/style_source.hpp
blob: 00c48431a15bc48b397535725bed15c16fc30e05 (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
43
44
45
46
#ifndef MBGL_STYLE_STYLE_SOURCE
#define MBGL_STYLE_STYLE_SOURCE

#include <mbgl/style/types.hpp>
#include <mbgl/util/ptr.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <rapidjson/document.h>

#include <vector>
#include <string>

namespace mbgl {

class Source;

class SourceInfo : private util::noncopyable {
public:
    SourceType type = SourceType::Vector;
    std::string url;
    std::vector<std::string> tiles;
    uint16_t tile_size = 512;
    uint16_t min_zoom = 0;
    uint16_t max_zoom = 22;
    std::string attribution;
    std::array<float, 3> center = {{0, 0, 0}};
    std::array<float, 4> bounds = {{-180, -90, 180, 90}};

    void parseTileJSONProperties(const rapidjson::Value&);
};


class StyleSource : public std::enable_shared_from_this<StyleSource> {
public:
    util::ptr<SourceInfo> info;

    bool enabled = false;
    util::ptr<Source> source;

    StyleSource(const util::ptr<SourceInfo> &info)
        : info(info)
    {}
};

}

#endif