1 #ifndef OSMIUM_GEOM_TILE_HPP 2 #define OSMIUM_GEOM_TILE_HPP 47 inline T restrict_to_range(T value, T min, T max) {
48 if (value < min)
return min;
49 if (value > max)
return max;
64 explicit Tile(uint32_t zoom, uint32_t tx, uint32_t ty) noexcept : x(tx), y(ty), z(zoom) {
70 const int32_t n = 1 << zoom;
71 const double scale = detail::max_coordinate_epsg3857 * 2 / n;
72 x = uint32_t(detail::restrict_to_range<int32_t>(int32_t((c.
x + detail::max_coordinate_epsg3857) / scale), 0, n-1));
73 y = uint32_t(detail::restrict_to_range<int32_t>(int32_t((detail::max_coordinate_epsg3857 - c.
y) / scale), 0, n-1));
79 return a.
z == b.
z && a.
x == b.
x && a.
y == b.
y;
90 if (a.
z < b.
z)
return true;
91 if (a.
z > b.
z)
return false;
92 if (a.
x < b.
x)
return true;
93 if (a.
x > b.
x)
return false;
101 #endif // OSMIUM_GEOM_TILE_HPP double y
Definition: coordinates.hpp:49
Namespace for everything in the Osmium library.
Definition: assembler.hpp:59
Definition: coordinates.hpp:46
uint32_t x
Definition: tile.hpp:60
Coordinates lonlat_to_mercator(const Coordinates &c)
Definition: mercator_projection.hpp:76
uint32_t y
Definition: tile.hpp:61
Definition: location.hpp:79
Tile(uint32_t zoom, uint32_t tx, uint32_t ty) noexcept
Definition: tile.hpp:64
bool operator<(const Tile &a, const Tile &b)
Definition: tile.hpp:89
bool operator!=(const Coordinates &lhs, const Coordinates &rhs) noexcept
Definition: coordinates.hpp:83
double x
Definition: coordinates.hpp:48
uint32_t z
Definition: tile.hpp:62
bool operator==(const Coordinates &lhs, const Coordinates &rhs) noexcept
Definition: coordinates.hpp:76
Tile(uint32_t zoom, const osmium::Location &location)
Definition: tile.hpp:67