3 #include "IPrepareRasterOverlayRendererResources.h"
5 #include "RasterOverlayTileProvider.h"
7 #include <CesiumAsync/AsyncSystem.h>
8 #include <CesiumAsync/IAssetAccessor.h>
9 #include <CesiumGeometry/QuadtreeTileID.h>
10 #include <CesiumGeometry/QuadtreeTilingScheme.h>
11 #include <CesiumUtility/CreditSystem.h>
45 const std::shared_ptr<CesiumAsync::IAssetAccessor>& pAssetAccessor,
46 std::optional<CesiumUtility::Credit> credit,
47 const std::shared_ptr<IPrepareRasterOverlayRendererResources>&
48 pPrepareRendererResources,
49 const std::shared_ptr<spdlog::logger>& pLogger,
53 uint32_t minimumLevel,
54 uint32_t maximumLevel,
56 uint32_t imageHeight) noexcept;
71 uint32_t
getWidth() const noexcept {
return this->_imageWidth; }
76 uint32_t
getHeight() const noexcept {
return this->_imageHeight; }
83 return this->_tilingScheme;
97 const glm::dvec2& screenPixels);
114 struct LoadedQuadtreeImage {
115 std::shared_ptr<LoadedRasterOverlayImage> pLoaded =
nullptr;
116 std::optional<CesiumGeometry::Rectangle> subset = std::nullopt;
132 std::vector<CesiumAsync::SharedFuture<LoadedQuadtreeImage>>
133 mapRasterTilesToGeometryTile(
135 const glm::dvec2 targetScreenPixels);
137 void unloadCachedTiles();
139 struct CombinedImageMeasurements {
142 int32_t heightPixels;
144 int32_t bytesPerChannel;
147 static CombinedImageMeasurements measureCombinedImage(
149 const std::vector<LoadedQuadtreeImage>& images);
151 static LoadedRasterOverlayImage combineImages(
154 std::vector<LoadedQuadtreeImage>&& images);
156 uint32_t _minimumLevel;
157 uint32_t _maximumLevel;
158 uint32_t _imageWidth;
159 uint32_t _imageHeight;
169 using TileLeastRecentlyUsedList = std::list<CacheEntry>;
170 TileLeastRecentlyUsedList _tilesOldToRecent;
175 TileLeastRecentlyUsedList::iterator>
178 std::atomic<int64_t> _cachedBytes;
A system for managing asynchronous requests and tasks.
A value that will be available in the future, as produced by AsyncSystem.
Defines how a rectangular region is divided into quadtree tiles.
uint32_t getHeight() const noexcept
Returns the image height of this instance, in pixels.
uint32_t computeLevelFromTargetScreenPixels(const CesiumGeometry::Rectangle &rectangle, const glm::dvec2 &screenPixels)
Computes the best quadtree level to use for an image intended to cover a given projected rectangle wh...
uint32_t getMinimumLevel() const noexcept
Returns the minimum tile level of this instance.
QuadtreeRasterOverlayTileProvider(const CesiumUtility::IntrusivePointer< const RasterOverlay > &pOwner, const CesiumAsync::AsyncSystem &asyncSystem, const std::shared_ptr< CesiumAsync::IAssetAccessor > &pAssetAccessor, std::optional< CesiumUtility::Credit > credit, const std::shared_ptr< IPrepareRasterOverlayRendererResources > &pPrepareRendererResources, const std::shared_ptr< spdlog::logger > &pLogger, const CesiumGeospatial::Projection &projection, const CesiumGeometry::QuadtreeTilingScheme &tilingScheme, const CesiumGeometry::Rectangle &coverageRectangle, uint32_t minimumLevel, uint32_t maximumLevel, uint32_t imageWidth, uint32_t imageHeight) noexcept
Creates a new instance.
virtual CesiumAsync::Future< LoadedRasterOverlayImage > loadQuadtreeTileImage(const CesiumGeometry::QuadtreeTileID &tileID) const =0
Asynchronously loads a tile in the quadtree.
const CesiumGeometry::QuadtreeTilingScheme & getTilingScheme() const noexcept
Returns the CesiumGeometry::QuadtreeTilingScheme of this instance.
uint32_t getWidth() const noexcept
Returns the image width of this instance, in pixels.
uint32_t getMaximumLevel() const noexcept
Returns the maximum tile level of this instance.
Provides individual tiles for a RasterOverlay on demand.
Raster image data for a tile in a quadtree.
A smart pointer that calls addReference and releaseReference on the controlled object.
std::variant< GeographicProjection, WebMercatorProjection > Projection
A projection.
Classes for raster overlays, which allow draping massive 2D textures over a model.
Uniquely identifies a node in a quadtree.