cesium-native 0.43.0
Loading...
Searching...
No Matches
ImplicitTilingUtilities.h
1#pragma once
2
3#include <CesiumGeometry/OctreeTileID.h>
4#include <CesiumGeometry/QuadtreeTileID.h>
5#include <CesiumGeospatial/Ellipsoid.h>
6
7#include <array>
8#include <iterator>
9#include <string>
10
12class BoundingRegion;
14} // namespace CesiumGeospatial
15
16namespace CesiumGeometry {
18}
19
20namespace Cesium3DTiles {
21struct BoundingVolume;
22}
23
24namespace Cesium3DTilesContent {
25
31public:
35 class iterator {
36 public:
40 using iterator_category = std::forward_iterator_tag;
51 using difference_type = void;
60
69 explicit iterator(
70 const CesiumGeometry::QuadtreeTileID& parentTileID,
71 bool isEnd) noexcept;
72
78 return this->_current;
79 }
85 return &this->_current;
86 }
95
97 bool operator==(const iterator& rhs) const noexcept;
99 bool operator!=(const iterator& rhs) const noexcept;
100
101 private:
103 };
104
107
113 : _tileID(tileID) {}
114
116 iterator begin() const noexcept;
118 iterator end() const noexcept;
123 constexpr int64_t size() const noexcept { return 4; }
124
125private:
127};
128
134public:
138 class iterator {
139 public:
143 using iterator_category = std::forward_iterator_tag;
154 using difference_type = void;
163
172 explicit iterator(
173 const CesiumGeometry::OctreeTileID& parentTileID,
174 bool isEnd) noexcept;
175
181 return this->_current;
182 }
188 return &this->_current;
189 }
198
200 bool operator==(const iterator& rhs) const noexcept;
202 bool operator!=(const iterator& rhs) const noexcept;
203
204 private:
206 };
207
210
216 : _tileID(tileID) {}
218 iterator begin() const noexcept;
220 iterator end() const noexcept;
225 constexpr int64_t size() const noexcept { return 8; }
226
227private:
229};
230
235public:
246 static std::string resolveUrl(
247 const std::string& baseUrl,
248 const std::string& urlTemplate,
249 const CesiumGeometry::QuadtreeTileID& quadtreeID);
250
261 static std::string resolveUrl(
262 const std::string& baseUrl,
263 const std::string& urlTemplate,
264 const CesiumGeometry::OctreeTileID& octreeID);
265
277 static double computeLevelDenominator(uint32_t level) noexcept;
278
286 static uint64_t
288
295 static uint64_t
297
307 const CesiumGeometry::QuadtreeTileID& subtreeID,
308 const CesiumGeometry::QuadtreeTileID& tileID);
309
319 const CesiumGeometry::OctreeTileID& subtreeRootID,
320 const CesiumGeometry::OctreeTileID& tileID);
321
334 uint32_t subtreeLevels,
335 const CesiumGeometry::QuadtreeTileID& tileID) noexcept;
336
349 uint32_t subtreeLevels,
350 const CesiumGeometry::OctreeTileID& tileID) noexcept;
351
365 const CesiumGeometry::QuadtreeTileID& rootID,
366 const CesiumGeometry::QuadtreeTileID& tileID) noexcept;
367
381 const CesiumGeometry::OctreeTileID& rootID,
382 const CesiumGeometry::OctreeTileID& tileID) noexcept;
383
391 static QuadtreeChildren
393 return QuadtreeChildren{tileID};
394 }
395
403 static OctreeChildren
405 return OctreeChildren{tileID};
406 }
407
418 const Cesium3DTiles::BoundingVolume& rootBoundingVolume,
419 const CesiumGeometry::QuadtreeTileID& tileID,
420 const CesiumGeospatial::Ellipsoid& ellipsoid
421 CESIUM_DEFAULT_ELLIPSOID) noexcept;
422
433 const Cesium3DTiles::BoundingVolume& rootBoundingVolume,
434 const CesiumGeometry::OctreeTileID& tileID,
435 const CesiumGeospatial::Ellipsoid& ellipsoid
436 CESIUM_DEFAULT_ELLIPSOID) noexcept;
437
448 const CesiumGeospatial::BoundingRegion& rootBoundingVolume,
449 const CesiumGeometry::QuadtreeTileID& tileID,
450 const CesiumGeospatial::Ellipsoid& ellipsoid
451 CESIUM_DEFAULT_ELLIPSOID) noexcept;
452
463 const CesiumGeospatial::BoundingRegion& rootBoundingVolume,
464 const CesiumGeometry::OctreeTileID& tileID,
465 const CesiumGeospatial::Ellipsoid& ellipsoid
466 CESIUM_DEFAULT_ELLIPSOID) noexcept;
467
477 const CesiumGeometry::OrientedBoundingBox& rootBoundingVolume,
478 const CesiumGeometry::QuadtreeTileID& tileID) noexcept;
479
489 const CesiumGeometry::OrientedBoundingBox& rootBoundingVolume,
490 const CesiumGeometry::OctreeTileID& tileID) noexcept;
491
502 const CesiumGeospatial::S2CellBoundingVolume& rootBoundingVolume,
503 const CesiumGeometry::QuadtreeTileID& tileID,
504 const CesiumGeospatial::Ellipsoid& ellipsoid
505 CESIUM_DEFAULT_ELLIPSOID) noexcept;
506
517 const CesiumGeospatial::S2CellBoundingVolume& rootBoundingVolume,
518 const CesiumGeometry::OctreeTileID& tileID,
519 const CesiumGeospatial::Ellipsoid& ellipsoid
520 CESIUM_DEFAULT_ELLIPSOID) noexcept;
521};
522
523} // namespace Cesium3DTilesContent
Helper functions for working with 3D Tiles implicit tiling.
static uint64_t computeRelativeMortonIndex(const CesiumGeometry::QuadtreeTileID &subtreeID, const CesiumGeometry::QuadtreeTileID &tileID)
Computes the relative Morton index for a given quadtree tile within its level of a subtree root at th...
static CesiumGeospatial::S2CellBoundingVolume computeBoundingVolume(const CesiumGeospatial::S2CellBoundingVolume &rootBoundingVolume, const CesiumGeometry::OctreeTileID &tileID, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84) noexcept
Computes the bounding volume for an implicit octree tile with the given ID as an S2 cell bounding vol...
static CesiumGeospatial::BoundingRegion computeBoundingVolume(const CesiumGeospatial::BoundingRegion &rootBoundingVolume, const CesiumGeometry::QuadtreeTileID &tileID, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84) noexcept
Computes the bounding volume for an implicit quadtree tile with the given ID as a bounding region.
static CesiumGeometry::OctreeTileID absoluteTileIDToRelative(const CesiumGeometry::OctreeTileID &rootID, const CesiumGeometry::OctreeTileID &tileID) noexcept
Converts an absolute tile ID to a tile ID relative to a given root tile.
static uint64_t computeMortonIndex(const CesiumGeometry::OctreeTileID &tileID)
Computes the Morton index for a given octree tile within its level.
static CesiumGeospatial::S2CellBoundingVolume computeBoundingVolume(const CesiumGeospatial::S2CellBoundingVolume &rootBoundingVolume, const CesiumGeometry::QuadtreeTileID &tileID, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84) noexcept
Computes the bounding volume for an implicit quadtree tile with the given ID as an S2 cell bounding v...
static CesiumGeometry::OctreeTileID getSubtreeRootID(uint32_t subtreeLevels, const CesiumGeometry::OctreeTileID &tileID) noexcept
Gets the ID of the root tile of the subtree that contains a given tile.
static CesiumGeometry::QuadtreeTileID getSubtreeRootID(uint32_t subtreeLevels, const CesiumGeometry::QuadtreeTileID &tileID) noexcept
Gets the ID of the root tile of the subtree that contains a given tile.
static std::string resolveUrl(const std::string &baseUrl, const std::string &urlTemplate, const CesiumGeometry::QuadtreeTileID &quadtreeID)
Resolves a templatized implicit tiling URL with a quadtree tile ID.
static CesiumGeometry::OrientedBoundingBox computeBoundingVolume(const CesiumGeometry::OrientedBoundingBox &rootBoundingVolume, const CesiumGeometry::OctreeTileID &tileID) noexcept
Computes the bounding volume for an implicit octree tile with the given ID as an oriented bounding bo...
static Cesium3DTiles::BoundingVolume computeBoundingVolume(const Cesium3DTiles::BoundingVolume &rootBoundingVolume, const CesiumGeometry::QuadtreeTileID &tileID, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84) noexcept
Computes the bounding volume for an implicit quadtree tile with the given ID as a Cesium3DTiles::Boun...
static double computeLevelDenominator(uint32_t level) noexcept
Computes the denominator for a given implicit tile level.
static OctreeChildren getChildren(const CesiumGeometry::OctreeTileID &tileID) noexcept
Gets a lightweight virtual container for enumerating the octree IDs of the children of a given octree...
static QuadtreeChildren getChildren(const CesiumGeometry::QuadtreeTileID &tileID) noexcept
Gets a lightweight virtual container for enumerating the quadtree IDs of the children of a given quad...
static CesiumGeometry::OrientedBoundingBox computeBoundingVolume(const CesiumGeometry::OrientedBoundingBox &rootBoundingVolume, const CesiumGeometry::QuadtreeTileID &tileID) noexcept
Computes the bounding volume for an implicit quadtree tile with the given ID as an oriented bounding ...
static uint64_t computeRelativeMortonIndex(const CesiumGeometry::OctreeTileID &subtreeRootID, const CesiumGeometry::OctreeTileID &tileID)
Computes the relative Morton index for a given octree tile within its level of a subtree rooted at th...
static CesiumGeospatial::BoundingRegion computeBoundingVolume(const CesiumGeospatial::BoundingRegion &rootBoundingVolume, const CesiumGeometry::OctreeTileID &tileID, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84) noexcept
Computes the bounding volume for an implicit octree tile with the given ID as a bounding region.
static Cesium3DTiles::BoundingVolume computeBoundingVolume(const Cesium3DTiles::BoundingVolume &rootBoundingVolume, const CesiumGeometry::OctreeTileID &tileID, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84) noexcept
Computes the bounding volume for an implicit octree tile with the given ID as a Cesium3DTiles::Boundi...
static uint64_t computeMortonIndex(const CesiumGeometry::QuadtreeTileID &tileID)
Computes the Morton index for a given quadtree tile within its level.
static std::string resolveUrl(const std::string &baseUrl, const std::string &urlTemplate, const CesiumGeometry::OctreeTileID &octreeID)
Resolves a templatized implicit tiling URL with an octree tile ID.
static CesiumGeometry::QuadtreeTileID absoluteTileIDToRelative(const CesiumGeometry::QuadtreeTileID &rootID, const CesiumGeometry::QuadtreeTileID &tileID) noexcept
Converts an absolute tile ID to a tile ID relative to a given root tile.
An STL-compatible iterator over the children of an octree tile.
const CesiumGeometry::OctreeTileID & operator*() const
Returns a reference to the current CesiumGeometry::OctreeTileID being iterated.
bool operator==(const iterator &rhs) const noexcept
Checks if two iterators are at the same child.
std::forward_iterator_tag iterator_category
The iterator category tag denoting this is a forward iterator.
iterator & operator++()
Advances the iterator to the next child.
iterator(const CesiumGeometry::OctreeTileID &parentTileID, bool isEnd) noexcept
Creates a new iterator over the children of a octree tile.
iterator operator++(int)
Advances the iterator to the next child.
void difference_type
The type used to identify distance between iterators.
bool operator!=(const iterator &rhs) const noexcept
Checks if two iterators are NOT at the same child.
const CesiumGeometry::OctreeTileID * operator->() const
Returns a pointer to the current CesiumGeometry::OctreeTileID being iterated.
A lightweight virtual container enumerating the octree IDs of the children of a given octree tile.
constexpr int64_t size() const noexcept
Returns the total number of CesiumGeometry::OctreeTileID children for this tile, which will always be...
iterator end() const noexcept
Returns an iterator starting at the last child.
iterator begin() const noexcept
Returns an iterator starting at the first child.
OctreeChildren(const CesiumGeometry::OctreeTileID &tileID) noexcept
Creates a OctreeChildren instance from the provided parent tile.
An STL-compatible iterator over the children of a quadtree tile.
iterator operator++(int)
Advances the iterator to the next child.
void difference_type
The type used to identify distance between iterators.
const CesiumGeometry::QuadtreeTileID * operator->() const
Returns a pointer to the current CesiumGeometry::QuadtreeTileID being iterated.
std::forward_iterator_tag iterator_category
The iterator category tag denoting this is a forward iterator.
bool operator!=(const iterator &rhs) const noexcept
Checks if two iterators are NOT at the same child.
iterator & operator++()
Advances the iterator to the next child.
const CesiumGeometry::QuadtreeTileID & operator*() const
Returns a reference to the current CesiumGeometry::QuadtreeTileID being iterated.
bool operator==(const iterator &rhs) const noexcept
Checks if two iterators are at the same child.
iterator(const CesiumGeometry::QuadtreeTileID &parentTileID, bool isEnd) noexcept
Creates a new iterator over the children of a quadtree tile.
A lightweight virtual container enumerating the quadtree IDs of the children of a given quadtree tile...
constexpr int64_t size() const noexcept
Returns the total number of CesiumGeometry::QuadtreeTileID children for this tile,...
QuadtreeChildren(const CesiumGeometry::QuadtreeTileID &tileID) noexcept
Creates a QuadtreeChildren instance from the provided parent tile.
iterator begin() const noexcept
Returns an iterator starting at the first child.
iterator end() const noexcept
Returns an iterator starting at the last child.
A bounding volume defined as a closed and convex cuboid with any orientation.
A bounding volume specified as a longitude/latitude bounding box and a minimum and maximum height.
A quadratic surface defined in Cartesian coordinates.
Definition Ellipsoid.h:38
Classes that support loading and converting 3D Tiles tile content.
Classes for using 3D Tiles.
Definition Buffer.h:7
Basic geometry classes for Cesium.
Classes for geospatial computations in Cesium.
A bounding volume that encloses a tile or its content. At least one bounding volume property is requi...
A structure serving as a unique identifier for a node in an octree.
Uniquely identifies a node in a quadtree.