Files
MapLibreParticleLab/src/mbgl/tile/tile_id_io.cpp
Konstantin Käfer 82ebcfa14e [core] introduce three distinct TileID types
* CanonicalTileID has z, x, and y, with x/y being within the bounds z defines. z can be anything from 0-32.
* OverscaledTileID is composed of a z value, and a canonical tile. The z value indicates the zoom level the tile is intended for. It is primarily used for indexing overscaled data tiles.
* UnwrappedTileID is composed of a wrap value, and a canonical tile. The wrap value is used for representing tiles to the left and right of the main (0/0/0 based) tile pyramid. It is primarily used for indicating the position a tile should be rendered at.
2016-05-10 14:50:56 +02:00

39 lines
1.1 KiB
C++

#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