summaryrefslogtreecommitdiff
path: root/include/mbgl/util/tileset.hpp
blob: 7bef0e89ed1204385217b49c30fa341a66877c2b (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/util/range.hpp>
#include <mbgl/util/constants.hpp>
#include <mbgl/util/optional.hpp>
#include <mbgl/util/geo.hpp>
#include <tuple>
#include <vector>
#include <string>
#include <cstdint>

namespace mbgl {

class Tileset {
public:
    enum class Scheme : bool { XYZ, TMS };

    std::vector<std::string> tiles;
    Range<uint8_t> zoomRange;
    std::string attribution;
    Scheme scheme;
    optional<LatLngBounds> bounds;

    Tileset(std::vector<std::string> tiles_ = std::vector<std::string>(),
            Range<uint8_t> zoomRange_ = { 0, util::DEFAULT_MAX_ZOOM },
            std::string attribution_ = {},
            Scheme scheme_ = Scheme::XYZ)
        : tiles(std::move(tiles_)),
          zoomRange(std::move(zoomRange_)),
          attribution(std::move(attribution_)),
          scheme(scheme_),
          bounds() {}

    // TileJSON also includes center and zoom but they are not used by mbgl.

    friend bool operator==(const Tileset& lhs, const Tileset& rhs) {
        return std::tie(lhs.tiles, lhs.zoomRange, lhs.attribution, lhs.scheme, lhs.bounds)
            == std::tie(rhs.tiles, rhs.zoomRange, rhs.attribution, rhs.scheme, rhs.bounds);
    }
};

} // namespace mbgl