cesium-native 0.52.0
Loading...
Searching...
No Matches
ActivatedRasterOverlay.h
1#pragma once
2
3#include <CesiumAsync/Future.h>
4#include <CesiumAsync/Promise.h>
5#include <CesiumAsync/SharedFuture.h>
6#include <CesiumGeometry/Rectangle.h>
7#include <CesiumGeospatial/Ellipsoid.h>
8#include <CesiumRasterOverlays/Library.h>
9#include <CesiumUtility/IntrusivePointer.h>
10#include <CesiumUtility/ReferenceCounted.h>
11
12#include <glm/vec2.hpp>
13
14namespace CesiumRasterOverlays {
15
16class RasterOverlay;
21
22} // namespace CesiumRasterOverlays
23
24namespace CesiumRasterOverlays {
25
71
80class CESIUMRASTEROVERLAYS_API ActivatedRasterOverlay
81 : public CesiumUtility::ReferenceCountedNonThreadSafe<
83public:
95 const RasterOverlayExternals& externals,
97 const CesiumGeospatial::Ellipsoid& ellipsoid
98 CESIUM_DEFAULT_ELLIPSOID) noexcept;
99
105
113 CesiumAsync::SharedFuture<void>& getReadyEvent();
114
120
126 getTileProvider() const noexcept;
127
130
143 const CesiumUtility::IntrusivePointer<RasterOverlayTileProvider>&
145
154
158
164 getPlaceholderTile() const noexcept;
165
168
190 const CesiumGeometry::Rectangle& rectangle,
191 const glm::dvec2& targetScreenPixels);
192
196 int64_t getTileDataBytes() const noexcept;
197
201 uint32_t getNumberOfTilesLoading() const noexcept;
202
214
233
257
258private:
260 doLoad(RasterOverlayTile& tile, bool isThrottledLoad);
261
269 void beginTileLoad(bool isThrottledLoad) noexcept;
270
279 void finalizeTileLoad(bool isThrottledLoad) noexcept;
280
281 CesiumUtility::IntrusivePointer<const CesiumRasterOverlays::RasterOverlay>
282 _pOverlay;
283 CesiumUtility::IntrusivePointer<
285 _pPlaceholderTileProvider;
287 _pPlaceholderTile;
288 CesiumUtility::IntrusivePointer<
290 _pTileProvider;
291
292 int64_t _tileDataBytes;
293 int32_t _totalTilesCurrentlyLoading;
294 int32_t _throttledTilesCurrentlyLoading;
295
296 CesiumAsync::Promise<void> _readyPromise;
297 CesiumAsync::SharedFuture<void> _readyEvent;
298};
299
300} // namespace CesiumRasterOverlays
A quadratic surface defined in Cartesian coordinates.
Definition Ellipsoid.h:39
CesiumAsync::SharedFuture< void > & getReadyEvent()
Gets a shared future that resolves when this instance is ready to provide tiles.
const CesiumRasterOverlays::RasterOverlay & getOverlay() const noexcept
Gets the RasterOverlay that was activated to create this instance.
ActivatedRasterOverlay(const RasterOverlayExternals &externals, const CesiumUtility::IntrusivePointer< const RasterOverlay > &pOverlay, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84) noexcept
Constructs a new instance.
const CesiumRasterOverlays::RasterOverlayTile * getPlaceholderTile() const noexcept
Gets the placeholder tile created by the getPlaceholderTileProvider.
CesiumUtility::IntrusivePointer< CesiumRasterOverlays::RasterOverlayTile > getTile(const CesiumGeometry::Rectangle &rectangle, const glm::dvec2 &targetScreenPixels)
Returns a new RasterOverlayTile with the given specifications.
void setTileProvider(const CesiumUtility::IntrusivePointer< RasterOverlayTileProvider > &pTileProvider)
Sets the tile provider for this activated overlay.
bool loadTileThrottled(RasterOverlayTile &tile)
Loads a tile, unless there are too many tile loads already in progress.
uint32_t getNumberOfTilesLoading() const noexcept
Returns the number of tiles that are currently loading.
void removeTile(RasterOverlayTile *pTile) noexcept
Removes a no-longer-referenced tile from this provider's cache and deletes it.
const CesiumRasterOverlays::RasterOverlayTileProvider * getTileProvider() const noexcept
Gets the tile provider created for this activated overlay. This will be nullptr before getReadyEvent ...
CesiumAsync::Future< TileProviderAndTile > loadTile(RasterOverlayTile &tile)
Loads a tile immediately, without throttling requests.
const CesiumRasterOverlays::RasterOverlayTileProvider * getPlaceholderTileProvider() const noexcept
Gets the placeholder tile provider.
int64_t getTileDataBytes() const noexcept
Gets the number of bytes of tile data that are currently loaded.
~ActivatedRasterOverlay() noexcept
Destroys the instance. Use addReference and releaseReference instead of destroying this instance dire...
External interfaces used by a RasterOverlay.
Provides individual tiles for a RasterOverlay on demand.
Raster image data for a tile in a quadtree.
The base class for a rasterized image that can be draped over a Cesium3DTilesSelection::Tileset....
A smart pointer that calls addReference and releaseReference on the controlled object.
Classes that support asynchronous operations.
Basic geometry classes for Cesium.
Classes for raster overlays, which allow draping massive 2D textures over a model.
Utility classes for Cesium.
Holds a tile and its corresponding tile provider. Used as the return value of ActivatedRasterOverlay:...
CesiumUtility::IntrusivePointer< RasterOverlayTile > pTile
A CesiumUtility::IntrusivePointer to the RasterOverlayTile used for this tile.
TileProviderAndTile(const CesiumUtility::IntrusivePointer< RasterOverlayTileProvider > &pTileProvider_, const CesiumUtility::IntrusivePointer< RasterOverlayTile > &pTile_) noexcept
Constructs an instance.
CesiumUtility::IntrusivePointer< RasterOverlayTileProvider > pTileProvider
A CesiumUtility::IntrusivePointer to the RasterOverlayTileProvider used for this tile.