cesium-native 0.44.2
Loading...
Searching...
No Matches
QuadtreeTileID.h
1#pragma once
2
3#include <CesiumGeometry/Library.h>
4
5#include <cstdint>
6#include <functional>
7
8namespace CesiumGeometry {
9class QuadtreeTilingScheme;
10
20struct CESIUMGEOMETRY_API QuadtreeTileID final {
21
29 constexpr QuadtreeTileID(uint32_t level_, uint32_t x_, uint32_t y_) noexcept
30 : level(level_), x(x_), y(y_) {}
31
35 constexpr bool operator==(const QuadtreeTileID& other) const noexcept {
36 return this->level == other.level && this->x == other.x &&
37 this->y == other.y;
38 }
39
43 constexpr bool operator!=(const QuadtreeTileID& other) const noexcept {
44 return !(*this == other);
45 }
46
57 uint32_t
58 computeInvertedX(const QuadtreeTilingScheme& tilingScheme) const noexcept;
59
70 uint32_t
71 computeInvertedY(const QuadtreeTilingScheme& tilingScheme) const noexcept;
72
80 constexpr QuadtreeTileID getParent() const noexcept {
81 if (this->level == 0) {
82 return *this;
83 }
84 return QuadtreeTileID(this->level - 1, this->x >> 1, this->y >> 1);
85 }
86
90 uint32_t level;
91
95 uint32_t x;
96
100 uint32_t y;
101};
102
107struct CESIUMGEOMETRY_API UpsampledQuadtreeNode final {
108
113};
114} // namespace CesiumGeometry
115
116namespace std {
117
121template <> struct hash<CesiumGeometry::QuadtreeTileID> {
122
127 size_t operator()(const CesiumGeometry::QuadtreeTileID& key) const noexcept;
128};
129} // namespace std
Defines how a rectangular region is divided into quadtree tiles.
Basic geometry classes for Cesium.
STL namespace.
Uniquely identifies a node in a quadtree.
uint32_t computeInvertedY(const QuadtreeTilingScheme &tilingScheme) const noexcept
Computes the inverse y-coordinate of this tile ID.
uint32_t y
The y-coordinate of this tile ID.
constexpr bool operator==(const QuadtreeTileID &other) const noexcept
Returns true if two identifiers are equal.
uint32_t x
The x-coordinate of this tile ID.
uint32_t computeInvertedX(const QuadtreeTilingScheme &tilingScheme) const noexcept
Computes the inverse x-coordinate of this tile ID.
uint32_t level
The level of this tile ID, with 0 being the root tile.
constexpr bool operator!=(const QuadtreeTileID &other) const noexcept
Returns true if two identifiers are not equal.
constexpr QuadtreeTileID getParent() const noexcept
Gets the ID of the parent of the tile with this ID.
constexpr QuadtreeTileID(uint32_t level_, uint32_t x_, uint32_t y_) noexcept
Creates a new instance.
A node of a tile hierarchy that was created by upsampling the tile content of a parent node.
QuadtreeTileID tileID
The QuadtreeTileID for this tree node.
size_t operator()(const CesiumGeometry::QuadtreeTileID &key) const noexcept
A specialization of the std::hash template for CesiumGeometry::QuadtreeTileID objects.