cesium-native  0.41.0
QuadtreeTilingScheme.h
1 #pragma once
2 
3 #include "Library.h"
4 #include "QuadtreeTileID.h"
5 #include "Rectangle.h"
6 
7 #include <glm/vec2.hpp>
8 
9 #include <optional>
10 
11 namespace CesiumGeometry {
12 
16 class CESIUMGEOMETRY_API QuadtreeTilingScheme final {
17 public:
29  const CesiumGeometry::Rectangle& rectangle,
30  uint32_t rootTilesX,
31  uint32_t rootTilesY) noexcept;
32 
38  const CesiumGeometry::Rectangle& getRectangle() const noexcept {
39  return this->_rectangle;
40  }
41 
45  uint32_t getRootTilesX() const noexcept { return this->_rootTilesX; }
46 
50  uint32_t getRootTilesY() const noexcept { return this->_rootTilesY; }
51 
55  uint32_t getNumberOfXTilesAtLevel(uint32_t level) const noexcept;
56 
60  uint32_t getNumberOfYTilesAtLevel(uint32_t level) const noexcept;
61 
75  std::optional<CesiumGeometry::QuadtreeTileID>
76  positionToTile(const glm::dvec2& position, uint32_t level) const noexcept;
77 
90  tileToRectangle(const CesiumGeometry::QuadtreeTileID& tileID) const noexcept;
91 
92 private:
93  CesiumGeometry::Rectangle _rectangle;
94  uint32_t _rootTilesX;
95  uint32_t _rootTilesY;
96 };
97 
98 } // namespace CesiumGeometry
Defines how a rectangular region is divided into quadtree tiles.
uint32_t getNumberOfYTilesAtLevel(uint32_t level) const noexcept
Returns the number of tiles, in y-direction, at the given level.
uint32_t getRootTilesY() const noexcept
Returns the number of root tiles, in y-direction.
QuadtreeTilingScheme(const CesiumGeometry::Rectangle &rectangle, uint32_t rootTilesX, uint32_t rootTilesY) noexcept
Constructs a new instance.
std::optional< CesiumGeometry::QuadtreeTileID > positionToTile(const glm::dvec2 &position, uint32_t level) const noexcept
Computes the CesiumGeometry::QuadtreeTileID for a given position and level.
uint32_t getRootTilesX() const noexcept
Returns the number of root tiles, in x-direction.
uint32_t getNumberOfXTilesAtLevel(uint32_t level) const noexcept
Returns the number of tiles, in x-direction, at the given level.
const CesiumGeometry::Rectangle & getRectangle() const noexcept
Return the overall rectangle that is tiled.
CesiumGeometry::Rectangle tileToRectangle(const CesiumGeometry::QuadtreeTileID &tileID) const noexcept
Returns the CesiumGeometry::Rectangle that is covered by the specified tile.
Basic geometry classes for Cesium.
Uniquely identifies a node in a quadtree.
A 2D rectangle.
Definition: Rectangle.h:14