cesium-native  0.41.0
QuadtreeTileID.h
1 #pragma once
2 
3 #include "Library.h"
4 
5 #include <cstdint>
6 #include <functional>
7 
8 namespace CesiumGeometry {
9 class QuadtreeTilingScheme;
10 
20 struct 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  computeInvertedY(const QuadtreeTilingScheme& tilingScheme) const noexcept;
59 
67  constexpr QuadtreeTileID getParent() const noexcept {
68  if (this->level == 0) {
69  return *this;
70  }
71  return QuadtreeTileID(this->level - 1, this->x >> 1, this->y >> 1);
72  }
73 
77  uint32_t level;
78 
82  uint32_t x;
83 
87  uint32_t y;
88 };
89 
94 struct CESIUMGEOMETRY_API UpsampledQuadtreeNode final {
95 
100 };
101 } // namespace CesiumGeometry
102 
103 namespace std {
104 
108 template <> struct hash<CesiumGeometry::QuadtreeTileID> {
109 
114  size_t operator()(const CesiumGeometry::QuadtreeTileID& key) const noexcept;
115 };
116 } // namespace std
Defines how a rectangular region is divided into quadtree tiles.
Basic geometry classes for Cesium.
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 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.