cesium-native  0.41.0
QuadtreeAvailability.h
1 #pragma once
2 
3 #include "Availability.h"
4 #include "Library.h"
5 #include "QuadtreeTileID.h"
6 #include "TileAvailabilityFlags.h"
7 
8 #include <gsl/span>
9 
10 #include <cstddef>
11 #include <memory>
12 #include <vector>
13 
14 namespace CesiumGeometry {
15 
16 class CESIUMGEOMETRY_API QuadtreeAvailability final {
17 public:
24  QuadtreeAvailability(uint32_t subtreeLevels, uint32_t maximumLevel) noexcept;
25 
35  uint8_t computeAvailability(const QuadtreeTileID& tileID) const noexcept;
36 
46  bool addSubtree(
47  const QuadtreeTileID& tileID,
48  AvailabilitySubtree&& newSubtree) noexcept;
49 
65  const QuadtreeTileID& tileID,
66  const AvailabilityNode* pNode) const noexcept;
67 
84  addNode(const QuadtreeTileID& tileID, AvailabilityNode* pParentNode) noexcept;
85 
97  AvailabilityNode* pNode,
98  AvailabilitySubtree&& newSubtree) noexcept;
99 
116  std::optional<uint32_t> findChildNodeIndex(
117  const QuadtreeTileID& tileID,
118  const AvailabilityNode* pParentNode) const;
119 
136  const QuadtreeTileID& tileID,
137  AvailabilityNode* pParentNode) const;
138 
142  constexpr inline uint32_t getSubtreeLevels() const noexcept {
143  return this->_subtreeLevels;
144  }
145 
149  constexpr inline uint32_t getMaximumLevel() const noexcept {
150  return this->_maximumLevel;
151  }
152 
156  AvailabilityNode* getRootNode() noexcept { return this->_pRoot.get(); }
157 
158 private:
159  uint32_t _subtreeLevels;
160  uint32_t _maximumLevel;
161  uint32_t _maximumChildrenSubtrees;
162  std::unique_ptr<AvailabilityNode> _pRoot;
163 };
164 
165 } // namespace CesiumGeometry
constexpr uint32_t getSubtreeLevels() const noexcept
Gets the number of levels in each subtree.
std::optional< uint32_t > findChildNodeIndex(const QuadtreeTileID &tileID, const AvailabilityNode *pParentNode) const
Find the child node index corresponding to this tile ID and parent node.
bool addLoadedSubtree(AvailabilityNode *pNode, AvailabilitySubtree &&newSubtree) noexcept
Attempts to add a loaded subtree onto the given node.
AvailabilityNode * addNode(const QuadtreeTileID &tileID, AvailabilityNode *pParentNode) noexcept
Attempts to add a child subtree node onto the given parent node.
QuadtreeAvailability(uint32_t subtreeLevels, uint32_t maximumLevel) noexcept
Constructs a new instance.
uint8_t computeAvailability(const QuadtreeTileID &tileID, const AvailabilityNode *pNode) const noexcept
Determines the currently known availability status of the given tile.
uint8_t computeAvailability(const QuadtreeTileID &tileID) const noexcept
Determines the currently known availability status of the given tile.
constexpr uint32_t getMaximumLevel() const noexcept
Gets the index of the maximum level in this implicit tileset.
bool addSubtree(const QuadtreeTileID &tileID, AvailabilitySubtree &&newSubtree) noexcept
Attempts to add an availability subtree into the existing overall availability tree.
AvailabilityNode * getRootNode() noexcept
Gets a pointer to the root subtree node of this implicit tileset.
AvailabilityNode * findChildNode(const QuadtreeTileID &tileID, AvailabilityNode *pParentNode) const
Find the child node corresponding to this tile ID and parent node.
Basic geometry classes for Cesium.
Availability nodes wrap subtree objects and link them together to form a downwardly traversable avail...
Definition: Availability.h:44
Uniquely identifies a node in a quadtree.