cesium-native 0.43.0
Loading...
Searching...
No Matches
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 <cstddef>
9#include <memory>
10#include <span>
11#include <vector>
12
13namespace CesiumGeometry {
14
19class CESIUMGEOMETRY_API QuadtreeAvailability final {
20public:
27 QuadtreeAvailability(uint32_t subtreeLevels, uint32_t maximumLevel) noexcept;
28
38 uint8_t computeAvailability(const QuadtreeTileID& tileID) const noexcept;
39
50 const QuadtreeTileID& tileID,
51 AvailabilitySubtree&& newSubtree) noexcept;
52
68 const QuadtreeTileID& tileID,
69 const AvailabilityNode* pNode) const noexcept;
70
87 addNode(const QuadtreeTileID& tileID, AvailabilityNode* pParentNode) noexcept;
88
100 AvailabilityNode* pNode,
101 AvailabilitySubtree&& newSubtree) noexcept;
102
119 std::optional<uint32_t> findChildNodeIndex(
120 const QuadtreeTileID& tileID,
121 const AvailabilityNode* pParentNode) const;
122
139 const QuadtreeTileID& tileID,
140 AvailabilityNode* pParentNode) const;
141
145 constexpr inline uint32_t getSubtreeLevels() const noexcept {
146 return this->_subtreeLevels;
147 }
148
152 constexpr inline uint32_t getMaximumLevel() const noexcept {
153 return this->_maximumLevel;
154 }
155
159 AvailabilityNode* getRootNode() noexcept { return this->_pRoot.get(); }
160
161private:
162 uint32_t _subtreeLevels;
163 uint32_t _maximumLevel;
164 uint32_t _maximumChildrenSubtrees;
165 std::unique_ptr<AvailabilityNode> _pRoot;
166};
167
168} // namespace CesiumGeometry
An availability tree for a quadtree, where availability can be stored and computed based on QuadtreeT...
constexpr uint32_t getSubtreeLevels() const noexcept
Gets the number of levels in each subtree.
AvailabilityNode * addNode(const QuadtreeTileID &tileID, AvailabilityNode *pParentNode) noexcept
Attempts to add a child subtree node onto the given parent node.
AvailabilityNode * getRootNode() noexcept
Gets a pointer to the root subtree node of this implicit tileset.
bool addLoadedSubtree(AvailabilityNode *pNode, AvailabilitySubtree &&newSubtree) noexcept
Attempts to add a loaded subtree onto the given 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.
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.
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 * 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 AvailabilitySubtree objects and link them together to form a downwardly trave...
The subtree data for an AvailabilityNode, containing information on tile, content,...
Uniquely identifies a node in a quadtree.