summaryrefslogtreecommitdiff
path: root/src/mbgl/tile/tile_id_io.cpp
blob: f6adbf183f6e8be8539c7fe989e78ee45f279f7b (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
#include <mbgl/tile/tile_id.hpp>
#include <mbgl/util/string.hpp>

#include <iostream>

namespace mbgl {

::std::ostream& operator<<(::std::ostream& os, const CanonicalTileID& rhs) {
    return os << uint32_t(rhs.z) << "/" << rhs.x << "/" << rhs.y;
}

namespace util {
std::string toString(const CanonicalTileID& rhs) {
    return util::toString(rhs.z) + "/" + util::toString(rhs.x) + "/" + util::toString(rhs.y);
}
} // namespace util

::std::ostream& operator<<(::std::ostream& os, const OverscaledTileID& rhs) {
    return os << rhs.canonical << "=>" << uint32_t(rhs.overscaledZ);
}

namespace util {
std::string toString(const OverscaledTileID& rhs) {
    return util::toString(rhs.canonical) + "=>" + util::toString(rhs.overscaledZ);
}
} // namespace util

::std::ostream& operator<<(::std::ostream& os, const UnwrappedTileID& rhs) {
    return os << rhs.canonical << (rhs.wrap >= 0 ? "+" : "") << rhs.wrap;
}

namespace util {
std::string toString(const UnwrappedTileID& rhs) {
    return util::toString(rhs.canonical) + (rhs.wrap >= 0 ? "+" : "") + util::toString(rhs.wrap);
}
} // namespace util

} // namespace mbgl