cesium-native 0.67.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 {
19} // namespace CesiumGeometry
20
21namespace CesiumTilesetJson {
22struct BoundingVolume;
23}
24
25namespace Cesium3DTiles {
26
32public:
36 class iterator {
37 public:
41 using iterator_category = std::forward_iterator_tag;
52 using difference_type = void;
61
70 explicit iterator(
71 const CesiumGeometry::QuadtreeTileID& parentTileID,
72 bool isEnd) noexcept;
73
79 return this->_current;
80 }
81
86 return &this->_current;
87 }
88
96
98 bool operator==(const iterator& rhs) const noexcept;
100 bool operator!=(const iterator& rhs) const noexcept;
101
102 private:
104 };
105
108
114 : _tileID(tileID) {}
115
117 iterator begin() const noexcept;
119 iterator end() const noexcept;
124 constexpr int64_t size() const noexcept { return 4; }
125
126private:
128};
129
135public:
139 class iterator {
140 public:
144 using iterator_category = std::forward_iterator_tag;
155 using difference_type = void;
164
173 explicit iterator(
174 const CesiumGeometry::OctreeTileID& parentTileID,
175 bool isEnd) noexcept;
176
182 return this->_current;
183 }
184
189 return &this->_current;
190 }
191
199
201 bool operator==(const iterator& rhs) const noexcept;
203 bool operator!=(const iterator& rhs) const noexcept;
204
205 private:
207 };
208
211
217 : _tileID(tileID) {}
218
219 iterator begin() const noexcept;
221 iterator end() const noexcept;
226 constexpr int64_t size() const noexcept { return 8; }
227
228private:
230};
231
236public:
248 static std::string resolveUrl(
249 const std::string& baseUrl,
250 const std::string& urlTemplate,
251 const CesiumGeometry::QuadtreeTileID& quadtreeID);
252
265 static std::string resolveUrl(
266 const std::string& baseUrl,
267 const std::string& urlTemplate,
268 const CesiumGeometry::OctreeTileID& octreeID);
269
281 static double computeLevelDenominator(uint32_t level) noexcept;
282
290 static uint64_t
292
299 static uint64_t
301
311 const CesiumGeometry::QuadtreeTileID& subtreeID,
312 const CesiumGeometry::QuadtreeTileID& tileID);
313
323 const CesiumGeometry::OctreeTileID& subtreeRootID,
324 const CesiumGeometry::OctreeTileID& tileID);
325
338 uint32_t subtreeLevels,
339 const CesiumGeometry::QuadtreeTileID& tileID) noexcept;
340
353 uint32_t subtreeLevels,
354 const CesiumGeometry::OctreeTileID& tileID) noexcept;
355
369 const CesiumGeometry::QuadtreeTileID& rootID,
370 const CesiumGeometry::QuadtreeTileID& tileID) noexcept;
371
385 const CesiumGeometry::OctreeTileID& rootID,
386 const CesiumGeometry::OctreeTileID& tileID) noexcept;
387
395 static std::optional<CesiumGeometry::QuadtreeTileID>
397
401 static std::optional<CesiumGeometry::OctreeTileID>
403
411 static QuadtreeChildren
413 return QuadtreeChildren{tileID};
414 }
415
423 static OctreeChildren
425 return OctreeChildren{tileID};
426 }
427
438 const CesiumTilesetJson::BoundingVolume& rootBoundingVolume,
439 const CesiumGeometry::QuadtreeTileID& tileID,
440 const CesiumGeospatial::Ellipsoid& ellipsoid
441 CESIUM_DEFAULT_ELLIPSOID) noexcept;
442
453 const CesiumTilesetJson::BoundingVolume& rootBoundingVolume,
454 const CesiumGeometry::OctreeTileID& tileID,
455 const CesiumGeospatial::Ellipsoid& ellipsoid
456 CESIUM_DEFAULT_ELLIPSOID) noexcept;
457
468 const CesiumGeospatial::BoundingRegion& rootBoundingVolume,
469 const CesiumGeometry::QuadtreeTileID& tileID,
470 const CesiumGeospatial::Ellipsoid& ellipsoid
471 CESIUM_DEFAULT_ELLIPSOID) noexcept;
472
483 const CesiumGeospatial::BoundingRegion& rootBoundingVolume,
484 const CesiumGeometry::OctreeTileID& tileID,
485 const CesiumGeospatial::Ellipsoid& ellipsoid
486 CESIUM_DEFAULT_ELLIPSOID) noexcept;
487
497 const CesiumGeometry::OrientedBoundingBox& rootBoundingVolume,
498 const CesiumGeometry::QuadtreeTileID& tileID) noexcept;
499
509 const CesiumGeometry::OrientedBoundingBox& rootBoundingVolume,
510 const CesiumGeometry::OctreeTileID& tileID) noexcept;
511
522 const CesiumGeospatial::S2CellBoundingVolume& rootBoundingVolume,
523 const CesiumGeometry::QuadtreeTileID& tileID,
524 const CesiumGeospatial::Ellipsoid& ellipsoid
525 CESIUM_DEFAULT_ELLIPSOID) noexcept;
526
537 const CesiumGeospatial::S2CellBoundingVolume& rootBoundingVolume,
538 const CesiumGeometry::OctreeTileID& tileID,
539 const CesiumGeospatial::Ellipsoid& ellipsoid
540 CESIUM_DEFAULT_ELLIPSOID) noexcept;
541
551 const CesiumGeometry::BoundingCylinderRegion& rootBoundingVolume,
552 const CesiumGeometry::QuadtreeTileID& tileID) noexcept;
553
563 const CesiumGeometry::BoundingCylinderRegion& rootBoundingVolume,
564 const CesiumGeometry::OctreeTileID& tileID) noexcept;
565};
566
567} // namespace Cesium3DTiles
Helper functions for working with 3D Tiles implicit tiling.
static double computeLevelDenominator(uint32_t level) noexcept
Computes the denominator for a given implicit tile level.
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 CesiumGeometry::BoundingCylinderRegion computeBoundingVolume(const CesiumGeometry::BoundingCylinderRegion &rootBoundingVolume, const CesiumGeometry::OctreeTileID &tileID) noexcept
Computes the bounding volume for an implicit octree tile with the given ID as a bounding cylinder.
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 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 CesiumTilesetJson::BoundingVolume computeBoundingVolume(const CesiumTilesetJson::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 CesiumTilesetJson::...
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 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 std::string resolveUrl(const std::string &baseUrl, const std::string &urlTemplate, const CesiumGeometry::QuadtreeTileID &quadtreeID)
Resolves a templatized implicit tiling URL with the given quadtree tile ID. This expects the URL to c...
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 computeMortonIndex(const CesiumGeometry::OctreeTileID &tileID)
Computes the Morton index for a given octree tile within its level.
static CesiumGeometry::BoundingCylinderRegion computeBoundingVolume(const CesiumGeometry::BoundingCylinderRegion &rootBoundingVolume, const CesiumGeometry::QuadtreeTileID &tileID) noexcept
Computes the bounding volume for an implicit quadtree tile with the given ID as a bounding cylinder.
static std::optional< CesiumGeometry::OctreeTileID > getParentID(const CesiumGeometry::OctreeTileID &tileID) noexcept
Gets the ID of the parent of the given tile. If the tile's level is 0, then it cannot have a parent a...
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 uint64_t computeMortonIndex(const CesiumGeometry::QuadtreeTileID &tileID)
Computes the Morton index for a given quadtree tile within its level.
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::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.
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 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 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 std::string resolveUrl(const std::string &baseUrl, const std::string &urlTemplate, const CesiumGeometry::OctreeTileID &octreeID)
Resolves a templatized implicit tiling URL with the given octree tile ID. This expects the URL to con...
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 CesiumTilesetJson::BoundingVolume computeBoundingVolume(const CesiumTilesetJson::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 CesiumTilesetJson::Bo...
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 std::optional< CesiumGeometry::QuadtreeTileID > getParentID(const CesiumGeometry::QuadtreeTileID &tileID) noexcept
Gets the ID of the parent of the given tile. If the tile's level is 0, then it cannot have a parent a...
An STL-compatible iterator over the children of an octree tile.
CesiumGeometry::OctreeTileID & reference
A reference to the type being iterated over.
void difference_type
The type used to identify distance between iterators.
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.
CesiumGeometry::OctreeTileID value_type
The type of value that is being iterated over.
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.
iterator operator++(int)
Advances the iterator to the next child.
CesiumGeometry::OctreeTileID * pointer
A pointer to the type being iterated over.
const CesiumGeometry::OctreeTileID * operator->() const
Returns a pointer to the current CesiumGeometry::OctreeTileID being iterated.
std::forward_iterator_tag iterator_category
The iterator category tag denoting this is a forward iterator.
iterator(const CesiumGeometry::OctreeTileID &parentTileID, bool isEnd) noexcept
Creates a new iterator over the children of a octree tile.
A lightweight virtual container enumerating the octree IDs of the children of a given octree tile.
iterator const_iterator
A const equivalent to iterator.
constexpr int64_t size() const noexcept
Returns the total number of CesiumGeometry::OctreeTileID children for this tile, which will always be...
OctreeChildren(const CesiumGeometry::OctreeTileID &tileID) noexcept
Creates a OctreeChildren instance from the provided parent tile.
iterator end() const noexcept
Returns an iterator starting after the last child.
iterator begin() const noexcept
Returns an iterator starting at the first child.
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 reference to the current CesiumGeometry::QuadtreeTileID being iterated.
CesiumGeometry::QuadtreeTileID * pointer
A pointer to the type being iterated over.
iterator & operator++()
Advances the iterator to the next child.
bool operator!=(const iterator &rhs) const noexcept
Checks if two iterators are NOT at the same child.
CesiumGeometry::QuadtreeTileID & reference
A reference to the type being iterated over.
iterator(const CesiumGeometry::QuadtreeTileID &parentTileID, bool isEnd) noexcept
Creates a new iterator over the children of a quadtree tile.
std::forward_iterator_tag iterator_category
The iterator category tag denoting this is a forward iterator.
CesiumGeometry::QuadtreeTileID value_type
The type of value that is being iterated over.
bool operator==(const iterator &rhs) const noexcept
Checks if two iterators are at the same child.
const CesiumGeometry::QuadtreeTileID * operator->() const
Returns a pointer to the current CesiumGeometry::QuadtreeTileID being iterated.
A lightweight virtual container enumerating the quadtree IDs of the children of a given quadtree tile...
QuadtreeChildren(const CesiumGeometry::QuadtreeTileID &tileID) noexcept
Creates a QuadtreeChildren instance from the provided parent tile.
constexpr int64_t size() const noexcept
Returns the total number of CesiumGeometry::QuadtreeTileID children for this tile,...
iterator const_iterator
A const equivalent to iterator.
iterator end() const noexcept
Returns an iterator starting after the last child.
iterator begin() const noexcept
Returns an iterator starting at the first child.
A bounding volume defined as a region following the surface of a cylinder between two radius values....
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:39
Classes that represent or enable fundamental elements of 3D Tiles.
Basic geometry classes for Cesium.
Classes for geospatial computations in Cesium.
Classes to represent a tileset.json from 3D Tiles 1.1.
A structure serving as a unique identifier for a node in an octree.
Uniquely identifies a node in a quadtree.
A bounding volume that encloses a tile or its content. At least one bounding volume property is requi...